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

403.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\EarlyBound CompoundCreateUpdate.cs Tue Dec 20 19:51:45 2016 UTC
2 Wed Feb 1 19:56:33 2017 UTC

403.2 Comparison summary

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

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

403.4 Active regular expressions

No regular expressions were active.

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