Skip to content

Instantly share code, notes, and snippets.

@gashupl
Created July 4, 2019 06:15
Show Gist options
  • Save gashupl/362da084f54ecc53f503b42718ba1fec to your computer and use it in GitHub Desktop.
Save gashupl/362da084f54ecc53f503b42718ba1fec 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>, new()
{
var repository = new T();
repository.Initialize(this.service);
return repository;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment