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);
|
FillData(modelBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<int> RefreshMaterializedViewAsync<TEntity>(string? mwName = null, CancellationToken token = default)
|
public Task<int> RefreshMaterializedViewAsync<TEntity>(CancellationToken token = default)
|
||||||
where TEntity : class
|
where TEntity : class
|
||||||
{
|
{
|
||||||
var materializedView = string.IsNullOrEmpty(mwName)
|
var materializedViewName = Set<TEntity>().EntityType.GetViewName();
|
||||||
? Set<TEntity>().EntityType.GetViewName()
|
return RefreshMaterializedViewAsync(materializedViewName!, token);
|
||||||
: mwName;
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(materializedView))
|
public Task<int> RefreshMaterializedViewAsync(string materializedViewName, CancellationToken token = default)
|
||||||
return Task.FromResult(0);
|
{
|
||||||
|
var sql = $"REFRESH MATERIALIZED VIEW {materializedViewName};";
|
||||||
var sql = $"REFRESH MATERIALIZED VIEW {materializedView};";
|
|
||||||
return Database.ExecuteSqlRawAsync(sql, token);
|
return Database.ExecuteSqlRawAsync(sql, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user