コード例 #1
0
ファイル: ApiGraph.cs プロジェクト: rexwhitten/MGenerator
        internal string WriteApiStation(GenerationInfo GenInfo, Microsoft.SqlServer.Management.Smo.Database datab, Microsoft.SqlServer.Management.Smo.Table t, string RepositoryPath)
        {
            string module_folder_name = String.Format(@"{0}\Modules",RepositoryPath);
            string file_path = string.Format(@"{0}\{1}Module.cs", module_folder_name, t.Name);

            #region [ Build Module Folder Name ]
            if (Directory.Exists(module_folder_name) == false)
            {
                Directory.CreateDirectory(module_folder_name);
            }
            #endregion

            return "";
        }
コード例 #2
0
ファイル: BoundClass.cs プロジェクト: jonpryor/java.interop
        public BoundClass(ClassGen klass, CodeGenerationOptions opt, CodeGeneratorContext context, GenerationInfo generationInfo)
        {
            context.ContextTypes.Push(klass);
            context.ContextGeneratedMethods = new List <Method> ();

            generationInfo.TypeRegistrations.Add(new KeyValuePair <string, string> (klass.RawJniName, klass.AssemblyQualifiedName));

            var is_enum = klass.base_symbol != null && klass.base_symbol.FullName == "Java.Lang.Enum";

            if (is_enum)
            {
                generationInfo.Enums.Add(klass.RawJniName.Replace('/', '.') + ":" + klass.Namespace + ":" + klass.JavaSimpleName);
            }

            this.opt = opt;

            Name = klass.Name;

            SetVisibility(klass.Visibility);
            IsShadow   = klass.NeedsNew;
            IsAbstract = klass.IsAbstract;
            IsSealed   = klass.IsFinal;
            IsPartial  = true;

            UsePriorityOrder = true;

            AddImplementedInterfaces(klass);

            klass.JavadocInfo?.AddJavadocs(Comments);
            Comments.Add($"// Metadata.xml XPath class reference: path=\"{klass.MetadataXPathReference}\"");

            if (klass.IsDeprecated)
            {
                Attributes.Add(new ObsoleteAttr(klass.DeprecatedComment)
                {
                    WriteAttributeSuffix = true
                });
            }

            SourceWriterExtensions.AddSupportedOSPlatform(Attributes, klass, opt);

            Attributes.Add(new RegisterAttr(klass.RawJniName, null, null, true, klass.AdditionalAttributeString())
            {
                UseGlobal = true, UseShortForm = true
            });

            if (klass.TypeParameters != null && klass.TypeParameters.Any())
            {
                Attributes.Add(new CustomAttr(klass.TypeParameters.ToGeneratedAttributeString()));
            }

            // Figure out our base class
            string obj_type = null;

            if (klass.base_symbol != null)
            {
                obj_type = klass.base_symbol is GenericSymbol gs &&
                           gs.IsConcrete ? gs.GetGenericType(null) : opt.GetOutputName(klass.base_symbol.FullName);
            }

            if (klass.InheritsObject && obj_type != null)
            {
                Inherits = obj_type;
            }

            // Handle fields
            var seen = new HashSet <string> ();

            SourceWriterExtensions.AddFields(this, klass, klass.Fields, seen, opt, context);

            var ic = new InterfaceConstsClass(klass, seen, opt, context);

            if (ic.ShouldGenerate)
            {
                NestedTypes.Add(ic);
            }

            // Sibling classes
            if (!klass.AssemblyQualifiedName.Contains('/'))
            {
                foreach (InterfaceExtensionInfo nestedIface in klass.GetNestedInterfaceTypes())
                {
                    if (nestedIface.Type.Methods.Any(m => m.CanHaveStringOverload) || nestedIface.Type.Methods.Any(m => m.Asyncify))
                    {
                        sibling_types.Add(new InterfaceExtensionsClass(nestedIface.Type, nestedIface.DeclaringType, opt));
                    }
                }
            }

            if (klass.IsAbstract)
            {
                sibling_types.Add(new ClassInvokerClass(klass, opt));
            }

            AddNestedTypes(klass, opt, context, generationInfo);
            AddBindingInfrastructure(klass);
            AddConstructors(klass, opt, context);
            AddProperties(klass, opt);
            AddMethods(klass, opt, context);
            AddAbstractMembers(klass, opt, context);
            AddExplicitGenericInterfaceMembers(klass, opt);
            AddCharSequenceEnumerator(klass);

            context.ContextGeneratedMethods.Clear();
            context.ContextTypes.Pop();
        }
コード例 #3
0
ファイル: ClassBase.cs プロジェクト: knuxbbs/gapi
        protected void GenerateStructAbi(GenerationInfo generationInfo, IList <StructAbiField> fields,
                                         string infoName, string structName)
        {
            if (fields == null)
            {
                fields = AbiFields;
            }

            var logWriter = new LogWriter(QualifiedName);

            if (!CheckStructAbiParent(logWriter, out var csParentStruct))
            {
                return;
            }

            var streamWriter = generationInfo.Writer;

            streamWriter.WriteLine();
            streamWriter.WriteLine("\t\t// Internal representation of the wrapped structure ABI.");
            streamWriter.WriteLine($"\t\tstatic GLib.AbiStruct _{infoName} = null;");
            streamWriter.WriteLine(
                $"\t\tstatic public {(!string.IsNullOrEmpty(csParentStruct) ? "new " : "")}GLib.AbiStruct {infoName} {{");
            streamWriter.WriteLine("\t\t\tget {");
            streamWriter.WriteLine($"\t\t\t\tif (_{infoName} == null)");

            // Generate Tests
            var usingParentFields = false;

            if (fields.Count > 0)
            {
                streamWriter.WriteLine($"\t\t\t\t\t_{infoName} = new GLib.AbiStruct (new List<GLib.AbiField>{{ ");

                if (generationInfo.CAbiWriter != null)
                {
                    generationInfo.CAbiWriter.WriteLine(
                        "\tg_print(\"\\\"sizeof({0})\\\": \\\"%\" G_GUINT64_FORMAT \"\\\"\\n\", (guint64) sizeof({0}));",
                        structName);
                    generationInfo.AbiWriter.WriteLine(
                        "\t\t\tConsole.WriteLine(\"\\\"sizeof({0})\\\": \\\"\" + {1}.{2}.{3}.Size + \"\\\"\");",
                        structName, Namespace, Name, infoName);
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(csParentStruct))
                {
                    streamWriter.WriteLine("\t\t\t\t\t_{1} = new GLib.AbiStruct ({0}.{1}.Fields);", csParentStruct, infoName);
                    usingParentFields = true;
                }
                else
                {
                    streamWriter.WriteLine("\t\t\t\t\t_{0} = new GLib.AbiStruct (new List<GLib.AbiField>{{ ", infoName);
                }
            }

            StructAbiField previous = null;
            var            fieldAlignmentStructuresWriter = new StringWriter();

            for (var i = 0; i < fields.Count; i++)
            {
                var field = fields[i];
                var next  = fields.Count > i + 1 ? fields[i + 1] : null;

                previous = field.Generate(generationInfo, "\t\t\t\t\t", previous, next, csParentStruct,
                                          fieldAlignmentStructuresWriter);

                if (field is UnionAbiField || generationInfo.CAbiWriter == null || field.IsBitfield)
                {
                    continue;
                }

                generationInfo.CAbiWriter.WriteLine(
                    "\tg_print(\"\\\"{0}.{1}\\\": \\\"%\" G_GUINT64_FORMAT \"\\\"\\n\", (guint64) G_STRUCT_OFFSET({0}, {1}));",
                    structName, field.CName);
                generationInfo.AbiWriter.WriteLine(
                    "\t\t\tConsole.WriteLine(\"\\\"{0}.{3}\\\": \\\"\" + {1}.{2}.{4}.GetFieldOffset(\"{3}\") + \"\\\"\");",
                    structName, Namespace, Name, field.CName, infoName);
            }

            if (fields.Count > 0 && generationInfo.CAbiWriter != null)
            {
                generationInfo.AbiWriter.Flush();
                generationInfo.CAbiWriter.Flush();
            }

            if (!usingParentFields)
            {
                streamWriter.WriteLine("\t\t\t\t\t});");
            }

            streamWriter.WriteLine();
            streamWriter.WriteLine($"\t\t\t\treturn _{infoName};");
            streamWriter.WriteLine("\t\t\t}");
            streamWriter.WriteLine("\t\t}");
            streamWriter.WriteLine();

            streamWriter.WriteLine(fieldAlignmentStructuresWriter.ToString());
            streamWriter.WriteLine("\t\t// End of the ABI representation.");
            streamWriter.WriteLine();
        }
コード例 #4
0
 public WebConfigGenerator(string ns, string name, GenerationInfo generationInfo) : base(ns, name, generationInfo)
 {
 }
コード例 #5
0
ファイル: CodeGenerator.cs プロジェクト: 00mjk/java.interop
        static void Run(CodeGeneratorOptions options, DirectoryAssemblyResolver resolver)
        {
            string assemblyQN              = options.AssemblyQualifiedName;
            string api_level               = options.ApiLevel;
            int    product_version         = options.ProductVersion;
            bool   preserve_enums          = options.PreserveEnums;
            string csdir                   = options.ManagedCallableWrapperSourceOutputDirectory ?? "cs";
            string javadir                 = "java";
            string enumdir                 = options.EnumOutputDirectory ?? "enum";
            string enum_metadata           = options.EnumMetadataOutputFile ?? "enummetadata";
            var    references              = options.AssemblyReferences;
            string enum_fields_map         = options.EnumFieldsMapFile;
            string enum_flags              = options.EnumFlagsFile;
            string enum_methods_map        = options.EnumMethodsMapFile;
            var    fixups                  = options.FixupFiles;
            var    annotations_zips        = options.AnnotationsZipFiles;
            string filename                = options.ApiDescriptionFile;
            string mapping_file            = options.MappingReportFile;
            bool   only_xml_adjuster       = options.OnlyRunApiXmlAdjuster;
            string api_xml_adjuster_output = options.ApiXmlAdjusterOutput;
            var    apiSource               = "";
            var    opt = new CodeGenerationOptions()
            {
                ApiXmlFile                     = options.ApiDescriptionFile,
                CodeGenerationTarget           = options.CodeGenerationTarget,
                UseGlobal                      = options.GlobalTypeNames,
                IgnoreNonPublicType            = true,
                UseShortFileNames              = options.UseShortFileNames,
                ProductVersion                 = options.ProductVersion,
                SupportInterfaceConstants      = options.SupportInterfaceConstants,
                SupportDefaultInterfaceMethods = options.SupportDefaultInterfaceMethods,
                SupportNestedInterfaceTypes    = options.SupportNestedInterfaceTypes,
                SupportNullableReferenceTypes  = options.SupportNullableReferenceTypes,
            };
            var resolverCache = new TypeDefinitionCache();

            // Load reference libraries

            foreach (var lib in options.LibraryPaths)
            {
                resolver.SearchDirectories.Add(lib);
            }
            foreach (var reference in references)
            {
                resolver.SearchDirectories.Add(Path.GetDirectoryName(reference));
            }

            // Figure out if this is class-parse
            string apiXmlFile    = filename;
            string apiSourceAttr = null;

            using (var xr = XmlReader.Create(filename, new XmlReaderSettings {
                XmlResolver = null
            })) {
                xr.MoveToContent();
                apiSourceAttr = xr.GetAttribute("api-source");
            }

            // We don't use shallow referenced types with class-parse because the Adjuster process
            // enumerates every ctor/method/property/field to build its model, so we will need
            // every type to be fully populated.
            opt.UseShallowReferencedTypes = apiSourceAttr != "class-parse";

            foreach (var reference in references.Distinct())
            {
                try {
                    Report.Verbose(0, "resolving assembly {0}.", reference);
                    var assembly = resolver.Load(reference);
                    foreach (var md in assembly.Modules)
                    {
                        foreach (var td in md.Types)
                        {
                            // FIXME: at some stage we want to import generic types.
                            // For now generator fails to load generic types that have conflicting type e.g.
                            // AdapterView`1 and AdapterView cannot co-exist.
                            // It is mostly because generator primarily targets jar (no real generics land).
                            var nonGenericOverload = td.HasGenericParameters
                                                                ? md.GetType(td.FullName.Substring(0, td.FullName.IndexOf('`')))
                                                                : null;
                            if (BindSameType(td, nonGenericOverload, resolverCache))
                            {
                                continue;
                            }
                            ProcessReferencedType(td, opt);
                        }
                    }
                } catch (Exception ex) {
                    Report.LogCodedWarning(0, Report.WarningAssemblyParseFailure, ex, reference, ex.Message);
                }
            }

            // For class-parse API description, transform it to jar2xml style.
            if (apiSourceAttr == "class-parse")
            {
                apiXmlFile = api_xml_adjuster_output ?? Path.Combine(Path.GetDirectoryName(filename), Path.GetFileName(filename) + ".adjusted");
                new Adjuster().Process(filename, opt, opt.SymbolTable.AllRegisteredSymbols(opt).OfType <GenBase> ().ToArray(), apiXmlFile, Report.Verbosity ?? 0);
            }
            if (only_xml_adjuster)
            {
                return;
            }

            // load XML API definition with fixups.

            Dictionary <string, EnumMappings.EnumDescription> enums = null;

            EnumMappings enummap = null;

            if (enum_fields_map != null || enum_methods_map != null)
            {
                enummap = new EnumMappings(enumdir, enum_metadata, api_level, preserve_enums);
                enums   = enummap.Process(enum_fields_map, enum_flags, enum_methods_map);
                fixups.Add(enum_metadata);
            }

            Parser         p    = new Parser(opt);
            List <GenBase> gens = p.Parse(apiXmlFile, fixups, api_level, product_version);

            if (gens == null)
            {
                return;
            }
            apiSource = p.ApiSource;

            // disable interface default methods here, especially before validation.
            gens = gens.Where(g => !g.IsObfuscated && g.Visibility != "private").ToList();
            foreach (var gen in gens)
            {
                gen.StripNonBindables(opt);
                if (gen.IsGeneratable)
                {
                    AddTypeToTable(opt, gen);
                }
            }

            // Apply fixups
            KotlinFixups.Fixup(gens);

            Validate(gens, opt, new CodeGeneratorContext());

            foreach (var api_versions_xml in options.ApiVersionsXmlFiles)
            {
                ApiVersionsSupport.AssignApiLevels(gens, api_versions_xml);
            }

            foreach (GenBase gen in gens)
            {
                gen.FillProperties();
            }

            var cache = new AncestorDescendantCache(gens);

            foreach (var gen in gens)
            {
                gen.UpdateEnums(opt, cache);
            }

            foreach (GenBase gen in gens)
            {
                gen.FixupMethodOverrides(opt);
            }

            foreach (GenBase gen in gens)
            {
                gen.FixupExplicitImplementation();
            }

            SealedProtectedFixups.Fixup(gens);

            GenerateAnnotationAttributes(gens, annotations_zips);

            //SymbolTable.Dump ();

            GenerationInfo gen_info = new GenerationInfo(csdir, javadir, assemblyQN);

            opt.AssemblyName = gen_info.Assembly;

            if (mapping_file != null)
            {
                GenerateMappingReportFile(gens, mapping_file);
            }

            foreach (IGeneratable gen in gens)
            {
                if (gen.IsGeneratable)
                {
                    gen.Generate(opt, gen_info);
                }
            }

            new NamespaceMapping(gens).Generate(opt, gen_info);


            ClassGen.GenerateTypeRegistrations(opt, gen_info);
            ClassGen.GenerateEnumList(gen_info);

            // Create the .cs files for the enums
            var enumFiles = enums == null
                                ? null
                                : enummap.WriteEnumerations(enumdir, enums, FlattenNestedTypes(gens).ToArray(), opt.UseShortFileNames);

            gen_info.GenerateLibraryProjectFile(options, enumFiles);
        }
コード例 #6
0
ファイル: ClassBase.cs プロジェクト: knuxbbs/gapi
 protected void GenerateStructAbi(GenerationInfo generationInfo)
 {
     GenerateStructAbi(generationInfo, null, "abi_info", CName);
 }
コード例 #7
0
ファイル: BoundInterface.cs プロジェクト: 00mjk/java.interop
 void AddNestedSiblingTypes(InterfaceGen iface, CodeGenerationOptions opt, CodeGeneratorContext context, GenerationInfo genInfo)
 {
     // Generate sibling types for nested types we don't want to nest
     foreach (var nest in iface.NestedTypes.Where(t => t.Unnest))
     {
         pre_sibling_types.Add(SourceWriterExtensions.BuildManagedTypeModel(nest, opt, context, genInfo));
     }
 }
コード例 #8
0
ファイル: BoundInterface.cs プロジェクト: 00mjk/java.interop
 void AddNestedTypes(InterfaceGen iface, CodeGenerationOptions opt, CodeGeneratorContext context, GenerationInfo genInfo)
 {
     // Generate nested types for supported nested types.  This is a new addition in C#8.
     // Prior to this, types nested in an interface had to be generated as sibling types.
     // The "Unnest" property is used to support backwards compatibility with pre-C#8 bindings.
     foreach (var nest in iface.NestedTypes.Where(t => !t.Unnest))
     {
         NestedTypes.Add(SourceWriterExtensions.BuildManagedTypeModel(nest, opt, context, genInfo));
     }
 }
コード例 #9
0
ファイル: BoundInterface.cs プロジェクト: 00mjk/java.interop
        public BoundInterface(InterfaceGen iface, CodeGenerationOptions opt, CodeGeneratorContext context, GenerationInfo genInfo)
        {
            context.ContextTypes.Push(iface);

            Name = iface.Name;

            AddNestedSiblingTypes(iface, opt, context, genInfo);
            AddAlternativesClass(iface, opt, context);

            // If this interface is just fields and we can't generate any of them
            // then we don't need to write the interface.  We still keep this type
            // because it may have nested types or need an InterfaceMemberAlternativeClass.
            if (iface.IsConstSugar && iface.GetGeneratableFields(opt).Count() == 0)
            {
                dont_generate = true;
                return;
            }

            IsPartial = true;

            UsePriorityOrder = true;

            SetVisibility(iface.Visibility);

            Comments.Add($"// Metadata.xml XPath interface reference: path=\"{iface.MetadataXPathReference}\"");

            if (iface.IsDeprecated)
            {
                Attributes.Add(new ObsoleteAttr(iface.DeprecatedComment)
                {
                    WriteAttributeSuffix = true, WriteEmptyString = true
                });
            }

            if (!iface.IsConstSugar)
            {
                var signature = string.IsNullOrWhiteSpace(iface.Namespace)
                                        ? iface.FullName.Replace('.', '/')
                                        : iface.Namespace + "." + iface.FullName.Substring(iface.Namespace.Length + 1).Replace('.', '/');

                Attributes.Add(new RegisterAttr(iface.RawJniName, string.Empty, signature + "Invoker", additionalProperties: iface.AdditionalAttributeString()));
            }

            if (iface.TypeParameters != null && iface.TypeParameters.Any())
            {
                Attributes.Add(new CustomAttr(iface.TypeParameters.ToGeneratedAttributeString()));
            }

            AddInheritedInterfaces(iface, opt);

            AddClassHandle(iface, opt);
            AddFields(iface, opt, context);
            AddProperties(iface, opt);
            AddMethods(iface, opt);
            AddNestedTypes(iface, opt, context, genInfo);

            // If this interface is just constant fields we don't need to add all the invoker bits
            if (iface.IsConstSugar)
            {
                return;
            }

            if (!iface.AssemblyQualifiedName.Contains('/'))
            {
                if (iface.Methods.Any(m => m.CanHaveStringOverload) || iface.Methods.Any(m => m.Asyncify))
                {
                    post_sibling_types.Add(new InterfaceExtensionsClass(iface, null, opt));
                }
            }

            post_sibling_types.Add(new InterfaceInvokerClass(iface, opt, context));

            AddInterfaceEventHandler(iface, opt, context);

            context.ContextTypes.Pop();
        }
コード例 #10
0
 protected Modelable(GenerationInfo generationInfo, T modelParameters) : base(generationInfo)
 {
     ModelParameters = modelParameters;
 }
コード例 #11
0
        /// <summary>
        /// Generates Data Access, Mapping and Transfer Code from the Database
        /// </summary>
        /// <param name="FolderPath"></param>
        /// <param name="ServerName"></param>
        /// <param name="DatabaseName"></param>
        public static void GenerateFromDatabase(GenerationInfo GenInfo)
        {
            DirectoryInfo d = new DirectoryInfo(GenInfo.FolderPath);

            Microsoft.SqlServer.Management.Common.ServerConnection svrCon = new Microsoft.SqlServer.Management.Common.ServerConnection(GenInfo.ServerName);
            Server svr = new Server(svrCon);

            String DbScriptsPath = GenInfo.FolderPath + @"\Procedures";

            foreach (Microsoft.SqlServer.Management.Smo.Database datab in svr.Databases)
            {
                if (datab.IsAccessible)
                {
                    if (!(DatabasesToIgnore().Contains(datab.Name)))
                    {
                        if (datab.Name.ToLower() == GenInfo.DataBase.ToLower())
                        {
                            Console.Write("Generating Code for Database: " + datab.Name + "\n");
                            String RepositoryPath     = GenInfo.FolderPath + @"\" + datab.Name; // The Current Repository
                            String DataLayerNamespace = String.Format("{0}.{1}.{2}", GenInfo.CompanyName, GenInfo.DataNameSpace, datab.Name);

                            #region [ Clean / Create Directory ]
                            if (Directory.Exists(RepositoryPath))
                            {
                                // Directory Exists clean it out
                                DirectoryInfo dRepository = new DirectoryInfo(RepositoryPath);
                                foreach (FileInfo f in dRepository.GetFiles("*.*", SearchOption.AllDirectories))
                                {
                                    f.Delete();
                                }
                            }
                            else
                            {
                                Directory.CreateDirectory(RepositoryPath);
                            }
                            #endregion

                            #region [ Tables ]
                            String RepositoryPathProcedures = RepositoryPath + @"\Procedures";

                            if (Directory.Exists(RepositoryPathProcedures))
                            {
                                Directory.Delete(RepositoryPathProcedures);
                            }
                            Directory.CreateDirectory(RepositoryPathProcedures);
                            Int32         GenerationStep = 0;
                            DALGenerator  dg             = new DALGenerator();
                            POCOGenerator pg             = new POCOGenerator();

                            foreach (Table t in datab.Tables)
                            {
                                GenerationStep = 0;
                                try
                                {
                                    if (t.Name == "Loan")
                                    {
                                        "$".IsNormalized();
                                    }
                                    if (!(t.IsSystemObject))
                                    {
                                        // Check if the table has a primary key, if not then dont generate anything. Table muist be normalized
                                        if (ValidateSqlTable(t))
                                        {
                                            #region [ Generation Root ]
                                            String cpFilename     = RepositoryPathProcedures + @"\\" + "cp_" + t.Name + ".sql";
                                            String sspFileName    = RepositoryPathProcedures + @"\\" + "ssp_" + t.Name + ".sql";
                                            String EntityFileName = RepositoryPath + @"\\" + t.Name + ".cs";
                                            String DALFileName    = RepositoryPath + @"\\" + t.Name + "DAL.cs";
                                            String DOMFileName    = RepositoryPath + @"\\" + t.Name + "DomainObject.cs";

                                            GenerationStep = 1;
                                            // [0]  Stored Procedures
                                            MGenerator.Tools.SqlGeneration.CrudProcedureGenerator gen = new SqlGeneration.CrudProcedureGenerator(datab, t);
                                            gen.Generate(RepositoryPathProcedures, MGenerator.Tools.SqlGeneration.ProcedureGenerationType.Alter);
                                            GenerationStep = 2;

                                            ObjectiveSearchProcedureGenerator ospgen = new ObjectiveSearchProcedureGenerator(datab, t);
                                            ospgen.Generate(RepositoryPathProcedures);
                                            GenerationStep = 3;


                                            // [1]  Data Access Classes
                                            WriteCsharpFile(GenInfo.CompanyName, GenInfo.DataNameSpace, datab.Name, RepositoryPath, dg.BuildDalClass(String.Format("{0}.{1}", GenInfo.CompanyName, GenInfo.DataNameSpace), datab.Name, t));
                                            GenerationStep = 4;

                                            // [2] Entity / Structure Class
                                            WriteCsharpFile(GenInfo.CompanyName, GenInfo.DataNameSpace, datab.Name, RepositoryPath, pg.BuildPoc(t));
                                            GenerationStep = 5;

                                            // [3]  Service Layer
                                            DomainServiceGraph svcgen = new DomainServiceGraph();
                                            WriteCsharpFile(GenInfo.CompanyName, GenInfo.DataNameSpace, datab.Name, RepositoryPath, svcgen.BuildDomainObject(String.Format("{0}.{1}", GenInfo.CompanyName, GenInfo.DataNameSpace), datab.Name, t));
                                            GenerationStep = 6;

                                            // [4] API
                                            ApiGraph api      = new ApiGraph();
                                            string   api_name =
                                                api.WriteApiStation(GenInfo, datab, t, RepositoryPath);
                                            #endregion

                                            Console.Write(t.Name + "....COMPLETE" + "\n");
                                        }
                                    }
                                }
                                catch (Exception x)
                                {
                                    Console.Write(t.Name + "....ERROR" + "\n");
                                    // File.WriteAllText(RepositoryPath + t.Name + ".txt", x.Message + "\n Generation Step:" + GenerationStep.ToString() );
                                    continue;
                                }
                            }
                            #endregion

                            #region [ Views ]
                            foreach (View view in datab.Views)
                            {
                                try
                                {
                                    if (view.Name == "vwLOLicense")
                                    {
                                        String fd = "";
                                    }
                                    if (!(view.IsSystemObject))
                                    {
                                        if (ValidateSqlView(view))
                                        {
                                            ObjectiveSearchProcedureGenerator ospgen = new ObjectiveSearchProcedureGenerator(datab, view);
                                            DomainServiceGraph svcgen = new DomainServiceGraph();
                                            ospgen.Generate(RepositoryPathProcedures);
                                            WriteCsharpFile(GenInfo.CompanyName, GenInfo.DataNameSpace, datab.Name, RepositoryPath, dg.BuildDalClass(String.Format("{0}.{1}", GenInfo.CompanyName, GenInfo.DataNameSpace), datab.Name, view));
                                            WriteCsharpFile(GenInfo.CompanyName, GenInfo.DataNameSpace, datab.Name, RepositoryPath, pg.BuildPoco(view));
                                            WriteCsharpFile(GenInfo.CompanyName, GenInfo.DataNameSpace, datab.Name, RepositoryPath, svcgen.BuildDomainObject(String.Format("{0}.{1}", GenInfo.CompanyName, GenInfo.DataNameSpace), datab.Name, view));
                                            Console.Write(view.Name + "....COMPLETE" + "\n");
                                        }
                                    }
                                }
                                catch (Exception x)
                                {
                                    Console.Write(view.Name + "....ERROR" + "\n");
                                    continue;
                                }
                            }
                            #endregion
                        }
                    }
                }
            }
        }