using System; using System.Collections.Generic; using System.Linq; using Volo.Abp.SettingManagement.EntityFrameworkCore; namespace Volo.Abp.SettingManagement { public class SettingsTestBase : SettingManagementTestBase { protected virtual void UsingDbContext(Action action) { using (var dbContext = GetRequiredService()) { action.Invoke(dbContext); } } protected virtual T UsingDbContext(Func action) { using (var dbContext = GetRequiredService()) { return action.Invoke(dbContext); } } protected List GetSettingsFromDbContext(string entityType, string entityId, string name) { return UsingDbContext(context => context.Settings.Where( s => s.ProviderName == entityType && s.ProviderKey == entityId && s.Name == name ).ToList() ); } } }