public bool CheckDbField(PropertyInfo property) { if (TableInfo != null) { return(TableInfo.CheckDbField(property.Name)); } return(DbAttributes.CheckDbField(property)); }
public void CheckDbFieldTest() { var type = typeof(AttributeModel); var intProperty = type.GetProperties().Where(p => p.Name == "IntProperty").FirstOrDefault(); var noDbProperty = type.GetProperties().Where(p => p.Name == "NotField").FirstOrDefault(); if (intProperty == null || noDbProperty == null) { Assert.Fail(); } Assert.IsTrue(DbAttributes.CheckDbField(intProperty)); Assert.IsFalse(DbAttributes.CheckDbField(noDbProperty)); }
public FieldsAndValues MakeFields() { var result = new FieldsAndValues(); foreach (var field in FieldsPart.Split(',')) { if (TableInfo != null) { var fieldInfo = TableInfo.GetField(field); if (fieldInfo != null) { if (fieldInfo.NotDbField) { continue; } if (fieldInfo.IsAutoIncrement) { continue; } result.Add(field, fieldInfo.DbFieldName); continue; } } var property = GetProperty(field); if (property == null) { result.Add(field); } else { if (!DbAttributes.CheckDbField(property)) { continue; } if (DbAttributes.CheckAutoIncrement(property)) { continue; } var dbFieldName = DbAttributes.GetDbFieldName(property); result.Add(property.Name, dbFieldName); } } return(result); }