protected async Task <Result <K> > GetByIdCoreAsync <K>(params Expression <Func <T, bool> >[] keySelectors) where K : class, T { try { return((await GetByIdCoreAsync(keySelectors)) .Map(t => ShallowCloning <T, K> .Clone(t))); } catch (Exception e) { throw new Exception(string.Format(ExceptionMessages.Exception_GetEntityError, ResourceName), e); } }
protected async Task <Result <IList <K> > > GetAllCoreAsync <K, TKey>(Expression <Func <T, TKey> > orderBy, int page = 1, int?pageSize = Paging.pageSize, bool descendingOrder = false, params Expression <Func <T, bool> >[] where) where K : class, T { try { return((await GetAllCoreAsync(orderBy, page, pageSize, descendingOrder, where)) .Map(results => { IList <K> mappedlist = new List <K>(results.Count); foreach (var item in results) { mappedlist.Add(ShallowCloning <T, K> .Clone(item)); } return mappedlist; })); } catch (Exception e) { throw new Exception(string.Format(ExceptionMessages.Exception_GetEntitiesError, PluralResourceName), e); } }