417. 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.

417.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 CompoundCreateUpdateDE.cs Tue Dec 20 19:51:46 2016 UTC
2 Wed Feb 1 19:56:33 2017 UTC

417.2 Comparison summary

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

417.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

417.4 Active regular expressions

No regular expressions were active.

417.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 CompoundCr eateUpdate DE>        
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          
34   namespace  Microsoft. Crm.Sdk.Sa mples        
35   {        
36          
37       /// <s ummary>        
38       /// Sh ows how to  create an d use comp ound Creat e and Upda te stateme nts.        
39       /// If  you want  to run thi s sample r epeatedly,  you have  the option  to         
40       /// de lete all t he records  created a t the end  of executi on.        
41       /// </ summary>        
42       public  class Com poundCreat eUpdateDE        
43       {        
44           #r egion Clas s Level Me mbers        
45           // / <summary >        
46           // / Stores t he organiz ation serv ice proxy.        
47           // / </summar y>        
48           pr ivate Orga nizationSe rviceProxy  _serviceP roxy;        
49           pr ivate IOrg anizationS ervice _se rvice;        
50          
51           //  Define th e IDs need ed for thi s sample.        
52           pr ivate Guid  _accountI d;        
53           pr ivate Guid [] _letter Ids;        
54          
55           #e ndregion C lass Level  Members        
56          
57           #r egion How  To Sample  Code        
58           // / <summary >        
59           // / Create a nd configu re the org anization  service pr oxy.        
60           // / Creates  an account  and some  associated  letters w ith a nest ed operati on.        
61           // / Updates  those reco rds with a  nested op eration.        
62           // / </summar y>        
63           // / <param n ame="serve rConfig">C ontains se rver conne ction info rmation.</ param>        
64           // / <param n ame="promp tForDelete ">When Tru e, the use r will be  prompted t o delete        
65           // / all crea ted entiti es.</param >        
66           pu blic void  Run(Server Connection .Configura tion serve rConfig, b ool prompt ForDelete)        
67           {        
68                try        
69                {        
70          
71                    // C onnect to  the Organi zation ser vice.         
72                    // T he using s tatement a ssures tha t the serv ice proxy  will be pr operly dis posed.        
73                    usin g (_servic eProxy = n ew Organiz ationServi ceProxy(se rverConfig .Organizat ionUri, se rverConfig .HomeRealm Uri,        
74                                                                              s erverConfi g.Credenti als, serve rConfig.De viceCreden tials))        
75                    {        
76                         _service =  (IOrganiz ationServi ce)_servic eProxy;        
77          
78                         //<snippet CompoundCr eateUpdate DE1>        
79                         //Define t he account  for which  we will a dd letters        
80                         Entity acc ountToCrea te = new E ntity("acc ount");        
81                         accountToC reate["nam e"] = "Exa mple Accou nt";        
82          
83                         //Define t he IDs of  the relate d letters  we will cr eate        
84                         _letterIds  = new[] {  Guid.NewG uid(), Gui d.NewGuid( ), Guid.Ne wGuid() };        
85          
86                         //This act s as a con tainer for  each lett er we crea te. Note t hat we hav en't        
87                         //define t he relatio nship betw een the le tter and a ccount yet .        
88          
89                         // Letter  1 for crea tion        
90                         Entity let ter1 = new  Entity("l etter");        
91                         letter1["s ubject"] =  "Letter 1 ";        
92                         letter1["a ctivityid" ] = _lette rIds[0];        
93          
94                         // Letter  2 for crea tion        
95                         Entity let ter2 = new  Entity("l etter");        
96                         letter2["s ubject"] =  "Letter 2 ";        
97                         letter2["a ctivityid" ] = _lette rIds[1];        
98          
99                         // Letter  3 for crea tion        
100                         Entity let ter3 = new  Entity("l etter");        
101                         letter3["s ubject"] =  "Letter 3 ";        
102                         letter3["a ctivityid" ] = _lette rIds[2];        
103          
104                         EntityColl ection rel atedLetter sToCreate  = new Enti tyCollecti on        
105                         {        
106                             Entity Name = "le tter",        
107                             Entiti es = { let ter1, lett er2, lette r3 }        
108                         };        
109          
110                         //Creates  the refere nce betwee n which re lationship  between L etter and        
111                         //Account  we would l ike to use .        
112                         Relationsh ip letterR elationshi p = new Re lationship ("Account_ Letters");        
113          
114                         //Adds the  letters t o the acco unt under  the specif ied relati onship        
115                         accountToC reate.Rela tedEntitie s.Add(lett erRelation ship, rela tedLetters ToCreate);        
116          
117                         //Passes t he Account  (which co ntains the  letters)         
118                         _accountId  = _servic e.Create(a ccountToCr eate);        
119          
120                         Console.Wr iteLine("A n account  and {0} le tters were  created." , _letterI ds.Length) ;        
121          
122          
123                         //Now we r un through  many of t he same st eps as the  above "Cr eate" exam ple        
124                         Entity acc ountToUpda te = new E ntity("acc ount");        
125                         accountToU pdate["nam e"] = "Exa mple Accou nt - Updat ed";        
126                         accountToU pdate["acc ountid"] =  _accountI d;        
127          
128                         // Letter  1 for upda tion        
129                         Entity let ter1Update  = new Ent ity("lette r");        
130                         letter1Upd ate["subje ct"] = "Le tter 1 - U pdated";        
131                         letter1Upd ate["activ ityid"] =  _letterIds [0];        
132          
133                         // Letter  2 for upda tion        
134                         Entity let ter2Update  = new Ent ity("lette r");        
135                         letter2Upd ate["subje ct"] = "Le tter 2 - U pdated";        
136                         letter2Upd ate["activ ityid"] =  _letterIds [1];        
137          
138                         // Letter  3 for upda tion        
139                         Entity let ter3Update  = new Ent ity("lette r");        
140                         letter3Upd ate["subje ct"] = "Le tter 3 - U pdated";        
141                         letter3Upd ate["activ ityid"] =  _letterIds [2];        
142          
143                         EntityColl ection rel atedLetter sToUpdate  = new Enti tyCollecti on        
144                         {        
145                             Entity Name = "le tter",        
146                             Entiti es = { let ter1Update , letter2U pdate, let ter3Update  }        
147                         };        
148          
149                         accountToU pdate.Rela tedEntitie s.Add(lett erRelation ship, rela tedLetters ToUpdate);        
150          
151                         //This wil l update t he account  as well a s all of t he related  letters        
152                         _service.U pdate(acco untToUpdat e);        
153          
154                         Console.Wr iteLine("A n account  and {0} le tters were  updated." , _letterI ds.Length) ;        
155          
156                         //</snippe tCompoundC reateUpdat eDE1>        
157          
158                         DeleteRequ iredRecord s(promptFo rDelete);        
159          
160                    }        
161                }        
162          
163                // Catch  any servi ce fault e xceptions  that Micro soft Dynam ics CRM th rows.        
164                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault>)        
165                {        
166                    // Y ou can han dle an exc eption her e or pass  it back to  the calli ng method.        
167                    thro w;        
168                }        
169           }        
170          
171           // / <summary >        
172           // / Deletes  any entity  records t hat were c reated for  this samp le.        
173           // / <param n ame="promp t">Indicat es whether  to prompt  the user  to delete  the record s created  in this sa mple.</par am>        
174           // / </summar y>        
175           pu blic void  DeleteRequ iredRecord s(bool pro mpt)        
176           {        
177                bool del eteRecords  = true;        
178          
179                if (prom pt)        
180                {        
181                    Cons ole.WriteL ine("\nDo  you want t hese entit y records  deleted? ( y/n) [y]:  ");        
182                    Stri ng answer  = Console. ReadLine() ;        
183          
184                    dele teRecords  = (answer. StartsWith ("y") || a nswer.Star tsWith("Y" ) || answe r == Strin g.Empty);        
185                }        
186          
187                if (dele teRecords)        
188                {        
189                    fore ach (Guid  letterId i n _letterI ds)        
190                    {        
191                         _service.D elete("let ter", lett erId);        
192                    }        
193                    _ser vice.Delet e("account ", _accoun tId);        
194          
195                    Cons ole.WriteL ine("Entit y records  have been  deleted.") ;        
196                }        
197           }        
198          
199           #e ndregion H ow To Samp le Code        
200          
201           #r egion Main        
202           // / <summary >        
203           // / Standard  Main() me thod used  by most SD K samples.        
204           // / </summar y>        
205           // / <param n ame="args" ></param>        
206           st atic publi c void Mai n(string[]  args)        
207           {        
208                try        
209                {        
210                    // O btain the  target org anization' s Web addr ess and cl ient logon          
211                    // c redentials  from the  user.        
212                    Serv erConnecti on serverC onnect = n ew ServerC onnection( );        
213                    Serv erConnecti on.Configu ration con fig = serv erConnect. GetServerC onfigurati on();        
214          
215                    Comp oundCreate UpdateDE a pp = new C ompoundCre ateUpdateD E();        
216                    app. Run(config , true);        
217                }        
218                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault> ex )        
219                {        
220                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
221                    Cons ole.WriteL ine("Times tamp: {0}" , ex.Detai l.Timestam p);        
222                    Cons ole.WriteL ine("Code:  {0}", ex. Detail.Err orCode);        
223                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Detail. Message);        
224                    Cons ole.WriteL ine("Plugi n Trace: { 0}", ex.De tail.Trace Text);        
225                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
226                         null == ex .Detail.In nerFault ?  "No Inner  Fault" :  "Has Inner  Fault");        
227                }        
228                catch (S ystem.Time outExcepti on ex)        
229                {        
230                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
231                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Message );        
232                    Cons ole.WriteL ine("Stack  Trace: {0 }", ex.Sta ckTrace);        
233                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
234                         null == ex .InnerExce ption.Mess age ? "No  Inner Faul t" : ex.In nerExcepti on.Message );        
235                }        
236                catch (S ystem.Exce ption ex)        
237                {        
238                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
239                    Cons ole.WriteL ine(ex.Mes sage);        
240          
241                    // D isplay the  details o f the inne r exceptio n.        
242                    if ( ex.InnerEx ception !=  null)        
243                    {        
244                         Console.Wr iteLine(ex .InnerExce ption.Mess age);        
245          
246                         FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault> f e = ex.Inn erExceptio n        
247                             as Fau ltExceptio n<Microsof t.Xrm.Sdk. Organizati onServiceF ault>;        
248                         if (fe !=  null)        
249                         {        
250                             Consol e.WriteLin e("Timesta mp: {0}",  fe.Detail. Timestamp) ;        
251                             Consol e.WriteLin e("Code: { 0}", fe.De tail.Error Code);        
252                             Consol e.WriteLin e("Message : {0}", fe .Detail.Me ssage);        
253                             Consol e.WriteLin e("Plugin  Trace: {0} ", fe.Deta il.TraceTe xt);        
254                             Consol e.WriteLin e("Inner F ault: {0}" ,        
255                                 nu ll == fe.D etail.Inne rFault ? " No Inner F ault" : "H as Inner F ault");        
256                         }        
257                    }        
258                }        
259                // Addit ional exce ptions to  catch: Sec urityToken Validation Exception,  ExpiredSe curityToke nException ,        
260                // Secur ityAccessD eniedExcep tion, Mess ageSecurit yException , and Secu rityNegoti ationExcep tion.        
261          
262                finally        
263                {        
264                             
265                    Cons ole.WriteL ine("Press  <Enter> t o exit.");        
266                    Cons ole.ReadLi ne();        
267                }        
268          
269           }        
270           #e ndregion M ain        
271          
272       }        
273   }        
274   //</snippe tCompoundC reateUpdat eDE>