using FreeSql.DatabaseModel;@{ var gen = Model as RazorModel; Func GetAttributeString = attr => { if (string.IsNullOrEmpty(attr)) return ""; return string.Concat(", ", attr.Trim('[', ']')).Trim(','); }; Func GetDefaultValue = defval => { if (string.IsNullOrEmpty(defval)) return ""; return " = " + defval + ";"; }; }@{ switch (gen.fsql.Ado.DataType) { case FreeSql.DataType.PostgreSQL: @:using System; @:using System.Collections; @:using System.Collections.Generic; @:using System.Linq; @:using System.Reflection; @:using System.Threading.Tasks; @:using Newtonsoft.Json; @:using FreeSql.DataAnnotations; @:using System.Net; @:using Newtonsoft.Json.Linq; @:using System.Net.NetworkInformation; @:using NpgsqlTypes; @:using Npgsql.LegacyPostgis; break; case FreeSql.DataType.SqlServer: case FreeSql.DataType.MySql: default: @:using System; @:using System.Collections; @:using System.Collections.Generic; @:using System.Linq; @:using System.Reflection; @:using System.Threading.Tasks; @:using Newtonsoft.Json; @:using FreeSql.DataAnnotations; break; } } namespace @gen.NameSpace { @if (false == false) { @:/// @:/// @gen.table.Comment.Replace("\r\n", "\n").Replace("\n", "\r\n /// ") @:/// } [@GetAttributeString(gen.GetTableAttribute())] public partial class @gen.GetCsName(gen.FullTableName) { @foreach (var col in gen.columns) { if (false == false) { @:/// @:/// @col.Comment.Replace("\r\n", "\n").Replace("\n", "\r\n /// ") @:/// } @:public @gen.GetCsType(col) @gen.GetCsName(col.Name) { get; set; }@GetDefaultValue(gen.GetColumnDefaultValue(col, false)) @: } } @gen.GetMySqlEnumSetDefine() }