Db table prefix revision for the identity module #1429

pull/1904/head
Halil İbrahim Kalkan 5 years ago
parent 110f015d38
commit cc8fd28e5d

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

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

@ -4,13 +4,9 @@ using Volo.Abp.EntityFrameworkCore;
namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore
{
[ConnectionStringName(BackgroundJobsConsts.ConnectionStringName)]
[ConnectionStringName(BackgroundJobsDbProperties.ConnectionStringName)]
public class BackgroundJobsDbContext : AbpDbContext<BackgroundJobsDbContext>, IBackgroundJobsDbContext
{
public static string TablePrefix { get; set; } = BackgroundJobsConsts.DefaultDbTablePrefix;
public static string Schema { get; set; } = BackgroundJobsConsts.DefaultDbSchema;
public DbSet<BackgroundJobRecord> BackgroundJobs { get; set; }
public BackgroundJobsDbContext(DbContextOptions<BackgroundJobsDbContext> options)
@ -23,11 +19,7 @@ namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore
{
base.OnModelCreating(builder);
builder.ConfigureBackgroundJobs(options =>
{
options.TablePrefix = TablePrefix;
options.Schema = Schema;
});
builder.ConfigureBackgroundJobs();
}
}
}

@ -12,7 +12,10 @@ namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore
{
Check.NotNull(builder, nameof(builder));
var options = new BackgroundJobsModelBuilderConfigurationOptions();
var options = new BackgroundJobsModelBuilderConfigurationOptions(
BackgroundJobsDbProperties.DbTablePrefix,
BackgroundJobsDbProperties.DbSchema
);
optionsAction?.Invoke(options);

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

@ -4,7 +4,7 @@ using Volo.Abp.EntityFrameworkCore;
namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore
{
[ConnectionStringName(BackgroundJobsConsts.ConnectionStringName)]
[ConnectionStringName(BackgroundJobsDbProperties.ConnectionStringName)]
public interface IBackgroundJobsDbContext : IEfCoreDbContext
{
DbSet<BackgroundJobRecord> BackgroundJobs { get; }

@ -4,21 +4,16 @@ using Volo.Abp.MongoDB;
namespace Volo.Abp.BackgroundJobs.MongoDB
{
[ConnectionStringName(BackgroundJobsConsts.ConnectionStringName)]
[ConnectionStringName(BackgroundJobsDbProperties.ConnectionStringName)]
public class BackgroundJobsMongoDbContext : AbpMongoDbContext, IBackgroundJobsMongoDbContext
{
public static string CollectionPrefix { get; set; } = BackgroundJobsConsts.DefaultDbTablePrefix;
public IMongoCollection<BackgroundJobRecord> BackgroundJobs { get; set; }
protected override void CreateModel(IMongoModelBuilder modelBuilder)
{
base.CreateModel(modelBuilder);
modelBuilder.ConfigureBackgroundJobs(options =>
{
options.CollectionPrefix = CollectionPrefix;
});
modelBuilder.ConfigureBackgroundJobs();
}
}
}

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

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

@ -4,7 +4,7 @@ using Volo.Abp.MongoDB;
namespace Volo.Abp.BackgroundJobs.MongoDB
{
[ConnectionStringName(BackgroundJobsConsts.ConnectionStringName)]
[ConnectionStringName(BackgroundJobsDbProperties.ConnectionStringName)]
public interface IBackgroundJobsMongoDbContext : IAbpMongoDbContext
{
IMongoCollection<BackgroundJobRecord> BackgroundJobs { get; }

Loading…
Cancel
Save