Merge pull request #15309 from abpframework/set-defaults-feature-definition

Set defaults while adding features
pull/15314/head
maliming 2 years ago committed by GitHub
commit 8dcfab5ee1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -11,7 +11,7 @@ public abstract class FeatureCheckerBase : IFeatureChecker, ITransientDependency
public virtual async Task<bool> IsEnabledAsync(string name)
{
var value = await GetOrNullAsync(name);
if (value == null)
if (value.IsNullOrEmpty())
{
return false;
}

@ -100,11 +100,11 @@ public class FeatureDefinition : ICanCreateChildFeature
bool isVisibleToClients = true,
bool isAvailableToHost = true)
{
Name = name;
Name = Check.NotNullOrWhiteSpace(name, nameof(name));
DefaultValue = defaultValue;
DisplayName = displayName ?? new FixedLocalizableString(name);
Description = description;
ValueType = valueType;
ValueType = valueType ?? new ToggleStringValueType();
IsVisibleToClients = isVisibleToClients;
IsAvailableToHost = isAvailableToHost;

@ -70,7 +70,7 @@ public class FeatureDefinitionRecord : BasicAggregateRoot<Guid>, IHasExtraProper
DisplayName = Check.NotNullOrWhiteSpace(displayName, nameof(displayName), FeatureDefinitionRecordConsts.MaxDisplayNameLength);
Description = Check.Length(description, nameof(description), FeatureDefinitionRecordConsts.MaxDescriptionLength);
DefaultValue = Check.NotNullOrWhiteSpace(defaultValue, nameof(defaultValue), FeatureDefinitionRecordConsts.MaxDefaultValueLength);
DefaultValue = Check.Length(defaultValue, nameof(defaultValue), FeatureDefinitionRecordConsts.MaxDefaultValueLength);
IsVisibleToClients = isVisibleToClients;
IsAvailableToHost = isAvailableToHost;

@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore.Storage;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.Sqlite;
using Volo.Abp.Modularity;
using Volo.Abp.Uow;
namespace Volo.Abp.FeatureManagement.EntityFrameworkCore;
@ -26,6 +27,11 @@ public class AbpFeatureManagementEntityFrameworkCoreTestModule : AbpModule
abpDbContextConfigurationContext.DbContextOptions.UseSqlite(sqliteConnection);
});
});
Configure<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});
}
private static SqliteConnection CreateDatabaseAndGetConnection()

Loading…
Cancel
Save