///// <summary>实例化</summary> //public DataField() { } /// <summary>从FieldItem填充</summary> /// <param name="field"></param> public virtual void Fill(FieldItem field) { var dc = field.Field; var pi = field.GetValue("_Property", false) as PropertyInfo; Name = field.Name; DisplayName = field.DisplayName; Description = field.Description; Category = pi?.GetCustomAttribute <CategoryAttribute>()?.Category + ""; Type = field.Type; DataType = field.Type.Name; Length = field.Length; Nullable = field.IsNullable; PrimaryKey = field.PrimaryKey; Readonly = field.ReadOnly; if (field.Map != null) { MapField = field.Map.Name; MapProvider = field.Map.Provider; } if (dc != null) { ItemType = dc.ItemType; Precision = dc.Precision; Scale = dc.Scale; if (dc.Properties != null) { foreach (var item in dc.Properties) { Properties[item.Key] = item.Value; } } } }