private object GetFieldValue(string fieldName) { if (!FieldNameAlreadyExists(fieldName)) { throw new Exception($"域名<{fieldName}>不存在"); } TableField field = FindTableFieldByName(fieldName); return(field.FieldValue); }
private void AddField(TableField field) { string fieldName = field.GetFieldName(); if (FieldNameAlreadyExists(fieldName)) { throw new Exception($"添加的域已经在列表中<{fieldName}>"); } _dataBaseFields.Add(field); }
private IEnumerable <TableField> GenerateTableFields() { var propertyInfoes = GetType().GetProperties(); foreach (PropertyInfo propertyInfo in propertyInfoes) { TableField field = TableField.Parse(propertyInfo, _databaseType); _tableFieldPropertyMap.AddMap(propertyInfo, field); yield return(field); } }
public IEnumerable <TableField> CreateTableFields() { var propertyInfos = _activeRecord.GetType().GetProperties(); foreach (PropertyInfo propertyInfo in propertyInfos) { TableField field = MapPropertyToTableField(propertyInfo); AddMap(propertyInfo, field); yield return(field); } }
public void SetDatabaseConnection(DatabaseType databaseType, string connectionStr) { _databaseType = databaseType; DbLinkFactory factory = DbLinkGateway.CreateFactory(databaseType); DatabaseDrive = factory.CreateDatabaseDrive(connectionStr); _dataBaseFields = new List <TableField>(); _tableFieldPropertyMap = new TableFieldPropertyMap(this); CreateTableFields(); _primaryKeyField = FindTableFieldByName(_primaryKeyName); }
private bool IsTheLastField(TableField field) => field == _dataBaseFields[_dataBaseFields.Count - 1];
public void AddMap(PropertyInfo info, TableField field) { _properties.Add(info); _tableFields.Add(field); }
private void SetFieldValue(string fieldName, object value) { TableField field = FindTableFieldByName(fieldName); field.SetValue(value); }
public PropertyFieldMap(ActiveRecord record, PropertyInfo propertyInfo, TableField field) { _record = record; _propertyInfo = propertyInfo; _field = field; }
private void AddMap(PropertyInfo info, TableField field) { PropertyFieldMap map = new PropertyFieldMap(_activeRecord, info, field); _maps.Add(map); }