Beispiel #1
0
        protected void GenerateEntities()
        {
            var tables = TablesToGenerate.ToList();

            tables.ForEach(table =>
            {
                GenerateEntityInterface(table);
                GenerateEntity(table);
                GenerateModelInterface(table);
                GenerateModel(table);
                GenerateModelExtensions(table);
            });

            // generate foreign keys and navigation properties.
            tables.ForEach(table =>
            {
                GenerateForeignKeys(table);
                GenerateOneToOnes(table);
                GenerateHasMany(table);
                GenerateManyToMany(table);
            });
        }
        protected void GenerateEntities()
        {
            var tables = TablesToGenerate.ToList();

            tables.ForEach(table =>
            {
                if (Options.OutputToSingleFile)
                {
                    GenerationContext.SingleFile(fb =>
                    {
                        var filePath = $"{Options.OutputDir}{Path.DirectorySeparatorChar}{Options.OutputSingleFileName}";
                        fb.Path(filePath);

                        GenerateEntityInterface(table, fb);
                        GenerateEntity(table, fb);
                        GenerateModelInterface(table, fb);
                        GenerateModel(table, fb);
                    });
                }
                else
                {
                    GenerationContext
                    .FileIfPathIsSet(fb => GenerateEntityInterface(table, fb))
                    .FileIfPathIsSet(fb => GenerateEntity(table, fb))
                    .FileIfPathIsSet(fb => GenerateModelInterface(table, fb))
                    .FileIfPathIsSet(fb => GenerateModel(table, fb));
                }
            });

            // generate foreign keys and navigation properties.
            tables.ForEach(table =>
            {
                GenerateForeignKeys(table);
                GenerateOneToOnes(table);
                GenerateHasMany(table);
                GenerateManyToMany(table);
            });
        }