Ejemplo n.º 1
0
        //public OracleDbType DbType
        //{
        //    get
        //    {
        //        switch (this.Type)
        //        {
        //            case FieldItemType.FLOAT:
        //            case FieldItemType.NUMBER:
        //                return OracleDbType.Decimal;
        //            case FieldItemType.NVARCHAR2:
        //                return OracleDbType.NVarchar2;
        //            case FieldItemType.VARCHAR2:
        //                return OracleDbType.Varchar2;
        //            case FieldItemType.DATE:
        //                return OracleDbType.Date;
        //            default:
        //                throw new NotImplementedException("该数据类型未实现");
        //        }
        //    }
        //}
        #endregion
        #endregion

        #region Constructors
        public DDLEntityFieldItem(Match match)
        {
            //对象字段赋值
            string        title    = match.Groups[1].ToString();
            FieldItemType type     = (FieldItemType)Enum.Parse(typeof(FieldItemType), match.Groups[2].ToString());
            int           length   = 0;
            int           accuracy = 0;

            if (match.Groups[3].ToString() != "")
            {
                string   laValues = match.Groups[3].ToString().Trim('(', ')', ' ');
                string[] values   = laValues.Split(',');
                length = int.Parse(values[0]);
                if (values.Length > 1)
                {
                    accuracy = int.Parse(values[1]);
                }
            }
            string defaultValue = match.Groups[4].ToString();

            if (defaultValue != "")
            {
                defaultValue = defaultValue.Substring(9);
            }
            bool nullable = string.IsNullOrEmpty(match.Groups[5].ToString());

            Init(title, false, type, length, accuracy, defaultValue, nullable);
        }
Ejemplo n.º 2
0
 public DBFieldItem(string title, bool isPrimaryKey, FieldItemType type, int length, int accuracy, bool nullable, string defaultValue = null)
 {
     this.Title        = title;
     this.IsPrimaryKey = isPrimaryKey;
     this.Type         = type;
     this.Length       = length;
     this.Accuracy     = accuracy;
     this.Nullable     = nullable;
     this.DefaultValue = defaultValue;
 }
Ejemplo n.º 3
0
 private void Init(string title, bool isPrimaryKey, FieldItemType type, int length, int accuracy, string defaultValue, bool nullable)
 {
     this.Title        = title;
     this.IsPrivateKey = isPrimaryKey;
     this.Type         = type;
     this.Length       = length;
     this.Accuracy     = accuracy;
     this.DefaultValue = defaultValue;
     this.Nullable     = nullable;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 通过标准参数生成DbParameter
 /// </summary>
 public abstract DbParameter GetParameter(object value, string title, FieldItemType type);
Ejemplo n.º 5
0
 public DDLEntityFieldItem(string title, bool isPrimaryKey, FieldItemType type, int length, int accuracy, string defaultValue, bool nullable)
 {
     Init(title, isPrimaryKey, type, length, accuracy, defaultValue, nullable);
 }