Created
September 21, 2011 12:05
-
-
Save tswann/1231878 to your computer and use it in GitHub Desktop.
Some code for creating an instance of generated Organisation Service context class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private OrganizationServiceProxy _serviceProxy; | |
| private IOrganizationService _service; | |
| // Instance of your generated ServiceContext class | |
| private MyServiceContext _context; | |
| private ServerConnection _serverConnection; = new ServerConnection(); | |
| // This class can be found in the crmservicehelpers file under the samplecode\{language}\helpercode directory | |
| // of the CRM SDK | |
| private ServerConnection.Configuration _config = _serverConnection.GetServerConfiguration(); | |
| using(_serviceProxy = new OrganizationServiceProxy( | |
| _config.OrganizationUri, | |
| _config.HomeRealmUri, | |
| _config.Credentials, | |
| _config.DeviceCredentials)) | |
| { | |
| _serviceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior()); | |
| _service = (IOrganizationService)_serviceProxy; | |
| _context = new AcornServiceContext(_service); | |
| // Awesome CRUD operations here | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment