Browse Source

修改数据表修改者等字段

bjmzak
wxd 2 years ago
parent
commit
1ee10c8431
  1. 40
      src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs
  2. 9
      src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisEntityTypeBuilder.cs
  3. 12876
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20231012072227_creator.Designer.cs
  4. 6504
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20231012072227_creator.cs
  5. 360
      src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs

40
src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs

@ -1,5 +1,8 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Shentun.Peis.Books;
using Shentun.Peis.DbMapping;
@ -629,4 +632,41 @@ public class PeisDbContext :
}
#endregion
//public override int SaveChanges()
//{
// CheckDisposed();
// this.SavingChanges?.Invoke(this, new SavingChangesEventArgs(acceptAllChangesOnSuccess));
// InterceptionResult<int> interceptionResult = DbContextDependencies.UpdateLogger.SaveChangesStarting(this);
// TryDetectChanges();
// try
// {
// int entitiesSavedCount = (interceptionResult.HasResult ? interceptionResult.Result : DbContextDependencies.StateManager.SaveChanges(acceptAllChangesOnSuccess));
// int num = DbContextDependencies.UpdateLogger.SaveChangesCompleted(this, entitiesSavedCount);
// this.SavedChanges?.Invoke(this, new SavedChangesEventArgs(acceptAllChangesOnSuccess, num));
// return num;
// }
// catch (DbUpdateConcurrencyException exception)
// {
// EntityFrameworkEventSource.Log.OptimisticConcurrencyFailure();
// DbContextDependencies.UpdateLogger.OptimisticConcurrencyException(this, exception);
// this.SaveChangesFailed?.Invoke(this, new SaveChangesFailedEventArgs(acceptAllChangesOnSuccess, exception));
// throw;
// }
// catch (Exception exception2)
// {
// DbContextDependencies.UpdateLogger.SaveChangesFailed(this, exception2);
// this.SaveChangesFailed?.Invoke(this, new SaveChangesFailedEventArgs(acceptAllChangesOnSuccess, exception2));
// throw;
// }
//}
protected override void ApplyAbpConceptsForAddedEntity(EntityEntry entry)
{
base.ApplyAbpConceptsForAddedEntity(entry);
SetModificationAuditProperties(entry);
}
//override ApplyAbpConceptsForAddedEntity
}

9
src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisEntityTypeBuilder.cs

@ -138,7 +138,8 @@ namespace Shentun.Peis.EntityFrameworkCore
{
if (b.Metadata.ClrType.IsAssignableTo<IMayHaveCreator>())
{
b.Property("CreatorId").IsRequired(required: false).HasColumnName("creator_id");
//b.Property("CreatorId").IsRequired(required: false).HasColumnName("creator_id");
b.Property("CreatorId").IsRequired().HasColumnName("creator_id");
}
}
@ -205,7 +206,8 @@ namespace Shentun.Peis.EntityFrameworkCore
{
if (b.Metadata.ClrType.IsAssignableTo<IHasModificationTime>())
{
b.Property("LastModificationTime").IsRequired(required: false).HasColumnName("last_modification_time");
//b.Property("LastModificationTime").IsRequired(required: false).HasColumnName("last_modification_time");
b.Property("LastModificationTime").IsRequired().HasColumnName("last_modification_time");
}
}
@ -219,7 +221,8 @@ namespace Shentun.Peis.EntityFrameworkCore
if (b.Metadata.ClrType.IsAssignableTo<IModificationAuditedObject>())
{
b.TryConfigureLastModificationTime();
b.Property("LastModifierId").IsRequired(required: false).HasColumnName("last_modifier_id");
//b.Property("LastModifierId").IsRequired(required: false).HasColumnName("last_modifier_id");
b.Property("LastModifierId").IsRequired().HasColumnName("last_modifier_id");
}
}

12876
src/Shentun.Peis.EntityFrameworkCore/Migrations/20231012072227_creator.Designer.cs
File diff suppressed because it is too large
View File

6504
src/Shentun.Peis.EntityFrameworkCore/Migrations/20231012072227_creator.cs
File diff suppressed because it is too large
View File

360
src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs
File diff suppressed because it is too large
View File

Loading…
Cancel
Save