Skip to content

Instantly share code, notes, and snippets.

@gashupl
Created July 4, 2019 06:16
Show Gist options
  • Save gashupl/caf0a5da788f1c1c810bf4b000f16cc5 to your computer and use it in GitHub Desktop.
Save gashupl/caf0a5da788f1c1c810bf4b000f16cc5 to your computer and use it in GitHub Desktop.
public class RepositoryFactory
{
private IOrganizationService service;
public RepositoryFactory(IOrganizationService service)
{
this.service = service;
}
public T Get<E, T>() where E : Entity where T : RepositoryBase<E>
{
var repository = (T)Activator.CreateInstance(typeof(T), this.service);
return repository;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment