Created
June 21, 2014 11:46
-
-
Save stdray/9c85a85350ac7a594361 to your computer and use it in GitHub Desktop.
This file contains 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 abstract class UsersRepositoryAsyncDaoBase<TItem, TListItem, TKey> : UsersDaoBase, IUsersRepositoryAsyncDao<TItem, TListItem, TKey> | |
{ | |
/// <summary> | |
/// Контекст безопастности | |
/// </summary> | |
protected IPrivateSecurityContext SecurityContext { get; set; } | |
protected int CurrentUserId { get { return SecurityContext.CurrentUser.WrObj.Id; }} | |
public Task<IPageable<TListItem>> ListAsync(PagingParams? pagingParams) | |
{ | |
return Task.Factory.StartNewLong(() => List(pagingParams)); | |
} | |
public Task<TKey> AddAsync(TItem item) | |
{ | |
return Task.Factory.StartNewLong(() => Add(item)); | |
} | |
public Task<TItem> GetAsync(TKey key) | |
{ | |
return Task.Factory.StartNewLong(() => Get(key)); | |
} | |
public Task<TItem> UpdateAsync(TItem item) | |
{ | |
return Task.Factory.StartNewLong(() => Update(item)); | |
} | |
public Task DeleteAsync(TKey key) | |
{ | |
return Task.Factory.StartNewLong(() => Delete(key)); | |
} | |
#region abstract | |
protected abstract IPageable<TListItem> List(PagingParams? pagingParams); | |
protected abstract TKey Add(TItem item); | |
protected abstract TItem Get(TKey key); | |
protected abstract TItem Update(TItem item); | |
protected abstract void Delete(TKey key); | |
#endregion | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment