Browse Source

#4323 Implemented: Set AbpSequentialGuidGeneratorOptions.DefaultSequentialGuidType by the database provider packages

pull/4326/head
Halil İbrahim Kalkan 6 years ago
parent
commit
1a7d74dc9f
  1. 14
      framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo/Abp/EntityFrameworkCore/MySQL/AbpEntityFrameworkCoreMySQLModule.cs
  2. 14
      framework/src/Volo.Abp.EntityFrameworkCore.Oracle.Devart/Volo/Abp/EntityFrameworkCore/Oracle/Devart/AbpEntityFrameworkCoreOracleDevartModule.cs
  3. 14
      framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/PostgreSql/AbpEntityFrameworkCorePostgreSqlModule.cs
  4. 14
      framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo/Abp/EntityFrameworkCore/SqlServer/AbpEntityFrameworkCoreSqlServerModule.cs
  5. 18
      framework/src/Volo.Abp.Guids/Volo/Abp/Guids/AbpSequentialGuidGeneratorOptions.cs
  6. 2
      framework/src/Volo.Abp.Guids/Volo/Abp/Guids/SequentialGuidGenerator.cs

14
framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo/Abp/EntityFrameworkCore/MySQL/AbpEntityFrameworkCoreMySQLModule.cs

@ -1,4 +1,5 @@
using Volo.Abp.Modularity;
using Volo.Abp.Guids;
using Volo.Abp.Modularity;
namespace Volo.Abp.EntityFrameworkCore.MySQL
{
@ -7,6 +8,15 @@ namespace Volo.Abp.EntityFrameworkCore.MySQL
)]
public class AbpEntityFrameworkCoreMySQLModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpSequentialGuidGeneratorOptions>(options =>
{
if (options.DefaultSequentialGuidType == null)
{
options.DefaultSequentialGuidType = SequentialGuidType.SequentialAsString;
}
});
}
}
}

14
framework/src/Volo.Abp.EntityFrameworkCore.Oracle.Devart/Volo/Abp/EntityFrameworkCore/Oracle/Devart/AbpEntityFrameworkCoreOracleDevartModule.cs

@ -1,4 +1,5 @@
using Volo.Abp.Modularity;
using Volo.Abp.Guids;
using Volo.Abp.Modularity;
namespace Volo.Abp.EntityFrameworkCore.Oracle.Devart
{
@ -7,6 +8,15 @@ namespace Volo.Abp.EntityFrameworkCore.Oracle.Devart
)]
public class AbpEntityFrameworkCoreOracleDevartModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpSequentialGuidGeneratorOptions>(options =>
{
if (options.DefaultSequentialGuidType == null)
{
options.DefaultSequentialGuidType = SequentialGuidType.SequentialAsBinary;
}
});
}
}
}

14
framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/PostgreSql/AbpEntityFrameworkCorePostgreSqlModule.cs

@ -1,4 +1,5 @@
using Volo.Abp.Modularity;
using Volo.Abp.Guids;
using Volo.Abp.Modularity;
namespace Volo.Abp.EntityFrameworkCore.PostgreSql
{
@ -7,6 +8,15 @@ namespace Volo.Abp.EntityFrameworkCore.PostgreSql
)]
public class AbpEntityFrameworkCorePostgreSqlModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpSequentialGuidGeneratorOptions>(options =>
{
if (options.DefaultSequentialGuidType == null)
{
options.DefaultSequentialGuidType = SequentialGuidType.SequentialAsString;
}
});
}
}
}

14
framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo/Abp/EntityFrameworkCore/SqlServer/AbpEntityFrameworkCoreSqlServerModule.cs

@ -1,4 +1,5 @@
using Volo.Abp.Modularity;
using Volo.Abp.Guids;
using Volo.Abp.Modularity;
namespace Volo.Abp.EntityFrameworkCore.SqlServer
{
@ -7,6 +8,15 @@ namespace Volo.Abp.EntityFrameworkCore.SqlServer
)]
public class AbpEntityFrameworkCoreSqlServerModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpSequentialGuidGeneratorOptions>(options =>
{
if (options.DefaultSequentialGuidType == null)
{
options.DefaultSequentialGuidType = SequentialGuidType.SequentialAtEnd;
}
});
}
}
}

18
framework/src/Volo.Abp.Guids/Volo/Abp/Guids/AbpSequentialGuidGeneratorOptions.cs

@ -3,13 +3,21 @@
public class AbpSequentialGuidGeneratorOptions
{
/// <summary>
/// Default value: <see cref="SequentialGuidType.SequentialAtEnd"/>.
/// Default value: null (unspecified).
/// Use <see cref="GetDefaultSequentialGuidType"/> method
/// to get the value on use, since it fall backs to a default value.
/// </summary>
public SequentialGuidType DefaultSequentialGuidType { get; set; }
public AbpSequentialGuidGeneratorOptions()
public SequentialGuidType? DefaultSequentialGuidType { get; set; }
/// <summary>
/// Get the <see cref="DefaultSequentialGuidType"/> value
/// or returns <see cref="SequentialGuidType.SequentialAtEnd"/>
/// if <see cref="DefaultSequentialGuidType"/> was null.
/// </summary>
public SequentialGuidType GetDefaultSequentialGuidType()
{
DefaultSequentialGuidType = SequentialGuidType.SequentialAtEnd;
return DefaultSequentialGuidType ??
SequentialGuidType.SequentialAtEnd;
}
}
}

2
framework/src/Volo.Abp.Guids/Volo/Abp/Guids/SequentialGuidGenerator.cs

@ -24,7 +24,7 @@ namespace Volo.Abp.Guids
public Guid Create()
{
return Create(Options.DefaultSequentialGuidType);
return Create(Options.GetDefaultSequentialGuidType());
}
public Guid Create(SequentialGuidType guidType)

Loading…
Cancel
Save