last ...
This commit is contained in:
@@ -11,7 +11,7 @@ namespace xDataService.Providers
|
||||
/// Default Guid Key Generator ...
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity"></typeparam>
|
||||
public class XGuidKeyGenerator<TEntity> : IXKeyGenerator<TEntity, Guid>
|
||||
public class XGuidKeyGenerator<TEntity> : XKeyGenerator<TEntity, Guid>, IXKeyGenerator<TEntity, Guid>
|
||||
where TEntity : XBaseEntity<Guid>
|
||||
{
|
||||
private readonly IXSequentialGuid sequentialGuid;
|
||||
@@ -23,7 +23,7 @@ namespace xDataService.Providers
|
||||
this.sequentialGuid = sequentialGuid;
|
||||
}
|
||||
|
||||
public async Task<Guid> GenerateKey(
|
||||
public override async Task<Guid> GenerateKey(
|
||||
IXBaseRepository<TEntity, Guid> repository,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
@@ -44,7 +44,7 @@ namespace xDataService.Providers
|
||||
}, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
public bool IsEmpty(Guid id)
|
||||
public override bool IsEmpty(Guid id)
|
||||
{
|
||||
//
|
||||
var result = id.IsNull() || id.IsDefaultGuid();
|
||||
|
||||
@@ -12,10 +12,10 @@ namespace xDataService.Providers
|
||||
/// Default Int Key Generator ...
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity"></typeparam>
|
||||
public class XIntKeyGenerator<TEntity> : IXKeyGenerator<TEntity, int>
|
||||
public class XIntKeyGenerator<TEntity> : XKeyGenerator<TEntity, int>, IXKeyGenerator<TEntity, int>
|
||||
where TEntity : XBaseEntity<int>
|
||||
{
|
||||
public async Task<int> GenerateKey(
|
||||
public override async Task<int> GenerateKey(
|
||||
IXBaseRepository<TEntity, int> repository,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
@@ -33,7 +33,7 @@ namespace xDataService.Providers
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool IsEmpty(int id)
|
||||
public override bool IsEmpty(int id)
|
||||
{
|
||||
//
|
||||
var result = id <= 0;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using xDataService.Interfaces;
|
||||
using xModels.Base;
|
||||
|
||||
namespace xDataService.Providers
|
||||
{
|
||||
public abstract class XKeyGenerator<TEntity, TKey> : IXKeyGenerator<TEntity, TKey>
|
||||
where TEntity : XBaseEntity<TKey>
|
||||
{
|
||||
public abstract Task<TKey> GenerateKey(
|
||||
IXBaseRepository<TEntity, TKey> repository,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
public abstract bool IsEmpty(TKey id);
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace xDataService.Providers
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity"></typeparam>
|
||||
|
||||
public class XStringKeyGenerator<TEntity> : IXKeyGenerator<TEntity, string>
|
||||
public class XStringKeyGenerator<TEntity> : XKeyGenerator<TEntity, string>, IXKeyGenerator<TEntity, string>
|
||||
where TEntity : XBaseEntity<string>
|
||||
{
|
||||
private readonly IXSequentialGuid sequentialGuid;
|
||||
@@ -22,7 +22,7 @@ namespace xDataService.Providers
|
||||
this.sequentialGuid = sequentialGuid;
|
||||
}
|
||||
|
||||
public async Task<string> GenerateKey(
|
||||
public override async Task<string> GenerateKey(
|
||||
IXBaseRepository<TEntity, string> repository,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
@@ -41,7 +41,7 @@ namespace xDataService.Providers
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsEmpty(string id)
|
||||
public override bool IsEmpty(string id)
|
||||
{
|
||||
return id.IsNullOrEmpty();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user