Пример #1
0
        private object GetFieldValue(string fieldName)
        {
            if (!FieldNameAlreadyExists(fieldName))
            {
                throw new Exception($"域名<{fieldName}>不存在");
            }
            TableField field = FindTableFieldByName(fieldName);

            return(field.FieldValue);
        }
Пример #2
0
        private void AddField(TableField field)
        {
            string fieldName = field.GetFieldName();

            if (FieldNameAlreadyExists(fieldName))
            {
                throw new Exception($"添加的域已经在列表中<{fieldName}>");
            }

            _dataBaseFields.Add(field);
        }
Пример #3
0
        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);
            }
        }
Пример #4
0
        public IEnumerable <TableField> CreateTableFields()
        {
            var propertyInfos = _activeRecord.GetType().GetProperties();

            foreach (PropertyInfo propertyInfo in propertyInfos)
            {
                TableField field = MapPropertyToTableField(propertyInfo);
                AddMap(propertyInfo, field);
                yield return(field);
            }
        }
Пример #5
0
        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);
        }
Пример #6
0
 private bool IsTheLastField(TableField field) => field == _dataBaseFields[_dataBaseFields.Count - 1];
Пример #7
0
 public void AddMap(PropertyInfo info, TableField field)
 {
     _properties.Add(info);
     _tableFields.Add(field);
 }
Пример #8
0
        private void SetFieldValue(string fieldName, object value)
        {
            TableField field = FindTableFieldByName(fieldName);

            field.SetValue(value);
        }
Пример #9
0
 public PropertyFieldMap(ActiveRecord record, PropertyInfo propertyInfo, TableField field)
 {
     _record       = record;
     _propertyInfo = propertyInfo;
     _field        = field;
 }
Пример #10
0
        private void AddMap(PropertyInfo info, TableField field)
        {
            PropertyFieldMap map = new PropertyFieldMap(_activeRecord, info, field);

            _maps.Add(map);
        }