Skip to content

Instantly share code, notes, and snippets.

@jeremydmiller
Created January 23, 2018 18:51
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeremydmiller/41bd108bb2103d686d7e4363bfcdf328 to your computer and use it in GitHub Desktop.
Save jeremydmiller/41bd108bb2103d686d7e4363bfcdf328 to your computer and use it in GitHub Desktop.
Don't do this
public class RavenDBRepository<T, I> : IRepository<T, I> where T: IAggregateRoot<I> where I : struct, IIdentity<I>
{
private readonly IAsyncDocumentSession _session;
public RavenDBRepository(IAsyncDocumentSession session)
{
_session = session;
}
public async Task<T> GetAsync(I identity)
{
return await _session.LoadAsync<T>(identity.ToString());
}
public async Task StoreAsync(T entity)
{
await _session.StoreAsync(entity, entity.Identity.ToString());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment