Browse Source

Db table prefix revision for the feature management module

pull/1904/head
Halil İbrahim Kalkan 7 years ago
parent
commit
3d357e46c0
  1. 11
      modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementConsts.cs
  2. 13
      modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementDbProperties.cs
  3. 12
      modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContext.cs
  4. 5
      modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContextModelCreatingExtensions.cs
  5. 4
      modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementModelBuilderConfigurationOptions.cs
  6. 2
      modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/IFeatureManagementDbContext.cs
  7. 9
      modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementMongoDbContext.cs
  8. 4
      modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementMongoDbContextExtensions.cs
  9. 4
      modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementMongoModelBuilderConfigurationOptions.cs
  10. 2
      modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/IFeatureManagementMongoDbContext.cs

11
modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementConsts.cs

@ -1,11 +0,0 @@
namespace Volo.Abp.FeatureManagement
{
public static class FeatureManagementConsts
{
public const string DefaultDbTablePrefix = "Abp";
public const string DefaultDbSchema = null;
public const string ConnectionStringName = "AbpFeatureManagement";
}
}

13
modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementDbProperties.cs

@ -0,0 +1,13 @@
using Volo.Abp.Data;
namespace Volo.Abp.FeatureManagement
{
public static class FeatureManagementDbProperties
{
public static string DbTablePrefix { get; } = AbpCommonDbProperties.DbTablePrefix;
public static string DbSchema { get; } = AbpCommonDbProperties.DbSchema;
public const string ConnectionStringName = "AbpFeatureManagement";
}
}

12
modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContext.cs

@ -4,13 +4,9 @@ using Volo.Abp.EntityFrameworkCore;
namespace Volo.Abp.FeatureManagement.EntityFrameworkCore
{
[ConnectionStringName(FeatureManagementConsts.ConnectionStringName)]
[ConnectionStringName(FeatureManagementDbProperties.ConnectionStringName)]
public class FeatureManagementDbContext : AbpDbContext<FeatureManagementDbContext>, IFeatureManagementDbContext
{
public static string TablePrefix { get; set; } = FeatureManagementConsts.DefaultDbTablePrefix;
public static string Schema { get; set; } = FeatureManagementConsts.DefaultDbSchema;
public DbSet<FeatureValue> FeatureValues { get; set; }
public FeatureManagementDbContext(DbContextOptions<FeatureManagementDbContext> options)
@ -23,11 +19,7 @@ namespace Volo.Abp.FeatureManagement.EntityFrameworkCore
{
base.OnModelCreating(builder);
builder.ConfigureFeatureManagement(options =>
{
options.TablePrefix = TablePrefix;
options.Schema = Schema;
});
builder.ConfigureFeatureManagement();
}
}
}

5
modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContextModelCreatingExtensions.cs

@ -11,7 +11,10 @@ namespace Volo.Abp.FeatureManagement.EntityFrameworkCore
{
Check.NotNull(builder, nameof(builder));
var options = new FeatureManagementModelBuilderConfigurationOptions();
var options = new FeatureManagementModelBuilderConfigurationOptions(
FeatureManagementDbProperties.DbTablePrefix,
FeatureManagementDbProperties.DbSchema
);
optionsAction?.Invoke(options);

4
modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementModelBuilderConfigurationOptions.cs

@ -6,8 +6,8 @@ namespace Volo.Abp.FeatureManagement.EntityFrameworkCore
public class FeatureManagementModelBuilderConfigurationOptions : ModelBuilderConfigurationOptions
{
public FeatureManagementModelBuilderConfigurationOptions(
[NotNull] string tablePrefix = FeatureManagementConsts.DefaultDbTablePrefix,
[CanBeNull] string schema = FeatureManagementConsts.DefaultDbSchema)
[NotNull] string tablePrefix = "",
[CanBeNull] string schema = null)
: base(
tablePrefix,
schema)

2
modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/IFeatureManagementDbContext.cs

@ -4,7 +4,7 @@ using Volo.Abp.EntityFrameworkCore;
namespace Volo.Abp.FeatureManagement.EntityFrameworkCore
{
[ConnectionStringName(FeatureManagementConsts.ConnectionStringName)]
[ConnectionStringName(FeatureManagementDbProperties.ConnectionStringName)]
public interface IFeatureManagementDbContext : IEfCoreDbContext
{
DbSet<FeatureValue> FeatureValues { get; set; }

9
modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementMongoDbContext.cs

@ -4,21 +4,16 @@ using Volo.Abp.MongoDB;
namespace Volo.Abp.FeatureManagement.MongoDB
{
[ConnectionStringName(FeatureManagementConsts.ConnectionStringName)]
[ConnectionStringName(FeatureManagementDbProperties.ConnectionStringName)]
public class FeatureManagementMongoDbContext : AbpMongoDbContext, IFeatureManagementMongoDbContext
{
public static string CollectionPrefix { get; set; } = FeatureManagementConsts.DefaultDbTablePrefix;
public IMongoCollection<FeatureValue> FeatureValues => Collection<FeatureValue>();
protected override void CreateModel(IMongoModelBuilder modelBuilder)
{
base.CreateModel(modelBuilder);
modelBuilder.ConfigureFeatureManagement(options =>
{
options.CollectionPrefix = CollectionPrefix;
});
modelBuilder.ConfigureFeatureManagement();
}
}
}

4
modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementMongoDbContextExtensions.cs

@ -11,7 +11,9 @@ namespace Volo.Abp.FeatureManagement.MongoDB
{
Check.NotNull(builder, nameof(builder));
var options = new FeatureManagementMongoModelBuilderConfigurationOptions();
var options = new FeatureManagementMongoModelBuilderConfigurationOptions(
FeatureManagementDbProperties.DbTablePrefix
);
optionsAction?.Invoke(options);

4
modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementMongoModelBuilderConfigurationOptions.cs

@ -6,8 +6,8 @@ namespace Volo.Abp.FeatureManagement.MongoDB
public class FeatureManagementMongoModelBuilderConfigurationOptions : MongoModelBuilderConfigurationOptions
{
public FeatureManagementMongoModelBuilderConfigurationOptions(
[NotNull] string tablePrefix = FeatureManagementConsts.DefaultDbTablePrefix)
: base(tablePrefix)
[NotNull] string collectionPrefix = "")
: base(collectionPrefix)
{
}

2
modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/IFeatureManagementMongoDbContext.cs

@ -4,7 +4,7 @@ using Volo.Abp.MongoDB;
namespace Volo.Abp.FeatureManagement.MongoDB
{
[ConnectionStringName(FeatureManagementConsts.ConnectionStringName)]
[ConnectionStringName(FeatureManagementDbProperties.ConnectionStringName)]
public interface IFeatureManagementMongoDbContext : IAbpMongoDbContext
{
IMongoCollection<FeatureValue> FeatureValues { get; }

Loading…
Cancel
Save