forked from ddrilling/AsbCloudServer
split RefreshMaterializedViewAsync to 2 overload
This commit is contained in:
parent
8b6a9c78c7
commit
09b39c14ea
@ -286,17 +286,16 @@ namespace AsbCloudDb.Model
|
||||
FillData(modelBuilder);
|
||||
}
|
||||
|
||||
public Task<int> RefreshMaterializedViewAsync<TEntity>(string? mwName = null, CancellationToken token = default)
|
||||
public Task<int> RefreshMaterializedViewAsync<TEntity>(CancellationToken token = default)
|
||||
where TEntity : class
|
||||
{
|
||||
var materializedView = string.IsNullOrEmpty(mwName)
|
||||
? Set<TEntity>().EntityType.GetViewName()
|
||||
: mwName;
|
||||
var materializedViewName = Set<TEntity>().EntityType.GetViewName();
|
||||
return RefreshMaterializedViewAsync(materializedViewName!, token);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(materializedView))
|
||||
return Task.FromResult(0);
|
||||
|
||||
var sql = $"REFRESH MATERIALIZED VIEW {materializedView};";
|
||||
public Task<int> RefreshMaterializedViewAsync(string materializedViewName, CancellationToken token = default)
|
||||
{
|
||||
var sql = $"REFRESH MATERIALIZED VIEW {materializedViewName};";
|
||||
return Database.ExecuteSqlRawAsync(sql, token);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user