Produced by Araxis Merge on 2/1/2017 2:57:27 PM Eastern Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | C:\Araxis_Merge_Comprasion\Pub_un\BTSSS_CIF_122016.zip\BTSSS_CIF_12_20_16\clean\CRM\trunk\SDK\Tools\WebResourceUtility\DataAccess | ConsolelessServerConnection.cs | Tue Dec 20 19:52:28 2016 UTC |
| 2 | Wed Feb 1 19:57:27 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 0 | 0 |
| Removed | 1 | 90 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | using Syst em; | |||||
| 2 | using Syst em.Collect ions.Gener ic; | |||||
| 3 | using Syst em.Service Model.Desc ription; | |||||
| 4 | using Syst em.Linq; | |||||
| 5 | ||||||
| 6 | // These n amespaces are found in the Mic rosoft.Xrm .Sdk.dll a ssembly | |||||
| 7 | // located in the SD K\bin fold er of the SDK downlo ad. | |||||
| 8 | using Micr osoft.Xrm. Sdk.Client ; | |||||
| 9 | using Micr osoft.Xrm. Sdk.Discov ery; | |||||
| 10 | ||||||
| 11 | namespace Microsoft. Crm.Sdk.Sa mples | |||||
| 12 | { | |||||
| 13 | public class Con solelessSe rverConnec tion : Ser verConnect ion | |||||
| 14 | { | |||||
| 15 | ||||||
| 16 | #r egion Priv ate proper ties | |||||
| 17 | ||||||
| 18 | pr ivate Conf iguration config = n ew Configu ration(); | |||||
| 19 | ||||||
| 20 | #e ndregion P rivate pro perties | |||||
| 21 | ||||||
| 22 | pu blic virtu al ServerC onnection. Configurat ion GetSer verConfigu ration(str ing server , string o rgName, st ring user, string pw , string d omain ) | |||||
| 23 | { | |||||
| 24 | config.S erverAddre ss = serve r; | |||||
| 25 | if (conf ig.ServerA ddress.End sWith(".dy namics.com ")) | |||||
| 26 | { | |||||
| 27 | conf ig.Endpoin tType = Au thenticati onProvider Type.LiveI d; | |||||
| 28 | conf ig.Discove ryUri = | |||||
| 29 | new Uri(St ring.Forma t("https:/ /dev.{0}/X RMServices /2011/Disc overy.svc" , config.S erverAddre ss)); | |||||
| 30 | conf ig.DeviceC redentials = GetDevi ceCredenti als(); | |||||
| 31 | Clie ntCredenti als creden tials = ne w ClientCr edentials( ); | |||||
| 32 | cred entials.Us erName.Use rName = us er; | |||||
| 33 | cred entials.Us erName.Pas sword = pw ; | |||||
| 34 | conf ig.Credent ials = cre dentials; | |||||
| 35 | conf ig.Organiz ationUri = GetOrgani zationAddr ess(config .Discovery Uri, orgNa me); | |||||
| 36 | } | |||||
| 37 | else if (config.Se rverAddres s.EndsWith (".com")) | |||||
| 38 | { | |||||
| 39 | conf ig.Endpoin tType = Au thenticati onProvider Type.Feder ation; | |||||
| 40 | conf ig.Discove ryUri = | |||||
| 41 | new Uri(St ring.Forma t("https:/ /{0}/XRMSe rvices/201 1/Discover y.svc", co nfig.Serve rAddress)) ; | |||||
| 42 | Clie ntCredenti als creden tials = ne w ClientCr edentials( ); | |||||
| 43 | cred entials.Wi ndows.Clie ntCredenti al = new S ystem.Net. NetworkCre dential(us er, pw, do main); | |||||
| 44 | conf ig.Credent ials = cre dentials; | |||||
| 45 | conf ig.Organiz ationUri = GetOrgani zationAddr ess(config .Discovery Uri, orgNa me); | |||||
| 46 | } | |||||
| 47 | else | |||||
| 48 | { | |||||
| 49 | conf ig.Endpoin tType = Au thenticati onProvider Type.Activ eDirectory ; | |||||
| 50 | conf ig.Discove ryUri = | |||||
| 51 | new Uri(St ring.Forma t("http:// {0}/XRMSer vices/2011 /Discovery .svc", con fig.Server Address)); | |||||
| 52 | Clie ntCredenti als creden tials = ne w ClientCr edentials( ); | |||||
| 53 | cred entials.Wi ndows.Clie ntCredenti al = new S ystem.Net. NetworkCre dential(us er, pw, do main); | |||||
| 54 | conf ig.Credent ials = cre dentials; | |||||
| 55 | conf ig.Organiz ationUri = GetOrgani zationAddr ess(config .Discovery Uri, orgNa me); | |||||
| 56 | } | |||||
| 57 | ||||||
| 58 | if (conf igurations == null) configurat ions = new List<Conf iguration> (); | |||||
| 59 | configur ations.Add (config); | |||||
| 60 | ||||||
| 61 | return c onfig; | |||||
| 62 | } | |||||
| 63 | ||||||
| 64 | pr otected vi rtual Uri GetOrganiz ationAddre ss(Uri dis coveryServ iceUri, st ring orgNa me) | |||||
| 65 | { | |||||
| 66 | using (D iscoverySe rviceProxy servicePr oxy = new DiscoveryS erviceProx y(discover yServiceUr i, null, c onfig.Cred entials, c onfig.Devi ceCredenti als)) | |||||
| 67 | { | |||||
| 68 | // O btain orga nization i nformation from the Discovery service. | |||||
| 69 | if ( servicePro xy != null ) | |||||
| 70 | { | |||||
| 71 | // Obtain informatio n about th e organiza tions that the syste m user bel ongs to. | |||||
| 72 | Organizati onDetailCo llection o rgs = Disc overOrgani zations(se rviceProxy ); | |||||
| 73 | ||||||
| 74 | Organizati onDetail o rg = orgs. Where(x => x.UniqueN ame.ToLowe r() == org Name.ToLow er()).Firs tOrDefault (); | |||||
| 75 | ||||||
| 76 | if (org != null) | |||||
| 77 | { | |||||
| 78 | return new Syste m.Uri(org. Endpoints[ EndpointTy pe.Organiz ationServi ce]); | |||||
| 79 | } | |||||
| 80 | else | |||||
| 81 | { | |||||
| 82 | throw new Invali dOperation Exception( "That OrgN ame does n ot exist o n that ser ver."); | |||||
| 83 | } | |||||
| 84 | } | |||||
| 85 | else | |||||
| 86 | throw new Exception( "An invali d server n ame was sp ecified.") ; | |||||
| 87 | } | |||||
| 88 | } | |||||
| 89 | } | |||||
| 90 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.