mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Update demo
This commit is contained in:
parent
7c7db7b740
commit
4feb97cc99
@ -38,37 +38,36 @@ namespace OrmTest
|
||||
db.DbFirst.IsCreateDefaultValue().CreateClassFile("c:\\Demo\\6", "Demo.Models");
|
||||
|
||||
|
||||
db.DbFirst. SettingClassTemplate(old => { return old;})
|
||||
.SettingNamespaceTemplate(old =>{ return old;})
|
||||
.SettingPropertyDescriptionTemplate(old =>
|
||||
{
|
||||
return @" /// <summary>
|
||||
/// Desc_New:{PropertyDescription}
|
||||
/// Default_New:{DefaultValue}
|
||||
/// Nullable_New:{IsNullable}
|
||||
/// </summary>";
|
||||
})
|
||||
.SettingPropertyTemplate(old =>{return old;})
|
||||
.SettingConstructorTemplate(old =>{return old; })
|
||||
.CreateClassFile("c:\\Demo\\7");
|
||||
db.DbFirst
|
||||
//类
|
||||
.SettingClassTemplate(old => { return old;/*修改old值替换*/ })
|
||||
//类构造函数
|
||||
.SettingConstructorTemplate(old => { return old;/*修改old值替换*/ })
|
||||
.SettingNamespaceTemplate(old => {
|
||||
return old + "\r\nusing SqlSugar;"; //追加引用SqlSugar
|
||||
})
|
||||
//属性备注
|
||||
.SettingPropertyDescriptionTemplate(old => { return old;/*修改old值替换*/})
|
||||
|
||||
db.DbFirst
|
||||
.SettingPropertyTemplate((columns,temp,type) => {
|
||||
var columnattribute = "\r [SugarColumn({0})]";
|
||||
List<string> attributes = new List<string>();
|
||||
if (columns.IsPrimarykey)
|
||||
attributes.Add("IsPrimarykey=true");
|
||||
if (columns.IsIdentity)
|
||||
attributes.Add("IsIdentity=true");
|
||||
if (attributes.Count == 0)
|
||||
{
|
||||
columnattribute="";
|
||||
}
|
||||
return temp.Replace("{PropertyType}", type)
|
||||
.Replace("{PropertyName}", columns.DbColumnName)
|
||||
.Replace("{SugarColumn}",string.Format(columnattribute,string.Join(",", attributes)));
|
||||
})
|
||||
.CreateClassFile("c:\\Demo\\8");
|
||||
//属性:新重载 完全自定义用配置
|
||||
.SettingPropertyTemplate((columns, temp, type) => {
|
||||
|
||||
var columnattribute = "\r\n [SugarColumn({0})]";
|
||||
List<string> attributes = new List<string>();
|
||||
if (columns.IsPrimarykey)
|
||||
attributes.Add("IsPrimaryKey=true");
|
||||
if (columns.IsIdentity)
|
||||
attributes.Add("IsIdentity=true");
|
||||
if (attributes.Count == 0)
|
||||
{
|
||||
columnattribute = "";
|
||||
}
|
||||
return temp.Replace("{PropertyType}", type)
|
||||
.Replace("{PropertyName}", columns.DbColumnName)
|
||||
.Replace("{SugarColumn}", string.Format(columnattribute, string.Join(",", attributes)));
|
||||
})
|
||||
|
||||
.CreateClassFile("c:\\Demo\\8");
|
||||
|
||||
foreach (var item in db.DbMaintenance.GetTableInfoList())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user