Created
January 23, 2018 18:51
-
-
Save jeremydmiller/41bd108bb2103d686d7e4363bfcdf328 to your computer and use it in GitHub Desktop.
Don't do this
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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