|
|
|
@ -1,5 +1,6 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Threading; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using MongoDB.Driver; |
|
|
|
using MongoDB.Driver.Linq; |
|
|
|
@ -16,24 +17,35 @@ namespace Volo.Abp.FeatureManagement.MongoDB |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public virtual async Task<FeatureValue> FindAsync(string name, string providerName, string providerKey) |
|
|
|
public virtual async Task<FeatureValue> FindAsync( |
|
|
|
string name, |
|
|
|
string providerName, |
|
|
|
string providerKey, |
|
|
|
CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
return await (await GetMongoQueryableAsync()) |
|
|
|
return await (await GetMongoQueryableAsync(GetCancellationToken(cancellationToken))) |
|
|
|
.OrderBy(x => x.Id) |
|
|
|
.FirstOrDefaultAsync(s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey); |
|
|
|
.FirstOrDefaultAsync(s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey, GetCancellationToken(cancellationToken)); |
|
|
|
} |
|
|
|
|
|
|
|
public async Task<List<FeatureValue>> FindAllAsync(string name, string providerName, string providerKey) |
|
|
|
public async Task<List<FeatureValue>> FindAllAsync( |
|
|
|
string name, |
|
|
|
string providerName, |
|
|
|
string providerKey, |
|
|
|
CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
return await (await GetMongoQueryableAsync()) |
|
|
|
.Where(s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey).ToListAsync(); |
|
|
|
return await (await GetMongoQueryableAsync(GetCancellationToken(cancellationToken))) |
|
|
|
.Where(s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey).ToListAsync(GetCancellationToken(cancellationToken)); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual async Task<List<FeatureValue>> GetListAsync(string providerName, string providerKey) |
|
|
|
public virtual async Task<List<FeatureValue>> GetListAsync( |
|
|
|
string providerName, |
|
|
|
string providerKey, |
|
|
|
CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
return await (await GetMongoQueryableAsync()) |
|
|
|
return await (await GetMongoQueryableAsync(GetCancellationToken(cancellationToken))) |
|
|
|
.Where(s => s.ProviderName == providerName && s.ProviderKey == providerKey) |
|
|
|
.ToListAsync(); |
|
|
|
.ToListAsync(GetCancellationToken(cancellationToken)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|