本文整理汇总了C#中Class.AppendLine方法的典型用法代码示例。如果您正苦于以下问题:C# Class.AppendLine方法的具体用法?C# Class.AppendLine怎么用?C# Class.AppendLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Class
的用法示例。
在下文中一共展示了Class.AppendLine方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateClass
protected override void CreateClass()
{
var clss = new Class(cname)
{
modifier = Modifier.Public | Modifier.Partial
};
clss.AddAttribute(new AttributeInfo("Table", new { Name = tname.ShortName }));
builder.AddClass(clss);
TableSchema schema = GetSchema(tname);
Property prop;
foreach (IColumn column in schema.Columns)
{
TypeInfo ty = new TypeInfo { userType = ColumnSchema.GetFieldType(column.DataType, column.Nullable) };
prop = new Property(ty, column.ToFieldName()) { modifier = Modifier.Public };
List<object> args = new List<object>();
args.Add(new { Name = column.ColumnName });
//args.Add(new { DbType = ColumnSchema.GetSQLType(column) + (column.Nullable ? " NULL" : " NOT NULL") });
if (column.IsPrimary)
args.Add(new { IsPrimaryKey = true });
if (column.IsIdentity)
args.Add(new { IsDbGenerated = true });
if (!column.IsPrimary && !column.Nullable)
args.Add(new { CanBeNull = false });
if (column.CType == CType.Text || column.CType == CType.NText)
args.Add(new AttributeInfoArg("UpdateCheck", "UpdateCheck.Never"));
prop.AddAttribute(new AttributeInfo("Column", args.ToArray()));
if (!column.IsComputed)
clss.Add(prop);
}
var fkBy = schema.ByForeignKeys.Keys.OrderBy(k => k.FK_Table);
Constructor constructor = null;
if (fkBy.Count() > 0)
{
clss.AppendLine();
constructor = new Constructor(this.cname);
}
List<Property> list = new List<Property>();
foreach (var key in fkBy)
{
prop = AddEntitySet(clss, constructor, key);
list.Add(prop);
}
var fks = schema.ForeignKeys;
//list = new List<Property>();
if (fks.Length > 0)
clss.AppendLine();
foreach (var key in fks.Keys)
{
prop = AddEntityRef(clss, key);
list.Add(prop);
}
if (constructor != null)
clss.Add(constructor);
foreach (var p in list)
clss.Add(p);
}