remove IHasExtraProperties restrictions

pull/8898/head
liangshiwei 5 years ago
parent 1dc515294c
commit e8b9ee6b90

@ -31,13 +31,11 @@ using Volo.Abp.Uow;
namespace Volo.Abp.EntityFrameworkCore
{
public abstract class AbpDbContext<TDbContext> : DbContext, IAbpEfCoreDbContext, ITransientDependency, IHasExtraProperties
public abstract class AbpDbContext<TDbContext> : DbContext, IAbpEfCoreDbContext, ITransientDependency
where TDbContext : DbContext
{
public IAbpLazyServiceProvider LazyServiceProvider { get; set; }
public ExtraPropertyDictionary ExtraProperties { get; }
protected virtual Guid? CurrentTenantId => CurrentTenant?.Id;
protected virtual bool IsMultiTenantFilterEnabled => DataFilter?.IsEnabled<IMultiTenant>() ?? false;
@ -88,7 +86,6 @@ namespace Volo.Abp.EntityFrameworkCore
protected AbpDbContext(DbContextOptions<TDbContext> options)
: base(options)
{
ExtraProperties = new ExtraPropertyDictionary();
}
protected override void OnModelCreating(ModelBuilder modelBuilder)

@ -12,7 +12,7 @@ namespace Volo.Abp.ObjectExtending
public static ObjectExtensionManager MapEfCoreDbContext<TDbContext>(
[NotNull] this ObjectExtensionManager objectExtensionManager,
[NotNull] Action<ModelBuilder> modelBuilderAction)
where TDbContext: DbContext , IHasExtraProperties
where TDbContext : DbContext
{
return objectExtensionManager.AddOrUpdate(
typeof(TDbContext),
@ -25,7 +25,7 @@ namespace Volo.Abp.ObjectExtending
public static ObjectExtensionManager MapEfCoreEntity<TEntity>(
[NotNull] this ObjectExtensionManager objectExtensionManager,
[NotNull] Action<EntityTypeBuilder> entityTypeBuildAction)
where TEntity : IHasExtraProperties, IEntity
where TEntity : IEntity
{
return MapEfCoreEntity(
objectExtensionManager,

@ -23,7 +23,7 @@ namespace Volo.Abp.ObjectExtending
public ObjectExtensionInfo([NotNull] Type type)
{
Type = Check.AssignableTo<IHasExtraProperties>(type, nameof(type));
Type = type;
Properties = new ConcurrentDictionary<string, ObjectExtensionPropertyInfo>();
Configuration = new ConcurrentDictionary<object, object>();
Validators = new List<Action<ObjectExtensionValidationContext>>();

@ -25,7 +25,6 @@ namespace Volo.Abp.ObjectExtending
[NotNull]
public virtual ObjectExtensionManager AddOrUpdate<TObject>(
[CanBeNull] Action<ObjectExtensionInfo> configureAction = null)
where TObject : IHasExtraProperties
{
return AddOrUpdate(typeof(TObject), configureAction);
}
@ -50,8 +49,6 @@ namespace Volo.Abp.ObjectExtending
[NotNull] Type type,
[CanBeNull] Action<ObjectExtensionInfo> configureAction = null)
{
Check.AssignableTo<IHasExtraProperties>(type, nameof(type));
var extensionInfo = ObjectsExtensions.GetOrAdd(
type,
_ => new ObjectExtensionInfo(type)
@ -64,7 +61,6 @@ namespace Volo.Abp.ObjectExtending
[CanBeNull]
public virtual ObjectExtensionInfo GetOrNull<TObject>()
where TObject : IHasExtraProperties
{
return GetOrNull(typeof(TObject));
}
@ -72,8 +68,6 @@ namespace Volo.Abp.ObjectExtending
[CanBeNull]
public virtual ObjectExtensionInfo GetOrNull([NotNull] Type type)
{
Check.AssignableTo<IHasExtraProperties>(type, nameof(type));
return ObjectsExtensions.GetOrDefault(type);
}

Loading…
Cancel
Save