public Entity(Type type) { if (type == null) { throw new ArgumentNullException(nameof(type)); } Type = type; Name = Type.Name; SetTableName(Name.Pluralize()); Verbose = new Verbose(Type); Properties = type.GetProperties() .Select(x => new Property(this, x)) .ToList(); if (IsChangeEntity) { AllowAdd = AllowEdit = AllowDelete = false; } // check if has ToString() method HasToStringMethod = Type.GetMethod("ToString") .DeclaringType.Name != "Object"; }
public Entity(Type type) { if (type == null) { throw new ArgumentNullException("type"); } Type = type; Name = Type.Name; Verbose = new Verbose(type); Properties = type.GetProperties() .Select(x => new Property(this, x)) .ToList(); Links = new Links(Attributes); SetTableName(Attributes); SetLinkKey(); SetSearchProperties(Attributes); CanAdd = true; if (IsChangeEntity) { CanAdd = Links.HasDelete = Links.HasEdit = false; } // check if has ToString() method HasToStringMethod = Type.GetMethod("ToString") .DeclaringType.Name != "Object"; var recordDisplay = Attributes.OfType <RecordDisplayAttribute>().FirstOrDefault(); if (recordDisplay != null) { RecordDisplayFormat = recordDisplay.DisplayFormat; } }
public Entity(Type type) { if (type == null) throw new ArgumentNullException(nameof(type)); Type = type; Name = Type.Name; SetTableName(Name.Pluralize()); Verbose = new Verbose(Type); Properties = type.GetProperties() .Select(x => new Property(this, x)) .ToList(); if (IsChangeEntity) { AllowAdd = AllowEdit = AllowDelete = false; } // check if has ToString() method HasToStringMethod = Type.GetMethod("ToString") .DeclaringType.Name != "Object"; }
public Entity(Type type) { if (type == null) throw new ArgumentNullException("type"); Type = type; Name = Type.Name; Verbose = new Verbose(type); Properties = type.GetProperties() .Select(x => new Property(this, x)) .ToList(); Links = new Links(Attributes); SetTableName(Attributes); SetLinkKey(); SetSearchProperties(Attributes); CanAdd = true; if (IsChangeEntity) { CanAdd = Links.HasDelete = Links.HasEdit = false; } // check if has ToString() method HasToStringMethod = Type.GetMethod("ToString") .DeclaringType.Name != "Object"; var recordDisplay = Attributes.OfType<RecordDisplayAttribute>().FirstOrDefault(); if (recordDisplay != null) { RecordDisplayFormat = recordDisplay.DisplayFormat; } }