apply fix on Query methods in Base EF Repository for Fixing total Pages and total Filtered Pages ...

This commit is contained in:
2025-12-26 01:18:16 +03:30
parent 27325a7904
commit eaf948f8c1
+283 -189
View File
@@ -11,10 +11,12 @@ using xDataService.Db;
using xDataService.Extensions;
using xDataService.Interfaces;
using xDataService.Models;
using xExceptions.Constants;
using xModels.Base;
using xModels.Dtos;
namespace xDataService.EFRepositories {
namespace xDataService.EFRepositories
{
/// <summary>
/// Base EFCore Base Entity Repository Pattern implementation ...
/// Only Used on EFCore ...
@@ -24,7 +26,8 @@ namespace xDataService.EFRepositories {
/// <typeparam name="TDbContext">is the DbContext Type</typeparam>
public abstract class XBaseEFRepository<T, TKey, TDbContext> : IXBaseRepository<T, TKey>
where T : XBaseEntity<TKey>
where TDbContext : XDbContext {
where TDbContext : XDbContext
{
//
public readonly DbSet<T> dbSet;
private readonly IXKeyGenerator<T, TKey> keyGenerator;
@@ -42,7 +45,8 @@ namespace xDataService.EFRepositories {
XDataServiceConfiguration configuration,
IXKeyGenerator<T, TKey> keyGenerator = null,
IXBaseRepositoryEvents<T> baseRepositoryEvents = null
) {
)
{
this.keyGenerator = keyGenerator;
//
this.unitOfWorks = unitOfWorks;
@@ -57,7 +61,8 @@ namespace xDataService.EFRepositories {
public async Task<T> AddAsync(
T item,
bool saveChanges = true
) {
)
{
//
// Handle Key ...
item = await HandleKeyAsync(item);
@@ -68,7 +73,8 @@ namespace xDataService.EFRepositories {
//
// Check action is Succeeded or not ...
var isSucceed = false;
if (saveChanges) {
if (saveChanges)
{
//
// Get Modified Count ...
var qResult = await SaveChangesAsync();
@@ -83,7 +89,8 @@ namespace xDataService.EFRepositories {
if (
isSucceed &&
!baseRepositoryEvents.IsNull()
) {
)
{
baseRepositoryEvents
.AddEvent(new XBaseEventModel<T>(entry.Entity));
}
@@ -98,15 +105,19 @@ namespace xDataService.EFRepositories {
public async Task<T> AddOrUpdateAsync(
T item,
bool saveChanges = true
) {
)
{
//
var isExists = await IsExistsAsync(GetKey(item));
if (!isExists) {
if (!isExists)
{
return await AddAsync(
item,
saveChanges
);
} else {
}
else
{
return await UpdateAsync(
GetKey(item),
item,
@@ -118,7 +129,8 @@ namespace xDataService.EFRepositories {
public async Task AddRangeAsync(
IEnumerable<T> items,
bool saveChanges = true
) {
)
{
//
await dbSet.AddRangeAsync(
await Task
@@ -131,7 +143,8 @@ namespace xDataService.EFRepositories {
//
// Check action is Succeeded or not ...
var isSucceed = false;
if (saveChanges) {
if (saveChanges)
{
//
// Get Modified Count ...
var qResult = await SaveChangesAsync();
@@ -146,7 +159,8 @@ namespace xDataService.EFRepositories {
if (
isSucceed &&
!baseRepositoryEvents.IsNull()
) {
)
{
baseRepositoryEvents
.AddManyEvent(new XBaseEventModel<IEnumerable<T>>(null));
}
@@ -159,32 +173,38 @@ namespace xDataService.EFRepositories {
TKey id,
bool softDelete = true,
bool saveChanges = true
) {
)
{
//
// Retrieve Item ...
var item = await GetAsync(
id,
ignoreSoftDeleteds: false
);
if (item.IsNull ()) {
if (item.IsNull())
{
return null;
}
//
// Handle Remove ...
EntityEntry<T> entry = null;
if (softDelete && configuration.EnableSoftDelete) {
if (softDelete && configuration.EnableSoftDelete)
{
//
item.Deleted = true;
entry = dbSet.Update(item);
} else {
}
else
{
entry = dbSet.Remove(item);
}
//
// Check action is Succeeded or not ...
var isSucceed = false;
if (saveChanges) {
if (saveChanges)
{
//
// Get Modified Count ...
var qResult = await SaveChangesAsync();
@@ -199,7 +219,8 @@ namespace xDataService.EFRepositories {
if (
isSucceed &&
!baseRepositoryEvents.IsNull()
) {
)
{
baseRepositoryEvents
.RemoveEvent(new XBaseEventModel<T>(entry.Entity));
}
@@ -215,32 +236,38 @@ namespace xDataService.EFRepositories {
T item,
bool softDelete = true,
bool saveChanges = true
) {
)
{
//
// Check item Exists ...
var isExists = await IsExistsAsync(
GetKey(item),
ignoreSoftDeleteds: false
);
if (!isExists) {
if (!isExists)
{
return null;
}
//
// Handle Remove ...
EntityEntry<T> entry = null;
if (softDelete && configuration.EnableSoftDelete) {
if (softDelete && configuration.EnableSoftDelete)
{
//
item.Deleted = true;
entry = dbSet.Update(item);
} else {
}
else
{
entry = dbSet.Remove(item);
}
//
// Check action is Succeeded or not ...
var isSucceed = false;
if (saveChanges) {
if (saveChanges)
{
//
// Get Modified Count ...
var qResult = await SaveChangesAsync();
@@ -255,7 +282,8 @@ namespace xDataService.EFRepositories {
if (
isSucceed &&
!baseRepositoryEvents.IsNull()
) {
)
{
baseRepositoryEvents
.RemoveEvent(new XBaseEventModel<T>(entry.Entity));
}
@@ -271,25 +299,31 @@ namespace xDataService.EFRepositories {
IEnumerable<T> items,
bool softDelete = true,
bool saveChanges = true
) {
)
{
//
// Handle Remove ...
if (softDelete && configuration.EnableSoftDelete) {
if (softDelete && configuration.EnableSoftDelete)
{
//
foreach (var item in items) {
foreach (var item in items)
{
item.Deleted = true;
}
//
dbSet.UpdateRange(items);
} else {
}
else
{
dbSet.RemoveRange(items);
}
//
// Check action is Succeeded or not ...
var isSucceed = false;
if (saveChanges) {
if (saveChanges)
{
//
// Get Modified Count ...
var qResult = await SaveChangesAsync();
@@ -304,7 +338,8 @@ namespace xDataService.EFRepositories {
if (
isSucceed &&
!baseRepositoryEvents.IsNull()
) {
)
{
baseRepositoryEvents
.RemoveManyEvent(new XBaseEventModel<IEnumerable<T>>(null));
}
@@ -313,7 +348,8 @@ namespace xDataService.EFRepositories {
//
#region Retrieve ...
public IQueryable<T> AsQueryable () {
public IQueryable<T> AsQueryable()
{
return dbSet.AsQueryable();
}
@@ -321,7 +357,8 @@ namespace xDataService.EFRepositories {
TKey id,
bool ignoreSoftDeleteds = true,
bool containsDetail = false
) {
)
{
//
var result = await FindOneAsync(i =>
GetKey(i)
@@ -339,8 +376,10 @@ namespace xDataService.EFRepositories {
public async Task<IEnumerable<T>> GetAllAsync(
bool ignoreSoftDeleteds = true,
bool containsDetail = false
) {
return await Task.Run (() => {
)
{
return await Task.Run(() =>
{
//
var result = GetDbSet(
containsDetail: containsDetail
@@ -348,7 +387,8 @@ namespace xDataService.EFRepositories {
//
// Handle Soft Deleted Items ...
if (ignoreSoftDeleteds && configuration.EnableSoftDelete) {
if (ignoreSoftDeleteds && configuration.EnableSoftDelete)
{
result = result.Where(x => x.Deleted == false);
}
@@ -361,7 +401,8 @@ namespace xDataService.EFRepositories {
Expression<Func<T, bool>> whereClause,
bool ignoreSoftDeleteds = true,
bool containsDetail = false
) {
)
{
//
// Generate Where Function ...
var whereFunc = whereClause.Compile();
@@ -369,7 +410,8 @@ namespace xDataService.EFRepositories {
//
// Handle Soft Deleted Items ...
Func<T, bool> ignoreSoftDeletedsWhereFunc = null;
if (ignoreSoftDeleteds && configuration.EnableSoftDelete) {
if (ignoreSoftDeleteds && configuration.EnableSoftDelete)
{
//
Expression<Func<T, bool>> ignoreSoftDeletedsWhereClause = x => x.Deleted == false;
ignoreSoftDeletedsWhereFunc = ignoreSoftDeletedsWhereClause.Compile();
@@ -385,13 +427,15 @@ namespace xDataService.EFRepositories {
//
T result = null;
await
foreach (var entity in enumerator) {
foreach (var entity in enumerator)
{
//
var isApproved = whereFunc(entity) &&
(ignoreSoftDeletedsWhereFunc.IsNull() ?
true :
ignoreSoftDeletedsWhereFunc(entity));
if (isApproved) {
if (isApproved)
{
//
result = entity;
break;
@@ -406,7 +450,8 @@ namespace xDataService.EFRepositories {
Expression<Func<T, bool>> whereClause,
bool ignoreSoftDeleteds = true,
bool containsDetail = false
) {
)
{
//
// Generate Where Function ...
var whereFunc = whereClause.Compile();
@@ -414,7 +459,8 @@ namespace xDataService.EFRepositories {
//
// Handle Soft Deleted Items ...
Func<T, bool> ignoreSoftDeletedsWhereFunc = null;
if (ignoreSoftDeleteds && configuration.EnableSoftDelete) {
if (ignoreSoftDeleteds && configuration.EnableSoftDelete)
{
//
Expression<Func<T, bool>> ignoreSoftDeletedsWhereClause = x => x.Deleted == false;
ignoreSoftDeletedsWhereFunc = ignoreSoftDeletedsWhereClause.Compile();
@@ -430,13 +476,15 @@ namespace xDataService.EFRepositories {
//
var result = new List<T>();
await
foreach (var entity in enumerator) {
foreach (var entity in enumerator)
{
//
var isApproved = whereFunc(entity) &&
(ignoreSoftDeletedsWhereFunc.IsNull() ?
true :
ignoreSoftDeletedsWhereFunc(entity));
if (isApproved) {
if (isApproved)
{
result.Add(entity);
}
}
@@ -448,29 +496,24 @@ namespace xDataService.EFRepositories {
public async Task<XQueryResult<T>> QueryAsync(
XQuery query,
bool ignoreSoftDeleteds = true
) {
)
{
//
if (query.PageSize < configuration
.PagingConfiguration
.MinAvailablePageSize) {
query.PageSize = configuration
.PagingConfiguration
.DefaultPageSize;
// Validate ...
if (query.IsNull())
{
XException.InvalidArgs.Throw();
}
//
if (query.PageSize > configuration
.PagingConfiguration
.MaxAvailablePageSize) {
query.PageSize = configuration
.PagingConfiguration
.MaxAvailablePageSize;
}
// Normalize ...
query = query.NormalizeQuery(configuration);
//
// Handle Soft Deleted Items ...
Func<T, bool> ignoreSoftDeletedsWhereFunc = null;
if (ignoreSoftDeleteds && configuration.EnableSoftDelete) {
if (ignoreSoftDeleteds && configuration.EnableSoftDelete)
{
//
Expression<Func<T, bool>> ignoreSoftDeletedsWhereClause = x => x.Deleted == false;
ignoreSoftDeletedsWhereFunc = ignoreSoftDeletedsWhereClause.Compile();
@@ -484,107 +527,111 @@ namespace xDataService.EFRepositories {
.AsAsyncEnumerable();
//
var resultItems = new List<T> ();
var totalEntities = new List<T>();
await
foreach (var entity in enumerator) {
foreach (var entity in enumerator)
{
//
var isApproved = (ignoreSoftDeletedsWhereFunc.IsNull() ?
true :
ignoreSoftDeletedsWhereFunc(entity));
if (isApproved) {
resultItems.Add (entity);
if (isApproved)
{
totalEntities.Add(entity);
}
}
//
var result = resultItems.AsEnumerable ();
//
// Count Total Items ...
var totalItemsCount = result.Count ();
var items = totalEntities.AsEnumerable();
var totalItemsCount = items.Count();
//
// Apply Filter ...
if (!query.Filter.IsNullOrEmpty ()) {
result = await result
.ApplyFilterAsync<T, TKey> (query.Filter);
if (!query.Filter.IsNullOrEmpty())
{
//
items = items
.ApplyFilter(query.Filter);
}
int filteredItemsCount = items.Count();
//
// Count Total Items ...
int totalFilteredItemsCount = result.Count ();
// Count Pages ...
var totalPagesCount = query.CountPages(totalItemsCount);
var filteredPagesCount = query.CountPages(filteredItemsCount);
//
// Apply Paging and Sorting ...
if (totalItemsCount > 0 &&
filteredItemsCount > 0)
{
//
// Apply Sorting ...
items = items
.ToList()
.ApplySorting(
query.SortBy,
query.IsAscending
);
//
// Apply Paging ...
result = result
items = items
.ToList()
.ApplyPaging(
query.Page,
query.PageSize);
//
// Apply Sorting ...
if (!query.SortBy.IsNullOrEmpty ()) {
result = result
.ApplySorting<T, TKey> (
query.SortBy,
query.IsAscending);
query.PageSize
);
}
//
// Generate Result Object ...
// Query = query,
var queryResult = new XQueryResult<T> {
Items = result.AsEnumerable (),
// Prepare Result ...
var result = new XQueryResult<T>
{
Page = query.Page,
Items = items.ToList(),
PageSize = query.PageSize,
TotalPages = totalPagesCount,
TotalItems = totalItemsCount,
TotalPages = await PagesCountAsync (
query.PageSize,
totalFilteredItemsCount
),
TotalFilteredItems = totalFilteredItemsCount
TotalFilteredPages = filteredPagesCount,
TotalFilteredItems = filteredItemsCount
};
//
return queryResult;
return result;
}
public async Task<XQueryResult<T>> ConditionalQueryAsync(
Expression<Func<T, bool>> condition,
XQuery query,
bool ignoreSoftDeleteds = true
) {
)
{
//
if (query.PageSize < configuration
.PagingConfiguration
.MinAvailablePageSize) {
query.PageSize = configuration
.PagingConfiguration
.DefaultPageSize;
// Validate ...
if (query.IsNull() || condition.IsNull())
{
XException.InvalidArgs.Throw();
}
//
if (query.PageSize > configuration
.PagingConfiguration
.MaxAvailablePageSize) {
query.PageSize = configuration
.PagingConfiguration
.MaxAvailablePageSize;
}
//
// Generate Where Function ...
var whereFunc = condition.Compile ();
// Normalize ...
query = query.NormalizeQuery(configuration);
//
// Handle Soft Deleted Items ...
Func<T, bool> ignoreSoftDeletedsWhereFunc = null;
if (ignoreSoftDeleteds && configuration.EnableSoftDelete) {
if (ignoreSoftDeleteds && configuration.EnableSoftDelete)
{
//
Expression<Func<T, bool>> ignoreSoftDeletedsWhereClause = x => x.Deleted == false;
ignoreSoftDeletedsWhereFunc = ignoreSoftDeletedsWhereClause.Compile();
}
//
// Compile Condition ...
Func<T, bool> conditionFunc = condition.Compile();
//
// Get Enumerable ...
var enumerator = GetDbSet(
@@ -593,73 +640,79 @@ namespace xDataService.EFRepositories {
.AsAsyncEnumerable();
//
var resultItems = new List<T> ();
var totalEntities = new List<T>();
await
foreach (var entity in enumerator) {
foreach (var entity in enumerator)
{
//
var isApproved = whereFunc (entity) &&
(ignoreSoftDeletedsWhereFunc.IsNull () ?
var isApproved = (ignoreSoftDeletedsWhereFunc.IsNull() ?
true :
ignoreSoftDeletedsWhereFunc (entity));
if (isApproved) {
resultItems.Add (entity);
ignoreSoftDeletedsWhereFunc(entity)) &&
conditionFunc(entity);
if (isApproved)
{
totalEntities.Add(entity);
}
}
//
var result = resultItems.AsQueryable ();
//
// Count Total Items ...
var totalItemsCount = result.Count ();
var items = totalEntities.AsEnumerable();
var totalItemsCount = items.Count();
//
// Apply Filter ...
if (totalItemsCount > 0 &&
!query.Filter.IsNullOrEmpty ()) {
result = result
.ApplyFilter<T, TKey> (query.Filter);
if (!query.Filter.IsNullOrEmpty())
{
//
items = items
.ApplyFilter(query.Filter);
}
int filteredItemsCount = items.Count();
//
// Count Total Items ...
var totalFilteredItemsCount = result.Count ();
// Count Pages ...
var totalPagesCount = query.CountPages(totalItemsCount);
var filteredPagesCount = query.CountPages(filteredItemsCount);
//
// Apply Paging and Sorting ...
if (totalItemsCount > 0 &&
filteredItemsCount > 0)
{
//
// Apply Sorting ...
items = items
.ToList()
.ApplySorting(
query.SortBy,
query.IsAscending
);
//
// Apply Paging ...
if (totalItemsCount > 0 &&
totalFilteredItemsCount > 0) {
result = result
items = items
.ToList()
.ApplyPaging(
query.Page,
query.PageSize);
//
// Apply Sorting ...
if (!query.SortBy.IsNullOrEmpty ()) {
result = result
.ApplySorting<T, TKey> (
query.SortBy,
query.IsAscending);
}
query.PageSize
);
}
//
// Generate Result Object ...
var queryResult = new XQueryResult<T> {
Items = result.AsEnumerable (),
// Prepare Result ...
var result = new XQueryResult<T>
{
Page = query.Page,
Items = items.ToList(),
PageSize = query.PageSize,
TotalPages = totalPagesCount,
TotalItems = totalItemsCount,
TotalPages = await PagesCountAsync (
query.PageSize,
totalFilteredItemsCount
),
TotalFilteredItems = totalFilteredItemsCount
TotalFilteredPages = filteredPagesCount,
TotalFilteredItems = filteredItemsCount
};
//
return queryResult;
return result;
}
//
@@ -787,7 +840,8 @@ namespace xDataService.EFRepositories {
TKey id,
T item,
bool saveChanges = true
) {
)
{
//
// Get Exists Entity ...
var existsEntity = await GetAsync(
@@ -805,7 +859,8 @@ namespace xDataService.EFRepositories {
//
// Check action is Succeeded or not ...
var isSucceed = false;
if (saveChanges) {
if (saveChanges)
{
//
// Get Modified Count ...
var qResult = await SaveChangesAsync();
@@ -820,7 +875,8 @@ namespace xDataService.EFRepositories {
if (
isSucceed &&
!baseRepositoryEvents.IsNull()
) {
)
{
baseRepositoryEvents
.UpdateEvent(new XBaseEventModel<T>(entry.Entity));
}
@@ -835,11 +891,13 @@ namespace xDataService.EFRepositories {
public async Task<bool> UpdateRangeAsync(
IEnumerable<T> items,
bool saveChanges = true
) {
)
{
//
items
.ToList()
.ForEach (i => {
.ForEach(i =>
{
var entry = dbSet.Attach(i);
entry.State = EntityState.Modified;
});
@@ -847,7 +905,8 @@ namespace xDataService.EFRepositories {
//
// Check action is Succeeded or not ...
var isSucceed = false;
if (saveChanges) {
if (saveChanges)
{
//
// Get Modified Count ...
var qResult = await SaveChangesAsync();
@@ -862,7 +921,8 @@ namespace xDataService.EFRepositories {
if (
isSucceed &&
!baseRepositoryEvents.IsNull()
) {
)
{
baseRepositoryEvents
.UpdateManyEvent(new XBaseEventModel<IEnumerable<T>>(null));
}
@@ -875,14 +935,18 @@ namespace xDataService.EFRepositories {
//
#region Count ...
public async Task<int> CountAsync (bool ignoreSoftDeleteds = true) {
public async Task<int> CountAsync(bool ignoreSoftDeleteds = true)
{
//
var dbSet = GetDbSet();
//
if (ignoreSoftDeleteds && configuration.EnableSoftDelete) {
if (ignoreSoftDeleteds && configuration.EnableSoftDelete)
{
return await dbSet.CountAsync(i => i.Deleted == false);
} else {
}
else
{
return await dbSet.CountAsync();
}
}
@@ -890,13 +954,15 @@ namespace xDataService.EFRepositories {
public async Task<int> PagesCountAsync(
int pageSize,
int? totalItems = null
) {
)
{
//
int count = totalItems.HasValue ? totalItems.Value : await CountAsync();
int pagesCount = count / pageSize;
//
if (count % pageSize > 0) {
if (count % pageSize > 0)
{
pagesCount++;
}
@@ -910,7 +976,8 @@ namespace xDataService.EFRepositories {
public async Task<bool> IsExistsAsync(
TKey id,
bool ignoreSoftDeleteds = true
) {
)
{
//
var result = await FindOneAsync(i =>
GetKey(i)
@@ -930,7 +997,8 @@ namespace xDataService.EFRepositories {
//
#region Unit Of Work ...
public async Task<int> SaveChangesAsync () {
public async Task<int> SaveChangesAsync()
{
return await unitOfWorks.SaveChangesAsync();
}
#endregion
@@ -940,11 +1008,13 @@ namespace xDataService.EFRepositories {
public void SetKey(
ref T item,
TKey id
) {
)
{
//
var props = item.GetType().GetProperties();
var keyProp = props.FirstOrDefault(p => p.Name == "Id");
if (keyProp.IsNull ()) {
if (keyProp.IsNull())
{
return;
}
@@ -954,27 +1024,33 @@ namespace xDataService.EFRepositories {
keyProp.SetValue(item, safeValue, null);
}
public TKey GetKey (T item) {
public TKey GetKey(T item)
{
//
var props = item.GetType().GetProperties();
var keyProp = props.FirstOrDefault(p => p.Name == "Id");
//
var keyString = string.Empty;
if (keyProp.IsNull ()) {
if (keyProp.IsNull())
{
keyString = string.Empty;
} else {
}
else
{
keyString = keyProp.GetValue(item).ToString();
}
//
if (keyString.IsNullOrEmpty ()) {
if (keyString.IsNullOrEmpty())
{
return default(TKey);
}
//
// Prevent Deserializing issues throug JsonReader ...
if (keyString.IsGuid () && typeof (TKey) == typeof (Guid)) {
if (keyString.IsGuid() && typeof(TKey) == typeof(Guid))
{
return item.Id;
}
@@ -982,7 +1058,8 @@ namespace xDataService.EFRepositories {
return keyString.FromJSON<TKey>();
}
public async Task<T> HandleKeyAsync (T item) {
public async Task<T> HandleKeyAsync(T item)
{
//
var keyType = typeof(TKey);
@@ -995,7 +1072,8 @@ namespace xDataService.EFRepositories {
keyType == typeof(string)
) &&
keyGenerator.IsEmpty(item.Id)
) {
)
{
//
var newKey = await keyGenerator.GenerateKey(this);
@@ -1010,9 +1088,11 @@ namespace xDataService.EFRepositories {
//
#region Detach ...
public void Detach (T item) {
public void Detach(T item)
{
//
if (item.IsNull ()) {
if (item.IsNull())
{
return;
}
@@ -1020,23 +1100,28 @@ namespace xDataService.EFRepositories {
Entry(item).State = EntityState.Detached;
}
public void Detach (IEnumerable<T> items) {
public void Detach(IEnumerable<T> items)
{
//
if (items.IsNull () || !items.HasChild ()) {
if (items.IsNull() || !items.HasChild())
{
return;
}
//
items
.ToList()
.ForEach (item => {
.ForEach(item =>
{
Detach(item);
});
}
public void Detach (XQueryResult<T> query) {
public void Detach(XQueryResult<T> query)
{
//
if (query.IsNull () || query.Items.HasChild ()) {
if (query.IsNull() || query.Items.HasChild())
{
return;
}
@@ -1044,9 +1129,11 @@ namespace xDataService.EFRepositories {
Detach(query.Items);
}
public void Detach (XPageResponse<T> page) {
public void Detach(XPageResponse<T> page)
{
//
if (page.IsNull () || !page.Nodes.HasChild ()) {
if (page.IsNull() || !page.Nodes.HasChild())
{
return;
}
@@ -1057,11 +1144,13 @@ namespace xDataService.EFRepositories {
//
#region Others ...
public void Dispose () {
public void Dispose()
{
unitOfWorks.Dispose();
}
public string GetPropValues (T item) {
public string GetPropValues(T item)
{
//
var props = item.GetType().GetProperties();
var vals = props.Select(p => p.GetValue(p.Name));
@@ -1070,18 +1159,23 @@ namespace xDataService.EFRepositories {
return vals.ToJSON();
}
public EntityEntry<T> Entry (T item) {
public EntityEntry<T> Entry(T item)
{
return unitOfWorks.DbContext.Entry(item);
}
public IQueryable<T> GetDbSet(
bool containsDetail = false
) {
)
{
//
IQueryable<T> result = null;
if (!containsDetail) {
if (!containsDetail)
{
result = dbSet;
} else {
}
else
{
result = GetFullDbSet();
}