forked from ddrilling/AsbCloudServer
Merge branch 'master' into feature/#37076024-well-operation-service
This commit is contained in:
commit
7bd69c4dcb
@ -35,7 +35,7 @@ public class ContactDto : IId
|
||||
/// <summary>
|
||||
/// Email
|
||||
/// </summary>
|
||||
[RegularExpression(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$", ErrorMessage = "Некорректный email")]
|
||||
[RegularExpression(@"^[a-zA-Z0-9_\-\.]{3,128}@[a-zA-Z0-9_\-\.]{2,128}\.[a-zA-Z]{1,32}$", ErrorMessage = "Некорректный email")]
|
||||
public string? Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -117,6 +117,22 @@ public abstract class ChangeLogRepositoryAbstract<TEntity, TDto, TRequest> : ICh
|
||||
}
|
||||
|
||||
public async Task<int> InsertRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token)
|
||||
{
|
||||
using var transaction = db.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var result = await InsertRangeWithoutTransaction(idUser, dtos, token);
|
||||
await transaction.CommitAsync(token);
|
||||
return result;
|
||||
}
|
||||
catch
|
||||
{
|
||||
await transaction.RollbackAsync(token);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<int> InsertRangeWithoutTransaction(int idUser, IEnumerable<TDto> dtos, CancellationToken token)
|
||||
{
|
||||
var result = 0;
|
||||
if (dtos.Any())
|
||||
@ -138,7 +154,8 @@ public abstract class ChangeLogRepositoryAbstract<TEntity, TDto, TRequest> : ICh
|
||||
|
||||
result += await SaveChangesWithExceptionHandling(token);
|
||||
}
|
||||
return result;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<int> UpdateRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token)
|
||||
@ -248,7 +265,7 @@ public abstract class ChangeLogRepositoryAbstract<TEntity, TDto, TRequest> : ICh
|
||||
try
|
||||
{
|
||||
result += await Clear(idUser, request, token);
|
||||
result += await InsertRange(idUser, dtos, token);
|
||||
result += await InsertRangeWithoutTransaction(idUser, dtos, token);
|
||||
|
||||
await transaction.CommitAsync(token);
|
||||
return result;
|
||||
|
Loading…
Reference in New Issue
Block a user