Produced by Araxis Merge on 2/1/2017 2:56:19 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\SampleCode\CS\Azure\OneWayListener | OneWayListener.cs | Tue Dec 20 19:51:42 2016 UTC |
| 2 | Wed Feb 1 19:56:19 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 0 | 0 |
| Removed | 1 | 194 |
| 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 | // ======= ========== ========== ========== ========== ========== ========== ========== = | |||||
| 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 | ||||||
| 17 | //<snippet OneWayList ener> | |||||
| 18 | using Syst em; | |||||
| 19 | using Syst em.Collect ions.Gener ic; | |||||
| 20 | using Syst em.Service Model; | |||||
| 21 | using Syst em.Service Model.Desc ription; | |||||
| 22 | using Syst em.Text; | |||||
| 23 | ||||||
| 24 | using Micr osoft.Xrm. Sdk; | |||||
| 25 | using Micr osoft.Serv iceBus; | |||||
| 26 | ||||||
| 27 | namespace Microsoft. Crm.Sdk.Sa mples | |||||
| 28 | { | |||||
| 29 | [Servi ceBehavior ] | |||||
| 30 | class RemoteServ ice : ISer viceEndpoi ntPlugin | |||||
| 31 | { | |||||
| 32 | #r egion ISer viceEndpoi ntPlugin M ember | |||||
| 33 | ||||||
| 34 | pu blic void Execute(Re moteExecut ionContext context) | |||||
| 35 | { | |||||
| 36 | Utility. Print(cont ext); | |||||
| 37 | } | |||||
| 38 | ||||||
| 39 | #e ndregion | |||||
| 40 | } | |||||
| 41 | ||||||
| 42 | class Program | |||||
| 43 | { | |||||
| 44 | st atic void Main(strin g[] args) | |||||
| 45 | { | |||||
| 46 | ServiceB usEnvironm ent.System Connectivi ty.Mode = Connectivi tyMode.Htt p; | |||||
| 47 | ||||||
| 48 | Console. Write("You r Service Namespace: "); | |||||
| 49 | string s erviceName space = Co nsole.Read Line(); | |||||
| 50 | Console. Write("You r Issuer N ame: "); | |||||
| 51 | string i ssuerName = Console. ReadLine() ; | |||||
| 52 | ||||||
| 53 | // The i ssuer secr et is the Service Bu s namespac e manageme nt key. | |||||
| 54 | Console. Write("You r Issuer S ecret: "); | |||||
| 55 | string i ssuerSecre t = Consol e.ReadLine (); | |||||
| 56 | ||||||
| 57 | // Creat e the serv ice URI ba sed on the service n amespace. | |||||
| 58 | Uri addr ess = Serv iceBusEnvi ronment.Cr eateServic eUri(Uri.U riSchemeHt tps, servi ceNamespac e, "Remote Service"); | |||||
| 59 | Console. WriteLine( "Service a ddress: " + address) ; | |||||
| 60 | ||||||
| 61 | // Creat e the cred entials ob ject for t he endpoin t. | |||||
| 62 | Transpor tClientEnd pointBehav ior shared SecretServ iceBusCred ential = n ew Transpo rtClientEn dpointBeha vior() | |||||
| 63 | { | |||||
| 64 | Toke nProvider = TokenPro vider.Crea teSharedSe cretTokenP rovider(is suerName, issuerSecr et) | |||||
| 65 | }; | |||||
| 66 | ||||||
| 67 | // Creat e the bind ing object . | |||||
| 68 | WS2007Ht tpRelayBin ding bindi ng = new W S2007HttpR elayBindin g(); | |||||
| 69 | binding. Security.M ode = EndT oEndSecuri tyMode.Tra nsport; | |||||
| 70 | ||||||
| 71 | // Creat e the serv ice host r eading the configura tion. | |||||
| 72 | ServiceH ost host = new Servi ceHost(typ eof(Remote Service)); | |||||
| 73 | host.Add ServiceEnd point(type of(IServic eEndpointP lugin), bi nding, add ress); | |||||
| 74 | ||||||
| 75 | // Creat e the Serv iceRegistr ySettings behavior f or the end point. | |||||
| 76 | IEndpoin tBehavior serviceReg istrySetti ngs = new ServiceReg istrySetti ngs(Discov eryType.Pu blic); | |||||
| 77 | ||||||
| 78 | // Add t he Service Bus crede ntials to all endpoi nts specif ied in con figuration . | |||||
| 79 | foreach (ServiceEn dpoint end point in h ost.Descri ption.Endp oints) | |||||
| 80 | { | |||||
| 81 | endp oint.Behav iors.Add(s erviceRegi strySettin gs); | |||||
| 82 | endp oint.Behav iors.Add(s haredSecre tServiceBu sCredentia l); | |||||
| 83 | } | |||||
| 84 | ||||||
| 85 | // Open the servic e. | |||||
| 86 | host.Ope n(); | |||||
| 87 | ||||||
| 88 | Console. WriteLine( "Press [En ter] to ex it"); | |||||
| 89 | Console. ReadLine() ; | |||||
| 90 | ||||||
| 91 | // Close the servi ce. | |||||
| 92 | Console. Write("Clo sing the s ervice hos t..."); | |||||
| 93 | host.Clo se(); | |||||
| 94 | Console. WriteLine( " done."); | |||||
| 95 | } | |||||
| 96 | } | |||||
| 97 | ||||||
| 98 | intern al static class Util ity | |||||
| 99 | { | |||||
| 100 | pu blic stati c void Pri nt(RemoteE xecutionCo ntext cont ext) | |||||
| 101 | { | |||||
| 102 | Console. WriteLine( "--------- -"); | |||||
| 103 | if (cont ext == nul l) | |||||
| 104 | { | |||||
| 105 | Cons ole.WriteL ine("Conte xt is null ."); | |||||
| 106 | retu rn; | |||||
| 107 | } | |||||
| 108 | ||||||
| 109 | Console. WriteLine( "UserId: { 0}", conte xt.UserId) ; | |||||
| 110 | Console. WriteLine( "Organizat ionId: {0} ", context .Organizat ionId); | |||||
| 111 | Console. WriteLine( "Organizat ionName: { 0}", conte xt.Organiz ationName) ; | |||||
| 112 | Console. WriteLine( "MessageNa me: {0}", context.Me ssageName) ; | |||||
| 113 | Console. WriteLine( "Stage: {0 }", contex t.Stage); | |||||
| 114 | Console. WriteLine( "Mode: {0} ", context .Mode); | |||||
| 115 | Console. WriteLine( "PrimaryEn tityName: {0}", cont ext.Primar yEntityNam e); | |||||
| 116 | Console. WriteLine( "Secondary EntityName : {0}", co ntext.Seco ndaryEntit yName); | |||||
| 117 | ||||||
| 118 | Console. WriteLine( "BusinessU nitId: {0} ", context .BusinessU nitId); | |||||
| 119 | Console. WriteLine( "Correlati onId: {0}" , context. Correlatio nId); | |||||
| 120 | Console. WriteLine( "Depth: {0 }", contex t.Depth); | |||||
| 121 | Console. WriteLine( "Initiatin gUserId: { 0}", conte xt.Initiat ingUserId) ; | |||||
| 122 | Console. WriteLine( "IsExecuti ngOffline: {0}", con text.IsExe cutingOffl ine); | |||||
| 123 | Console. WriteLine( "IsInTrans action: {0 }", contex t.IsInTran saction); | |||||
| 124 | Console. WriteLine( "Isolation Mode: {0}" , context. IsolationM ode); | |||||
| 125 | Console. WriteLine( "Mode: {0} ", context .Mode); | |||||
| 126 | Console. WriteLine( "Operation CreatedOn: {0}", con text.Opera tionCreate dOn.ToStri ng()); | |||||
| 127 | Console. WriteLine( "Operation Id: {0}", context.Op erationId) ; | |||||
| 128 | Console. WriteLine( "PrimaryEn tityId: {0 }", contex t.PrimaryE ntityId); | |||||
| 129 | Console. WriteLine( "OwningExt ension Log icalName: {0}", cont ext.Owning Extension. LogicalNam e); | |||||
| 130 | Console. WriteLine( "OwningExt ension Nam e: {0}", c ontext.Own ingExtensi on.Name); | |||||
| 131 | Console. WriteLine( "OwningExt ension Id: {0}", con text.Ownin gExtension .Id); | |||||
| 132 | Console. WriteLine( "SharedVar iables: {0 }", (conte xt.SharedV ariables = = null ? " NULL" : | |||||
| 133 | Seri alizeParam eterCollec tion(conte xt.SharedV ariables)) ); | |||||
| 134 | Console. WriteLine( "InputPara meters: {0 }", (conte xt.InputPa rameters = = null ? " NULL" : | |||||
| 135 | Seri alizeParam eterCollec tion(conte xt.InputPa rameters)) ); | |||||
| 136 | Console. WriteLine( "OutputPar ameters: { 0}", (cont ext.Output Parameters == null ? "NULL" : | |||||
| 137 | Seri alizeParam eterCollec tion(conte xt.OutputP arameters) )); | |||||
| 138 | Console. WriteLine( "PreEntity Images: {0 }", (conte xt.PreEnti tyImages = = null ? " NULL" : | |||||
| 139 | Seri alizeEntit yImageColl ection(con text.PreEn tityImages ))); | |||||
| 140 | Console. WriteLine( "PostEntit yImages: { 0}", (cont ext.PostEn tityImages == null ? "NULL" : | |||||
| 141 | Seri alizeEntit yImageColl ection(con text.PostE ntityImage s))); | |||||
| 142 | Console. WriteLine( "--------- -"); | |||||
| 143 | } | |||||
| 144 | ||||||
| 145 | #r egion Priv ate method s. | |||||
| 146 | pr ivate stat ic string SerializeE ntity(Enti ty e) | |||||
| 147 | { | |||||
| 148 | StringBu ilder sb = new Strin gBuilder() ; | |||||
| 149 | sb.Appen d(Environm ent.NewLin e); | |||||
| 150 | sb.Appen d(" Logica lName: " + e.Logical Name); | |||||
| 151 | sb.Appen d(Environm ent.NewLin e); | |||||
| 152 | sb.Appen d(" Entity Id: " + e. Id); | |||||
| 153 | sb.Appen d(Environm ent.NewLin e); | |||||
| 154 | sb.Appen d(" Attrib utes: ["); | |||||
| 155 | foreach (KeyValueP air<string , object> parameter in e.Attri butes) | |||||
| 156 | { | |||||
| 157 | sb.A ppend(para meter.Key + ": " + p arameter.V alue + "; "); | |||||
| 158 | } | |||||
| 159 | sb.Appen d("]"); | |||||
| 160 | return s b.ToString (); | |||||
| 161 | } | |||||
| 162 | ||||||
| 163 | pr ivate stat ic string SerializeP arameterCo llection(P arameterCo llection p arameterCo llection) | |||||
| 164 | { | |||||
| 165 | StringBu ilder sb = new Strin gBuilder() ; | |||||
| 166 | foreach (KeyValueP air<string , object> parameter in paramet erCollecti on) | |||||
| 167 | { | |||||
| 168 | if ( parameter. Value != n ull && par ameter.Val ue.GetType () == type of(Entity) ) | |||||
| 169 | { | |||||
| 170 | Entity e = (Entity)p arameter.V alue; | |||||
| 171 | sb.Append( parameter. Key + ": " + Seriali zeEntity(e )); | |||||
| 172 | } | |||||
| 173 | else | |||||
| 174 | { | |||||
| 175 | sb.Append( parameter. Key + ": " + paramet er.Value + "; "); | |||||
| 176 | } | |||||
| 177 | } | |||||
| 178 | return s b.ToString (); | |||||
| 179 | } | |||||
| 180 | ||||||
| 181 | pr ivate stat ic string SerializeE ntityImage Collection (EntityIma geCollecti on entityI mageCollec tion) | |||||
| 182 | { | |||||
| 183 | StringBu ilder sb = new Strin gBuilder() ; | |||||
| 184 | foreach (KeyValueP air<string , Entity> entityImag e in entit yImageColl ection) | |||||
| 185 | { | |||||
| 186 | sb.A ppend(Envi ronment.Ne wLine); | |||||
| 187 | sb.A ppend(enti tyImage.Ke y + ": " + Serialize Entity(ent ityImage.V alue)); | |||||
| 188 | } | |||||
| 189 | return s b.ToString (); | |||||
| 190 | } | |||||
| 191 | #e ndregion | |||||
| 192 | } | |||||
| 193 | } | |||||
| 194 | //</snippe tOneWayLis tener> |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.