refactor renew ...
This commit is contained in:
@@ -51,12 +51,14 @@ namespace xPushService.Interfaces
|
|||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
/// <param name="saveChanges"></param>
|
/// <param name="saveChanges"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<TDto> UpdateAsync(
|
Task<TDto> UpdateAsync(
|
||||||
TKey id,
|
TKey id,
|
||||||
TDto item,
|
TDto item,
|
||||||
bool saveChanges = true,
|
bool saveChanges = true,
|
||||||
|
string connectionId = null,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -66,12 +68,14 @@ namespace xPushService.Interfaces
|
|||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <param name="softDelete"></param>
|
/// <param name="softDelete"></param>
|
||||||
/// <param name="saveChanges"></param>
|
/// <param name="saveChanges"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<TDto> RemoveAsync(
|
Task<TDto> RemoveAsync(
|
||||||
TKey id,
|
TKey id,
|
||||||
bool softDelete = true,
|
bool softDelete = true,
|
||||||
bool saveChanges = true,
|
bool saveChanges = true,
|
||||||
|
string connectionId = null,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
+134
-79
@@ -32,8 +32,6 @@ namespace xPushService.Providers
|
|||||||
|
|
||||||
//
|
//
|
||||||
#region Actions ...
|
#region Actions ...
|
||||||
//
|
|
||||||
#region Add ...
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// add a new Dto ...
|
/// add a new Dto ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -50,7 +48,7 @@ namespace xPushService.Providers
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
TDto result = await RepositoryService.AddAsync(
|
var result = await RepositoryService.AddAsync(
|
||||||
item: item,
|
item: item,
|
||||||
saveChanges: saveChanges,
|
saveChanges: saveChanges,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
@@ -71,87 +69,86 @@ namespace xPushService.Providers
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
#region Update ...
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update an Dto values ...
|
/// Update an Dto values ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
/// <param name="saveChanges"></param>
|
/// <param name="saveChanges"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<TDto> UpdateAsync(
|
public async Task<TDto> UpdateAsync(
|
||||||
TKey id,
|
TKey id,
|
||||||
TDto item,
|
TDto item,
|
||||||
bool saveChanges = true,
|
bool saveChanges = true,
|
||||||
|
string connectionId = null,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = await RepositoryService.UpdateAsync(
|
||||||
|
id: id,
|
||||||
|
item: item,
|
||||||
|
saveChanges: saveChanges,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Update a range of Dtos ...
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="items"></param>
|
|
||||||
/// <param name="saveChanges"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<bool> UpdateRangeAsync(
|
|
||||||
IEnumerable<TDto> items,
|
|
||||||
bool saveChanges = true,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
);
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
//
|
//
|
||||||
#region Remove ...
|
if (!result.IsNullOrDefault())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
await SendPush(
|
||||||
|
action: XBaseEntityHubAction.Update.GetStringValue(),
|
||||||
|
payLoad: result.ToJSON(camelCase: true),
|
||||||
|
connectionId: connectionId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// remove an Dto by it's Id ...
|
/// remove an Dto by it's Id ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <param name="softDelete"></param>
|
/// <param name="softDelete"></param>
|
||||||
/// <param name="saveChanges"></param>
|
/// <param name="saveChanges"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<TDto> RemoveAsync(
|
public async Task<TDto> RemoveAsync(
|
||||||
TKey id,
|
TKey id,
|
||||||
bool softDelete = true,
|
bool softDelete = true,
|
||||||
bool saveChanges = true,
|
bool saveChanges = true,
|
||||||
|
string connectionId = null,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = await RepositoryService.RemoveAsync(
|
||||||
|
id: id,
|
||||||
|
softDelete: softDelete,
|
||||||
|
saveChanges: saveChanges,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// remove an Dto ...
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item"></param>
|
|
||||||
/// <param name="softDelete"></param>
|
|
||||||
/// <param name="saveChanges"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<TDto> RemoveAsync(
|
|
||||||
TDto item,
|
|
||||||
bool softDelete = true,
|
|
||||||
bool saveChanges = true,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// remove a range of exists Dtos ...
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="items"></param>
|
|
||||||
/// <param name="softDelete"></param>
|
|
||||||
/// <param name="saveChanges"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task RemoveRangeAsync(
|
|
||||||
IEnumerable<TDto> items,
|
|
||||||
bool softDelete = true,
|
|
||||||
bool saveChanges = true,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
);
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
//
|
//
|
||||||
#region Count ...
|
if (!result.IsNullOrDefault())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
await SendPush(
|
||||||
|
action: XBaseEntityHubAction.Update.GetStringValue(),
|
||||||
|
payLoad: result.ToJSON(camelCase: true),
|
||||||
|
connectionId: connectionId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// count all exists Dtos ...
|
/// count all exists Dtos ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -161,26 +158,42 @@ namespace xPushService.Providers
|
|||||||
public async Task<int> CountAsync(
|
public async Task<int> CountAsync(
|
||||||
bool ignoreSoftDeleteds = true,
|
bool ignoreSoftDeleteds = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = await RepositoryService.CountAsync(
|
||||||
|
cancellationToken: cancellationToken,
|
||||||
|
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// count all exists Entities Pages by providing page size ...
|
/// Check a Dto exists or not ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pageSize"></param>
|
/// <param name="id"></param>
|
||||||
/// <param name="totalItems"></param>
|
|
||||||
/// <param name="ignoreSoftDeleteds"></param>
|
/// <param name="ignoreSoftDeleteds"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<int> PagesCountAsync(
|
public async Task<bool> IsExistsAsync(
|
||||||
int pageSize,
|
TKey id,
|
||||||
int? totalItems = null,
|
|
||||||
bool ignoreSoftDeleteds = true,
|
bool ignoreSoftDeleteds = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = await RepositoryService.IsExistsAsync(
|
||||||
|
id: id,
|
||||||
|
cancellationToken: cancellationToken,
|
||||||
|
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||||
);
|
);
|
||||||
#endregion
|
|
||||||
|
|
||||||
//
|
//
|
||||||
#region Retrieve ...
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// retrieve an Dto by it's Id ...
|
/// retrieve an Dto by it's Id ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -194,8 +207,20 @@ namespace xPushService.Providers
|
|||||||
bool ignoreSoftDeleteds = true,
|
bool ignoreSoftDeleteds = true,
|
||||||
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> includeBuilder = null,
|
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> includeBuilder = null,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = await RepositoryService.GetAsync(
|
||||||
|
id: id,
|
||||||
|
includeBuilder: includeBuilder,
|
||||||
|
cancellationToken: cancellationToken,
|
||||||
|
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// retrieve all exists Dtos ...
|
/// retrieve all exists Dtos ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -209,8 +234,20 @@ namespace xPushService.Providers
|
|||||||
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBuilder = null,
|
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBuilder = null,
|
||||||
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> includeBuilder = null,
|
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> includeBuilder = null,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = await RepositoryService.GetAllAsync(
|
||||||
|
orderBuilder: orderBuilder,
|
||||||
|
includeBuilder: includeBuilder,
|
||||||
|
cancellationToken: cancellationToken,
|
||||||
|
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// find an Dto by providing a Conditional Expression ...
|
/// find an Dto by providing a Conditional Expression ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -224,8 +261,20 @@ namespace xPushService.Providers
|
|||||||
bool ignoreSoftDeleteds = true,
|
bool ignoreSoftDeleteds = true,
|
||||||
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> includeBuilder = null,
|
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> includeBuilder = null,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = await RepositoryService.FindOneAsync(
|
||||||
|
predicate: predicate,
|
||||||
|
includeBuilder: includeBuilder,
|
||||||
|
cancellationToken: cancellationToken,
|
||||||
|
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// find a collection of Dtos by proving a Conditional Expression ...
|
/// find a collection of Dtos by proving a Conditional Expression ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -241,8 +290,21 @@ namespace xPushService.Providers
|
|||||||
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBuilder = null,
|
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBuilder = null,
|
||||||
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> includeBuilder = null,
|
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> includeBuilder = null,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = await RepositoryService.FindManyAsync(
|
||||||
|
predicate: predicate,
|
||||||
|
orderBuilder: orderBuilder,
|
||||||
|
includeBuilder: includeBuilder,
|
||||||
|
cancellationToken: cancellationToken,
|
||||||
|
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// retrieve Dtos based on XQuery Pagination structure ...
|
/// retrieve Dtos based on XQuery Pagination structure ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -260,24 +322,21 @@ namespace xPushService.Providers
|
|||||||
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBuilder = null,
|
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBuilder = null,
|
||||||
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> includeBuilder = null,
|
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> includeBuilder = null,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = await RepositoryService.QueryAsync(
|
||||||
|
query: query,
|
||||||
|
predicate: predicate,
|
||||||
|
orderBuilder: orderBuilder,
|
||||||
|
includeBuilder: includeBuilder,
|
||||||
|
cancellationToken: cancellationToken,
|
||||||
|
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||||
);
|
);
|
||||||
#endregion
|
|
||||||
|
|
||||||
//
|
//
|
||||||
#region Exists ...
|
return result;
|
||||||
/// <summary>
|
}
|
||||||
/// Check a Dto exists or not ...
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id"></param>
|
|
||||||
/// <param name="ignoreSoftDeleteds"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<bool> IsExistsAsync(
|
|
||||||
TKey id,
|
|
||||||
bool ignoreSoftDeleteds = true,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
);
|
|
||||||
#endregion
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -342,8 +401,4 @@ namespace xPushService.Providers
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class XTagDto
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user