Ejemplo n.º 1
0
        private static StringBuilder GetTextLine(FinalParameter fp)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("\t" + Singleton <Condition> .Instance.EntityAccessType + " " + fp.EntityType + " " + fp.ColumnName + " {get;set;}\r\n");
            return(sb);
        }
Ejemplo n.º 2
0
        private static StringBuilder GetDataAnnotation(FinalParameter fp)
        {
            StringBuilder sb = new StringBuilder();

            if (!fp.IsNullable)
            {
                sb.Append("\t[Required]\r\n");
            }
            if (fp.EntityType.Contains("string") && fp.DALLength > 0)
            {
                sb.Append("\t[StringLength(maximumLength: " + fp.DALLength + ", ErrorMessage = \"长度不能超过" + fp.DALLength + "\")]\r\n");
            }
            sb.Append("\t[DisplayName(\"" + fp.Description + "\")]\r\n");
            return(sb);
        }
Ejemplo n.º 3
0
        public static void GetFinalParameter()
        {
            foreach (string choose in Singleton <Condition> .Instance.ChoosenParameters)
            {
                OriginalParameter op = Singleton <Condition> .Instance.ALLParameters.Find(o => o.ColumnName == choose);

                FinalParameter fp = new FinalParameter();
                fp.IsNullable  = op.IsNullable;
                fp.ColumnName  = op.ColumnName;
                fp.DALType     = GetType(op.DataType);
                fp.DALLength   = DealParameterLength(fp.DALType, op.MaxLength);
                fp.EntityType  = GetEntityType(op.DataType, fp.IsNullable);
                fp.ProcLength  = ProcLength(fp.DALType, op.MaxLength);
                fp.Description = op.Description;
                Singleton <Condition> .Instance.FinalParameters.Add(fp);
            }
        }