Skip to content

Instantly share code, notes, and snippets.

@gashupl
Created May 27, 2019 17:57
Show Gist options
  • Save gashupl/fcf8396b520296a3f50cff19522f0d41 to your computer and use it in GitHub Desktop.
Save gashupl/fcf8396b520296a3f50cff19522f0d41 to your computer and use it in GitHub Desktop.
public class OpportunityRepository : IOpportunityRepository
{
protected IOrganizationService orgService;
public OpportunityRepository(IOrganizationService service)
{
this.orgService = service;
}
public Opportunity GetById(Guid id)
{
return this.orgService.Retrieve(Opportunity.EntityLogicalName, id, new ColumnSet(true))?.ToEntity<Opportunity>();
}
public Guid Create(Opportunity opportunity)
{
return this.orgService.Create(opportunity);
}
public void Dispose()
{
this.serviceContext.Dispose();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment