Browse Source

Created ModelBuilderConfigurationOptions

pull/272/head
Halil İbrahim Kalkan 9 years ago
parent
commit
dadafc8b1a
  1. 6
      src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionPreConfigureExtensions.cs
  2. 11
      src/Volo.Abp.Core/Volo/Abp/Check.cs
  3. 32
      src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/Modeling/ModelBuilderConfigurationOptions.cs
  4. 2
      src/Volo.Abp.MultiTenancy.Abstractions/Volo/Abp/MultiTenancy/AbpMultiTenancyAbstractionsModule.cs

6
src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionPreConfigureExtensions.cs

@ -12,6 +12,12 @@ namespace Microsoft.Extensions.DependencyInjection
return services; return services;
} }
public static TOptions ExecutePreConfiguredActions<TOptions>(this IServiceCollection services)
where TOptions : new()
{
return services.ExecutePreConfiguredActions(new TOptions());
}
public static TOptions ExecutePreConfiguredActions<TOptions>(this IServiceCollection services, TOptions options) public static TOptions ExecutePreConfiguredActions<TOptions>(this IServiceCollection services, TOptions options)
{ {
services.GetPreConfigureActions<TOptions>().Configure(options); services.GetPreConfigureActions<TOptions>().Configure(options);

11
src/Volo.Abp.Core/Volo/Abp/Check.cs

@ -19,6 +19,17 @@ namespace Volo.Abp
return value; return value;
} }
[ContractAnnotation("value:null => halt")]
public static T NotNull<T>(T value, [InvokerParameterName] [NotNull] string parameterName, string message)
{
if (value == null)
{
throw new ArgumentNullException(parameterName, message);
}
return value;
}
[ContractAnnotation("value:null => halt")] [ContractAnnotation("value:null => halt")]
public static string NotNullOrWhiteSpace(string value, [InvokerParameterName] [NotNull] string parameterName) public static string NotNullOrWhiteSpace(string value, [InvokerParameterName] [NotNull] string parameterName)
{ {

32
src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/Modeling/ModelBuilderConfigurationOptions.cs

@ -0,0 +1,32 @@
using JetBrains.Annotations;
namespace Volo.Abp.EntityFrameworkCore.Modeling
{
public class ModelBuilderConfigurationOptions
{
[NotNull]
public string TablePrefix
{
get => _tablePrefix;
set
{
Check.NotNull(value, nameof(value), $"{nameof(TablePrefix)} can not be null! Set to empty string if you don't want a table prefix.");
_tablePrefix = value;
}
}
private string _tablePrefix;
[CanBeNull]
public string Schema { get; set; }
public ModelBuilderConfigurationOptions(
[NotNull] string tablePrefix = "",
[CanBeNull] string schema = null)
{
Check.NotNull(tablePrefix, nameof(tablePrefix));
TablePrefix = tablePrefix;
Schema = schema;
}
}
}

2
src/Volo.Abp.MultiTenancy.Abstractions/Volo/Abp/MultiTenancy/AbpMultiTenancyAbstractionsModule.cs

@ -7,7 +7,7 @@ namespace Volo.Abp.MultiTenancy
{ {
[DependsOn(typeof(AbpDataModule))] [DependsOn(typeof(AbpDataModule))]
[DependsOn(typeof(AbpSettingsModule))] [DependsOn(typeof(AbpSettingsModule))]
public class AbpMultiTenancyAbstractionsModule : AbpModule public class AbpMultiTenancyAbstractionsModule : AbpModule //TODO: Rename to AbpMultiTenancyModule
{ {
public override void ConfigureServices(IServiceCollection services) public override void ConfigureServices(IServiceCollection services)
{ {

Loading…
Cancel
Save