Exemple #1
0
        public void CreateClass()
        {
            ClassTableName ctname = new ClassTableName(tableName)
            {
                Option = Option
            };

            ClassName cname = new ClassName(Option.NameSpace, Option.Modifier, ctname);

            ITable schema = new TableSchema(tableName);

            var dpoClass = new DpoClass(schema, cname, Option);

            var sourceCode = dpoClass.Generate(cname.Modifier, ctname);

            string fileName = string.Format("{0}\\{1}.cs", Option.OutputPath, cname.Class);

            if (!Directory.Exists(Option.OutputPath))
            {
                Directory.CreateDirectory(Option.OutputPath);
            }

            StreamWriter sw = new StreamWriter(fileName);
            sw.Write(sourceCode);
            sw.Close();
        }
Exemple #2
0
        public DpoClass(ITable metaTable, ClassName cname, DpoOption option)
        {
            this.metaTable = metaTable;

            this.nameSpace = cname.Namespace;
            this.className = cname.Class;

            this.option = option;

            this.code = new CSharpBuilder { nameSpace = cname.Namespace, };

            code.AddUsing("System");
            code.AddUsing("System.Collections.Generic");
            code.AddUsing("System.Text");
            code.AddUsing("System.Data");
            code.AddUsing("System.Drawing");
            code.AddUsing("Sys.Data");
            code.AddUsing("Sys.Data.Manager");

            clss = new Class(cname.Class, new CodeBuilder.TypeInfo { type = typeof(DPObject) })
            {
                modifier = Modifier.Public | Modifier.Partial,
                Sorted = option.CodeSorted
            };

            this.code.AddClass(clss);

            nonvalized = NonvalizedList(nameSpace, className);
            nullableFields = NullableList(nameSpace, className);
        }