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

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

405.2 Comparison summary

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

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

405.4 Active regular expressions

No regular expressions were active.

405.5 Comparison detail

1   // ======= ========== ========== ========== ========== ========== ========== ==        
2   //  This f ile is par t of the M icrosoft D ynamics CR M SDK code  samples.        
3   //        
4   //  Copyri ght (C) Mi crosoft Co rporation.   All righ ts reserve d.        
5   //        
6   //  This s ource code  is intend ed only as  a supplem ent to Mic rosoft        
7   //  Develo pment Tool s and/or o n-line doc umentation .  See the se other        
8   //  materi als for de tailed inf ormation r egarding M icrosoft c ode sample s.        
9   //        
10   //  THIS C ODE AND IN FORMATION  ARE PROVID ED "AS IS"  WITHOUT W ARRANTY OF  ANY        
11   //  KIND,  EITHER EXP RESSED OR  IMPLIED, I NCLUDING B UT NOT LIM ITED TO TH E        
12   //  IMPLIE D WARRANTI ES OF MERC HANTABILIT Y AND/OR F ITNESS FOR  A        
13   //  PARTIC ULAR PURPO SE.        
14   // ======= ========== ========== ========== ========== ========== ========== ==        
15          
16   //<snippet CRUDOperat ions>        
17   using Syst em;        
18   using Syst em.Service Model;        
19   using Syst em.Service Model.Desc ription;        
20          
21   // These n amespaces  are found  in the Mic rosoft.Xrm .Sdk.dll a ssembly        
22   // located  in the SD K\bin fold er of the  SDK downlo ad.        
23   using Micr osoft.Xrm. Sdk;        
24   using Micr osoft.Xrm. Sdk.Query;        
25   using Micr osoft.Xrm. Sdk.Client ;        
26          
27   namespace  Microsoft. Crm.Sdk.Sa mples        
28   {        
29       /// <s ummary>        
30       /// De monstrates  how to do  basic ent ity operat ions like  create, re trieve,        
31       /// up date, and  delete.</s ummary>        
32       /// <r emarks>        
33       /// At  run-time,  you will  be given t he option  to delete  all the        
34       /// da tabase rec ords creat ed by this  program.< /remarks>        
35       public  class CRU DOperation s        
36       {        
37           #r egion Clas s Level Me mbers        
38          
39           pr ivate Guid  _accountI d;        
40           pr ivate Guid  _parentAc countId;        
41           pr ivate Orga nizationSe rviceProxy  _serviceP roxy;        
42                   
43           #e ndregion C lass Level  Members        
44          
45           #r egion How  To Sample  Code        
46           // / <summary >        
47           // / This met hod first  connects t o the Orga nization s ervice. Af terwards,        
48           // / basic cr eate, retr ieve, upda te, and de lete entit y operatio ns are per formed.        
49           // / </summar y>        
50           // / <param n ame="serve rConfig">C ontains se rver conne ction info rmation.</ param>        
51           // / <param n ame="promp tforDelete ">When Tru e, the use r will be  prompted t o delete a ll        
52           // / created  entities.< /param>        
53           pu blic void  Run(Server Connection .Configura tion serve rConfig, b ool prompt forDelete)        
54           {        
55                try        
56                {        
57                    //<s nippetCRUD Operations 1>        
58                    // C onnect to  the Organi zation ser vice.         
59                    // T he using s tatement a ssures tha t the serv ice proxy  will be pr operly dis posed.        
60                    usin g (_servic eProxy = n ew Organiz ationServi ceProxy(se rverConfig .Organizat ionUri, se rverConfig .HomeRealm Uri,server Config.Cre dentials,  serverConf ig.DeviceC redentials ))        
61                    {        
62                         // This st atement is  required  to enable  early-boun d type sup port.        
63                         _servicePr oxy.Enable ProxyTypes ();        
64          
65                         CreateRequ iredRecord s();        
66          
67                         // Instant iate an ac count obje ct.        
68                         // See the  Entity Me tadata top ic in the  SDK docume ntation to  determine          
69                         // which a ttributes  must be se t for each  entity.        
70                         Account ac count = ne w Account  { Name = " Fourth Cof fee" };        
71          
72                         // Create  an account  record na med Fourth  Coffee.        
73                         _accountId  = _servic eProxy.Cre ate(accoun t);        
74                         Console.Wr ite("{0} { 1} created , ", accou nt.Logical Name, acco unt.Name);        
75          
76                         // Retriev e the acco unt contai ning sever al of its  attributes .        
77                         ColumnSet  cols = new  ColumnSet (        
78                             new St ring[] { " name", "ad dress1_pos talcode",  "lastusedi ncampaign" , "version number" }) ;        
79          
80                         Account re trievedAcc ount = (Ac count)_ser viceProxy. Retrieve(" account",  _accountId , cols);        
81                         Console.Wr ite("retri eved ");        
82          
83                         // Retriev e version  number of  the accoun t. Shows B igInt attr ibute usag e.        
84                         long? vers ionNumber  = retrieve dAccount.V ersionNumb er;        
85          
86                         if (versio nNumber !=  null)        
87                             Consol e.WriteLin e("version  # {0}, ",  versionNu mber);        
88          
89                         // Update  the postal  code attr ibute.        
90                         retrievedA ccount.Add ress1_Post alCode = " 98052";        
91          
92                         // The add ress 2 pos tal code w as set acc identally,  so set it  to null.        
93                         retrievedA ccount.Add ress2_Post alCode = n ull;        
94          
95                         // Shows u sage of op tion set ( picklist)  enumeratio ns defined  in Option Sets.cs.        
96                         retrievedA ccount.Add ress1_Addr essTypeCod e = new Op tionSetVal ue((int)Ac countAddre ss1_Addres sTypeCode. Primary);        
97                         retrievedA ccount.Add ress1_Ship pingMethod Code = new  OptionSet Value((int )AccountAd dress1_Shi ppingMetho dCode.DHL) ;        
98                         retrievedA ccount.Ind ustryCode  = new Opti onSetValue ((int)Acco untIndustr yCode.Agri cultureand NonpetrolN aturalReso urceExtrac tion);        
99          
100                         // Shows u se of a Mo ney value.        
101                         retrievedA ccount.Rev enue = new  Money(500 0000);        
102          
103                         // Shows u se of a Bo olean valu e.        
104                         retrievedA ccount.Cre ditOnHold  = false;        
105          
106                         // Shows u se of Enti tyReferenc e.        
107                         retrievedA ccount.Par entAccount Id = new E ntityRefer ence(Accou nt.EntityL ogicalName , _parentA ccountId);        
108          
109                         // Shows u se of Memo  attribute .        
110                         retrievedA ccount.Des cription =  "Account  for Fourth  Coffee.";        
111          
112                         // Update  the accoun t record.        
113                         _servicePr oxy.Update (retrieved Account);        
114                         Console.Wr iteLine("a nd updated .");                              
115          
116                         DeleteRequ iredRecord s(promptfo rDelete);        
117                    }        
118                    //</ snippetCRU DOperation s1>        
119                }        
120          
121                // Catch  any servi ce fault e xceptions  that Micro soft Dynam ics CRM th rows.        
122                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault>)        
123                {        
124                    // Y ou can han dle an exc eption her e or pass  it back to  the calli ng method.        
125                    thro w;        
126                }        
127           }        
128          
129           // / <summary >        
130           // / Creates  any entity  records t hat this s ample requ ires.        
131           // / </summar y>        
132           pu blic void  CreateRequ iredRecord s()        
133           {        
134                // For t his sample , all requ ired entit ies are cr eated in t he Run() m ethod.        
135                Account  account =  new Accoun t { Name =  "Sample P arent Acco unt" };        
136                _parentA ccountId =  _serviceP roxy.Creat e(account) ;        
137           }        
138                 
139           // / <summary >        
140           // / Deletes  any entity  records t hat were c reated for  this samp le.        
141           // / <param n ame="promp t">Indicat es whether  to prompt  the user         
142           // / to delet e the reco rds create d in this  sample.</p aram>        
143           // / </summar y>        
144           pu blic void  DeleteRequ iredRecord s(bool pro mpt)        
145           {        
146                bool del eteRecords  = true;        
147          
148                if (prom pt)        
149                {        
150                    Cons ole.WriteL ine("\nDo  you want t hese entit y records  deleted? ( y/n) [y]:  ");        
151                    Stri ng answer  = Console. ReadLine() ;        
152          
153                    dele teRecords  = (answer. StartsWith ("y") || a nswer.Star tsWith("Y" ) || answe r == Strin g.Empty);        
154                }        
155          
156                if (dele teRecords)        
157                {        
158                    _ser viceProxy. Delete(Acc ount.Entit yLogicalNa me, _accou ntId);        
159                    _ser viceProxy. Delete(Acc ount.Entit yLogicalNa me, _paren tAccountId );        
160                    Cons ole.WriteL ine("Entit y records  have been  deleted.") ;        
161                }        
162           }        
163                 
164           #e ndregion H ow To Samp le Code        
165          
166           #r egion Main  method        
167          
168           // / <summary >        
169           // / Standard  Main() me thod used  by most SD K samples.        
170           // / </summar y>        
171           // / <param n ame="args" ></param>        
172           st atic publi c void Mai n(string[]  args)        
173           {        
174                try        
175                {        
176                    // O btain the  target org anization' s Web addr ess and cl ient logon          
177                    // c redentials  from the  user.        
178                    Serv erConnecti on serverC onnect = n ew ServerC onnection( );        
179                    Serv erConnecti on.Configu ration con fig = serv erConnect. GetServerC onfigurati on();        
180          
181                    CRUD Operations  app = new  CRUDOpera tions();        
182                    app. Run( confi g, true );        
183                }        
184          
185                //<snipp etCRUDOper ations2>        
186                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault> ex )        
187                {        
188                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
189                    Cons ole.WriteL ine("Times tamp: {0}" , ex.Detai l.Timestam p);        
190                    Cons ole.WriteL ine("Code:  {0}", ex. Detail.Err orCode);        
191                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Detail. Message);        
192                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
193                         null == ex .Detail.In nerFault ?  "No Inner  Fault" :  "Has Inner  Fault");        
194                }        
195                catch (S ystem.Time outExcepti on ex)        
196                {        
197                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
198                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Message );        
199                    Cons ole.WriteL ine("Stack  Trace: {0 }", ex.Sta ckTrace);        
200                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
201                         null == ex .InnerExce ption.Mess age ? "No  Inner Faul t" : ex.In nerExcepti on.Message );        
202                }        
203                catch (S ystem.Exce ption ex)        
204                {        
205                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
206                    Cons ole.WriteL ine(ex.Mes sage);        
207          
208                    // D isplay the  details o f the inne r exceptio n.        
209                    if ( ex.InnerEx ception !=  null)        
210                    {        
211                         Console.Wr iteLine(ex .InnerExce ption.Mess age);        
212          
213                         FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault> f e = ex.Inn erExceptio n        
214                             as Fau ltExceptio n<Microsof t.Xrm.Sdk. Organizati onServiceF ault>;        
215                         if (fe !=  null)        
216                         {        
217                             Consol e.WriteLin e("Timesta mp: {0}",  fe.Detail. Timestamp) ;        
218                             Consol e.WriteLin e("Code: { 0}", fe.De tail.Error Code);        
219                             Consol e.WriteLin e("Message : {0}", fe .Detail.Me ssage);        
220                             Consol e.WriteLin e("Trace:  {0}", fe.D etail.Trac eText);        
221                             Consol e.WriteLin e("Inner F ault: {0}" ,        
222                                 nu ll == fe.D etail.Inne rFault ? " No Inner F ault" : "H as Inner F ault");        
223                         }        
224                    }        
225                }        
226                //</snip petCRUDOpe rations2>        
227                // Addit ional exce ptions to  catch: Sec urityToken Validation Exception,  ExpiredSe curityToke nException ,        
228                // Secur ityAccessD eniedExcep tion, Mess ageSecurit yException , and Secu rityNegoti ationExcep tion.        
229          
230                finally        
231                {        
232                    Cons ole.WriteL ine("Press  <Enter> t o exit.");        
233                    Cons ole.ReadLi ne();        
234                }        
235           }        
236           #e ndregion M ain method        
237       }        
238   }        
239   //</snippe tCRUDOpera tions>