Skip to content

Instantly share code, notes, and snippets.

@tswann
Created September 21, 2011 12:05
Show Gist options
  • Save tswann/1231878 to your computer and use it in GitHub Desktop.
Save tswann/1231878 to your computer and use it in GitHub Desktop.
Some code for creating an instance of generated Organisation Service context class
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