internal static void SetColumnDbType(DBAdapter.DBAdapterBase dbAdapter, Attribute.FieldInnerAttribute info) { //if (info.FieldType != Attribute.FieldType.数据库字段) //{ // return; //} string defaultValue; Type propertyType = info.PropertyType; var columnType = dbAdapter.GetColumnType(info, out defaultValue); info.ColumnType = columnType; info.DefaultValue = defaultValue; if (info.ColumnType.Contains("{0}")) { throw new Exception(string.Format("属性:{0} 需要指定长度 ColumnType:{1}", info.MemberName, info.ColumnType)); } }
internal static void SetColumnDbType(DBAdapter.DBAdapterBase dbAdapter, Attribute.FieldAttribute info, Dictionary <Type, string> dic) { if (info.FieldType != Attribute.FieldType.数据库字段) { return; } string defaultValue; Type propertyType = info.PropertyType; if (propertyType.FullName.IndexOf("System.") > -1 && !dic.ContainsKey(propertyType)) { throw new Exception(string.Format("找不到对应的字段类型映射 {0} 在 {1}", propertyType, dbAdapter)); } var columnType = dbAdapter.GetColumnType(info, out defaultValue); info.ColumnType = columnType; info.DefaultValue = defaultValue; if (info.ColumnType.Contains("{0}")) { throw new Exception(string.Format("属性:{0} 需要指定长度 ColumnType:{1}", info.Name, info.ColumnType)); } }