416. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2/1/2017 2:56:33 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.

416.1 Files compared

# Location File Last Modified
1 C:\Araxis_Merge_Comprasion\Pub_un\BTSSS_CIF_122016.zip\BTSSS_CIF_12_20_16\clean\CRM\trunk\SDK\SampleCode\CS\GeneralProgramming\LateBound AssociateDisassociateDE.cs Tue Dec 20 19:51:45 2016 UTC
2 Wed Feb 1 19:56:33 2017 UTC

416.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 0 0
Changed 0 0
Inserted 0 0
Removed 1 255

416.3 Comparison options

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

416.4 Active regular expressions

No regular expressions were active.

416.5 Comparison detail

1   // ======= ========== ========== ========== ========== ========== ========== ==        
2   //        
3   //  This f ile is par t of the M icrosoft D ynamics CR M SDK code  samples.        
4   //        
5   //  Copyri ght (C) Mi crosoft Co rporation.   All righ ts reserve d.        
6   //        
7   //  This s ource code  is intend ed only as  a supplem ent to Mic rosoft        
8   //  Develo pment Tool s and/or o n-line doc umentation .  See the se other        
9   //  materi als for de tailed inf ormation r egarding M icrosoft c ode sample s.        
10   //        
11   //  THIS C ODE AND IN FORMATION  ARE PROVID ED "AS IS"  WITHOUT W ARRANTY OF  ANY        
12   //  KIND,  EITHER EXP RESSED OR  IMPLIED, I NCLUDING B UT NOT LIM ITED TO TH E        
13   //  IMPLIE D WARRANTI ES OF MERC HANTABILIT Y AND/OR F ITNESS FOR  A        
14   //  PARTIC ULAR PURPO SE.        
15   //        
16   // ======= ========== ========== ========== ========== ========== ========== ==        
17   //<snippet AssociateD isassociat eDE>        
18   using Syst em;        
19   using Syst em.Service Model;        
20   using Syst em.Service Model.Desc ription;        
21          
22   // These n amespaces  are found  in the Mic rosoft.Xrm .Sdk.dll a ssembly        
23   // found i n the SDK\ bin folder .        
24   using Micr osoft.Xrm. Sdk;        
25   using Micr osoft.Xrm. Sdk.Client ;        
26   using Micr osoft.Xrm. Sdk.Query;        
27   using Micr osoft.Xrm. Sdk.Discov ery;        
28          
29   // This na mespace is  found in  Microsoft. Crm.Sdk.Pr oxy.dll as sembly        
30   // found i n the SDK\ bin folder .        
31   using Micr osoft.Crm. Sdk.Messag es;        
32          
33   namespace  Microsoft. Crm.Sdk.Sa mples        
34   {        
35       public  class Ass ociateDisa ssociateDE        
36       {        
37           #r egion Clas s Level Me mbers        
38           // / <summary >        
39           // / Stores t he organiz ation serv ice proxy.        
40           // / </summar y>        
41           pr ivate Orga nizationSe rviceProxy  _serviceP roxy;        
42           pr ivate IOrg anizationS ervice _se rvice;        
43          
44           //  Define th e IDs need ed for thi s sample.        
45           pr ivate Guid  _contactI d;        
46           pr ivate Guid  _account1 Id;        
47           pr ivate Guid  _account2 Id;        
48           pr ivate Guid  _account3 Id;        
49          
50           #e ndregion C lass Level  Members        
51          
52           #r egion How  To Sample  Code        
53           // / <summary >        
54           // / Create a nd configu re the org anization  service pr oxy.        
55           // / Create a  team, a q ueue and a  role.        
56           // / Add read  queue pri vileges to  the role.        
57           // / Assign t he role to  the team  so that th ey can rea d the queu e.        
58           // / Assign t he queue t o the team .        
59           // / Optional ly delete  any entity  records t hat were c reated for  this samp le.        
60            / // </summa ry>        
61           // / <param n ame="serve rConfig">C ontains se rver conne ction info rmation.</ param>        
62           // / <param n ame="promp tForDelete ">When Tru e, the use r will be  prompted t o delete        
63           // / all crea ted entiti es.</param >        
64           pu blic void  Run(Server Connection .Configura tion serve rConfig, b ool prompt ForDelete)        
65           {        
66                try        
67                {        
68                    // C onnect to  the Organi zation ser vice.         
69                    // T he using s tatement a ssures tha t the serv ice proxy  will be pr operly dis posed.        
70                    usin g (_servic eProxy = n ew Organiz ationServi ceProxy(se rverConfig .Organizat ionUri, se rverConfig .HomeRealm Uri,        
71                                                                              s erverConfi g.Credenti als, serve rConfig.De viceCreden tials))        
72                    {        
73                         _service =  (IOrganiz ationServi ce)_servic eProxy;        
74          
75                         // Call th e method t o create a ny data th at this sa mple requi res.        
76                         CreateRequ iredRecord s();        
77          
78                         //<snippet AssociateD isassociat eDE1>        
79                         // The acc ount ID wo uld typica lly be pas sed in as  an argumen t or deter mined by a  query.        
80                         // The con tact ID wo uld typica lly be pas sed in as  an argumen t or deter mined by a  query.        
81                         // Associa te the acc ounts to t he contact  record.        
82          
83                         //Create a  collectio n of the e ntity ids  that will  be associa ted to the  contact.        
84                         EntityRefe renceColle ction rela tedEntitie s = new En tityRefere nceCollect ion();        
85                         relatedEnt ities.Add( new Entity Reference( "account",  _account1 Id));        
86                         relatedEnt ities.Add( new Entity Reference( "account",  _account2 Id));        
87                         relatedEnt ities.Add( new Entity Reference( "account",  _account3 Id));        
88          
89                         // Create  an object  that defin es the rel ationship  between th e contact  and accoun t.        
90                         Relationsh ip relatio nship = ne w Relation ship("acco unt_primar y_contact" );        
91          
92                         //Associat e the cont act with t he 3 accou nts.        
93                         _service.A ssociate(" contact",  _contactId , relation ship, rela tedEntitie s);        
94          
95                         Console.Wr iteLine("T he entitie s have bee n associat ed.");        
96          
97                         //Disassoc iate the r ecords.        
98                         _service.D isassociat e("contact ", _contac tId, relat ionship, r elatedEnti ties);        
99          
100                         //</snippe tAssociate Disassocia teDE1>        
101          
102                         Console.Wr iteLine("T he entitie s have bee n disassoc iated.");        
103          
104                         DeleteRequ iredRecord s(promptFo rDelete);        
105                    }        
106                }        
107          
108                // Catch  any servi ce fault e xceptions  that Micro soft Dynam ics CRM th rows.        
109                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault>)        
110                {        
111                    // Y ou can han dle an exc eption her e or pass  it back to  the calli ng method.        
112                    thro w;        
113                }        
114           }        
115          
116           // / <summary >        
117           // / This met hod create s any enti ty records  that this  sample re quires.        
118           // / Create a  team, a q ueue and a  role.        
119           // / Add read  queue pri vileges to  the role.        
120           // / Assign t he role to  the team  so that th ey can rea d the queu e.        
121           // / Assign t he queue t o the team .        
122           // / </summar y>        
123           pu blic void  CreateRequ iredRecord s()        
124           {        
125                // Insta ntiate a c ontact ent ity record  and set i ts propert y values.        
126                // See t he Entity  Metadata t opic in th e SDK docu mentatio t o determin        
127                // which  attribute s must be  set for ea ch entity.        
128                Entity s etupContac t = new En tity("cont act");        
129                setupCon tact["firs tname"] =  "John";        
130                setupCon tact["last name"] = " Doe";        
131                            
132                _contact Id = _serv ice.Create (setupCont act);        
133                Console. WriteLine( "Created { 0} {1}", s etupContac t["firstna me"], setu pContact[" lastname"] );        
134          
135                // Insta ntiate an  account en tity recor d and set  its proper ty values.        
136                Entity s etupAccoun t1 = new E ntity("acc ount");        
137                setupAcc ount1["nam e"] = "Exa mple Accou nt 1";        
138          
139                _account 1Id = _ser vice.Creat e(setupAcc ount1);        
140                Console. WriteLine( "Created { 0}", setup Account1[" name"]);        
141          
142                Entity s etupAccoun t2 = new E ntity("acc ount");        
143                setupAcc ount2["nam e"] = "Exa mple Accou nt 2";        
144          
145                _account 2Id = _ser vice.Creat e(setupAcc ount2);        
146                Console. WriteLine( "Created { 0}", setup Account2[" name"]);        
147          
148                Entity s etupAccoun t3 = new E ntity("acc ount");        
149                setupAcc ount3["nam e"] = "Exa mple Accou nt 3";        
150          
151                _account 3Id = _ser vice.Creat e(setupAcc ount3);        
152                Console. WriteLine( "Created { 0}", setup Account3[" name"]);        
153           }        
154          
155           // / <summary >        
156           // / Deletes  any entity  records t hat were c reated for  this samp le.        
157           // / <param n ame="promp t">Indicat es whether  to prompt  the user  to delete  the record s created  in this sa mple.</par am>        
158           // / </summar y>        
159           pu blic void  DeleteRequ iredRecord s(bool pro mpt)        
160           {        
161                bool del eteRecords  = true;        
162          
163                if (prom pt)        
164                {        
165                    Cons ole.WriteL ine("\nDo  you want t hese entit y records  deleted? ( y/n) [y]:  ");        
166                    Stri ng answer  = Console. ReadLine() ;        
167          
168                    dele teRecords  = (answer. StartsWith ("y") || a nswer.Star tsWith("Y" ) || answe r == Strin g.Empty);        
169                }        
170          
171                if (dele teRecords)        
172                {        
173                    _ser vice.Delet e("account ", _accoun t1Id);        
174                    _ser vice.Delet e("account ", _accoun t2Id);        
175                    _ser vice.Delet e("account ", _accoun t3Id);        
176          
177                    Cons ole.WriteL ine("Entit y records  have been  deleted.") ;        
178                }        
179           }        
180          
181           #e ndregion H ow To Samp le Code        
182          
183           #r egion Main        
184           // / <summary >        
185           // / Standard  Main() me thod used  by most SD K samples.        
186           // / </summar y>        
187           // / <param n ame="args" ></param>        
188           st atic publi c void Mai n(string[]  args)        
189           {        
190                try        
191                {        
192                    // O btain the  target org anization' s Web addr ess and cl ient logon          
193                    // c redentials  from the  user.        
194                    Serv erConnecti on serverC onnect = n ew ServerC onnection( );        
195                    Serv erConnecti on.Configu ration con fig = serv erConnect. GetServerC onfigurati on();        
196          
197                    Asso ciateDisas sociateDE  app = new  AssociateD isassociat eDE();        
198                    app. Run(config , true);        
199                }        
200                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault> ex )        
201                {        
202                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
203                    Cons ole.WriteL ine("Times tamp: {0}" , ex.Detai l.Timestam p);        
204                    Cons ole.WriteL ine("Code:  {0}", ex. Detail.Err orCode);        
205                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Detail. Message);        
206                    Cons ole.WriteL ine("Plugi n Trace: { 0}", ex.De tail.Trace Text);        
207                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
208                         null == ex .Detail.In nerFault ?  "No Inner  Fault" :  "Has Inner  Fault");        
209                }        
210                catch (S ystem.Time outExcepti on ex)        
211                {        
212                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
213                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Message );        
214                    Cons ole.WriteL ine("Stack  Trace: {0 }", ex.Sta ckTrace);        
215                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
216                         null == ex .InnerExce ption.Mess age ? "No  Inner Faul t" : ex.In nerExcepti on.Message );        
217                }        
218                catch (S ystem.Exce ption ex)        
219                {        
220                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
221                    Cons ole.WriteL ine(ex.Mes sage);        
222          
223                    // D isplay the  details o f the inne r exceptio n.        
224                    if ( ex.InnerEx ception !=  null)        
225                    {        
226                         Console.Wr iteLine(ex .InnerExce ption.Mess age);        
227          
228                         FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault> f e = ex.Inn erExceptio n        
229                             as Fau ltExceptio n<Microsof t.Xrm.Sdk. Organizati onServiceF ault>;        
230                         if (fe !=  null)        
231                         {        
232                             Consol e.WriteLin e("Timesta mp: {0}",  fe.Detail. Timestamp) ;        
233                             Consol e.WriteLin e("Code: { 0}", fe.De tail.Error Code);        
234                             Consol e.WriteLin e("Message : {0}", fe .Detail.Me ssage);        
235                             Consol e.WriteLin e("Plugin  Trace: {0} ", fe.Deta il.TraceTe xt);        
236                             Consol e.WriteLin e("Inner F ault: {0}" ,        
237                                 nu ll == fe.D etail.Inne rFault ? " No Inner F ault" : "H as Inner F ault");        
238                         }        
239                    }        
240                }        
241                // Addit ional exce ptions to  catch: Sec urityToken Validation Exception,  ExpiredSe curityToke nException ,        
242                // Secur ityAccessD eniedExcep tion, Mess ageSecurit yException , and Secu rityNegoti ationExcep tion.        
243          
244                finally        
245                {        
246                             
247                    Cons ole.WriteL ine("Press  <Enter> t o exit.");        
248                    Cons ole.ReadLi ne();        
249                }        
250          
251           }        
252           #e ndregion M ain        
253       }        
254   }        
255   //</snippe tAssociate Disassocia teDE>