|
|
@ -1,6 +1,7 @@ |
|
|
using System; |
|
|
using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
|
|
|
using System.Threading; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
using Microsoft.EntityFrameworkCore; |
|
|
using Microsoft.EntityFrameworkCore; |
|
|
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
|
|
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
|
|
@ -8,36 +9,48 @@ using Volo.Abp.EntityFrameworkCore; |
|
|
|
|
|
|
|
|
namespace Volo.Abp.SettingManagement.EntityFrameworkCore |
|
|
namespace Volo.Abp.SettingManagement.EntityFrameworkCore |
|
|
{ |
|
|
{ |
|
|
public class EfCoreSettingRepository : EfCoreRepository<ISettingManagementDbContext, Setting, Guid>, ISettingRepository |
|
|
public class EfCoreSettingRepository : EfCoreRepository<ISettingManagementDbContext, Setting, Guid>, |
|
|
|
|
|
ISettingRepository |
|
|
{ |
|
|
{ |
|
|
public EfCoreSettingRepository(IDbContextProvider<ISettingManagementDbContext> dbContextProvider) |
|
|
public EfCoreSettingRepository(IDbContextProvider<ISettingManagementDbContext> dbContextProvider) |
|
|
: base(dbContextProvider) |
|
|
: base(dbContextProvider) |
|
|
{ |
|
|
{ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public virtual async Task<Setting> FindAsync(string name, string providerName, string providerKey) |
|
|
public virtual async Task<Setting> FindAsync( |
|
|
|
|
|
string name, |
|
|
|
|
|
string providerName, |
|
|
|
|
|
string providerKey, |
|
|
|
|
|
CancellationToken cancellationToken = default) |
|
|
{ |
|
|
{ |
|
|
return await (await GetDbSetAsync()) |
|
|
return await (await GetDbSetAsync()) |
|
|
.OrderBy(x => x.Id) |
|
|
.OrderBy(x => x.Id) |
|
|
.FirstOrDefaultAsync( |
|
|
.FirstOrDefaultAsync( |
|
|
s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey |
|
|
s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey, |
|
|
); |
|
|
GetCancellationToken(cancellationToken)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public virtual async Task<List<Setting>> GetListAsync(string providerName, string providerKey) |
|
|
public virtual async Task<List<Setting>> GetListAsync( |
|
|
|
|
|
string providerName, |
|
|
|
|
|
string providerKey, |
|
|
|
|
|
CancellationToken cancellationToken = default) |
|
|
{ |
|
|
{ |
|
|
return await (await GetDbSetAsync()) |
|
|
return await (await GetDbSetAsync()) |
|
|
.Where( |
|
|
.Where( |
|
|
s => s.ProviderName == providerName && s.ProviderKey == providerKey |
|
|
s => s.ProviderName == providerName && s.ProviderKey == providerKey |
|
|
).ToListAsync(); |
|
|
).ToListAsync(GetCancellationToken(cancellationToken)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public virtual async Task<List<Setting>> GetListAsync(string[] names, string providerName, string providerKey) |
|
|
public virtual async Task<List<Setting>> GetListAsync( |
|
|
|
|
|
string[] names, |
|
|
|
|
|
string providerName, |
|
|
|
|
|
string providerKey, |
|
|
|
|
|
CancellationToken cancellationToken = default) |
|
|
{ |
|
|
{ |
|
|
return await (await GetDbSetAsync()) |
|
|
return await (await GetDbSetAsync()) |
|
|
.Where( |
|
|
.Where( |
|
|
s => names.Contains(s.Name) && s.ProviderName == providerName && s.ProviderKey == providerKey |
|
|
s => names.Contains(s.Name) && s.ProviderName == providerName && s.ProviderKey == providerKey |
|
|
).ToListAsync(); |
|
|
).ToListAsync(GetCancellationToken(cancellationToken)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|