mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2026-02-26 13:43:10 +08:00
-
This commit is contained in:
@@ -13,15 +13,22 @@ namespace SqlSugar
|
||||
private string PropertyDescriptionTemplate { get; set; }
|
||||
private string ConstructorTemplate { get; set; }
|
||||
private string NamespaceTemplate { get; set; }
|
||||
private string
|
||||
private List<DbTableInfo> TableInfoList { get; set; }
|
||||
|
||||
public DbFirstProvider() {
|
||||
public DbFirstProvider()
|
||||
{
|
||||
this.ClassTemplate = DefaultTemplate.ClassTemplate;
|
||||
this.ClassDescriptionTemplate = DefaultTemplate.ClassDescriptionTemplate;
|
||||
this.PropertyTemplate = DefaultTemplate.PropertyTemplate;
|
||||
this.PropertyDescriptionTemplate = DefaultTemplate.PropertyDescriptionTemplate;
|
||||
this.ConstructorTemplate = DefaultTemplate.ConstructorTemplate;
|
||||
this.NamespaceTemplate = DefaultTemplate.NamespaceTemplate;
|
||||
this.TableInfoList = this.Context.DbMaintenance.GetTableInfoList();
|
||||
if (this.Context.DbMaintenance.GetViewInfoList().IsValuable())
|
||||
{
|
||||
this.TableInfoList.AddRange(this.Context.DbMaintenance.GetViewInfoList());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<SchemaInfo> GetSchemaInfoList
|
||||
@@ -79,17 +86,24 @@ namespace SqlSugar
|
||||
#region Where
|
||||
public IDbFirst Where(DbObjectType dbObjectType)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
if (dbObjectType != DbObjectType.All)
|
||||
this.TableInfoList = this.TableInfoList.Where(it => it.DbObjectType == dbObjectType).ToList();
|
||||
return this;
|
||||
}
|
||||
|
||||
public IDbFirst Where(Func<string, bool> func)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
this.TableInfoList=this.TableInfoList.Where(it => func(it.Name)).ToList();
|
||||
return this;
|
||||
}
|
||||
|
||||
public IDbFirst Where(params string[] objectNames)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
if (objectNames.IsValuable())
|
||||
{
|
||||
this.TableInfoList = this.TableInfoList.Where(it => objectNames.Contains(it.Name)).ToList();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -19,12 +19,22 @@ namespace SqlSugar
|
||||
public List<DbTableInfo> GetViewInfoList()
|
||||
{
|
||||
string key = "DbMaintenanceProvider.GetViewInfoList";
|
||||
return GetListOrCache<DbTableInfo>(key, this.GetViewInfoListSql);
|
||||
var result= GetListOrCache<DbTableInfo>(key, this.GetViewInfoListSql);
|
||||
foreach (var item in result)
|
||||
{
|
||||
item.DbObjectType = DbObjectType.View;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public List<DbTableInfo> GetTableInfoList()
|
||||
{
|
||||
string key = "DbMaintenanceProvider.GetTableInfoList";
|
||||
return GetListOrCache<DbTableInfo>(key, this.GetTableInfoListSql);
|
||||
var result= GetListOrCache<DbTableInfo>(key, this.GetTableInfoListSql);
|
||||
foreach (var item in result)
|
||||
{
|
||||
item.DbObjectType = DbObjectType.Table;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public virtual List<DbColumnInfo> GetColumnInfosByTableName(string tableName)
|
||||
{
|
||||
|
||||
@@ -9,5 +9,6 @@ namespace SqlSugar
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public DbObjectType DbObjectType { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user