|
@@ -1,6 +1,6 @@
|
|
-using System;
|
|
|
|
|
|
+using Microsoft.EntityFrameworkCore;
|
|
|
|
+using System;
|
|
using System.Linq;
|
|
using System.Linq;
|
|
-using Microsoft.EntityFrameworkCore;
|
|
|
|
using Unity;
|
|
using Unity;
|
|
using VCommon.Ioc;
|
|
using VCommon.Ioc;
|
|
using VCommon.VEntity;
|
|
using VCommon.VEntity;
|
|
@@ -10,15 +10,12 @@ namespace VCommon.VApplication.EntityFrameworkCore
|
|
{
|
|
{
|
|
public abstract class VAppDbContextBase : VEfDbContextBase, ITransientIocClass
|
|
public abstract class VAppDbContextBase : VEfDbContextBase, ITransientIocClass
|
|
{
|
|
{
|
|
-
|
|
|
|
protected VAppDbContextBase()
|
|
protected VAppDbContextBase()
|
|
{
|
|
{
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
protected VAppDbContextBase(DbContextOptions options) : base(options)
|
|
protected VAppDbContextBase(DbContextOptions options) : base(options)
|
|
{
|
|
{
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
[Dependency]
|
|
[Dependency]
|
|
@@ -34,14 +31,6 @@ namespace VCommon.VApplication.EntityFrameworkCore
|
|
if (track.Entity is IHaveLastModificationUserId lmu) lmu.LastModificationUserId = VSession.UserId;
|
|
if (track.Entity is IHaveLastModificationUserId lmu) lmu.LastModificationUserId = VSession.UserId;
|
|
}
|
|
}
|
|
|
|
|
|
- if (VSession.TenantId.HasValue)
|
|
|
|
- {
|
|
|
|
- foreach (var track in ChangeTracker.Entries<IMustHaveTenant>().Where(p => p.State == EntityState.Added))
|
|
|
|
- {
|
|
|
|
- track.Entity.TenantId = VSession.TenantId.Value;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
return base.SaveChanges();
|
|
return base.SaveChanges();
|
|
}
|
|
}
|
|
}
|
|
}
|