Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public FieldsAndValues MakeEmptyFields()
        {
            var result = new FieldsAndValues();

            foreach (var property in ModelType.GetProperties())
            {
                if (!CheckDbProperty(property))
                {
                    continue;
                }
                if (CheckAutoIncrement(property))
                {
                    continue;
                }

                var dbField = GetFieldName(property);
                result.Add(property.Name, dbField);
            }
            return(result);
        }