Exemplo n.º 1
0
        internal override void Start()
        {
            foreach (var item in dataList)
            {
                Data = item;
                var codeDom = Render();

                var filePath = $"{Path}/{item.Class}{FileExtension}";

                if (!WriteToFile(filePath, codeDom))
                {
                    Console.WriteLine("It can be not write to file!");
                }
            }
        }
        /// <summary>
        /// Create the template output
        /// </summary>
        public virtual string TransformText()
        {
            this.Write("\r\n");
            this.Write("\r\n");
            this.Write("\r\n");
            this.Write("\r\n");
            this.Write("\r\n\r\n");

            #line 18 "C:\workgit\oyasar.codegenerator\OYASAR.CodeGenerator.Lib\TextTemplate\DataAccessConfTemplate.tt"
            DataAccessConf model = DataAccessConfManager.Data;

            #line default
            #line hidden
            this.Write("\r\n\r\nusing Microsoft.EntityFrameworkCore;\r\nusing Microsoft.EntityFrameworkCore.Met" +
                       "adata.Builders;\r\n\r\nnamespace ");

            #line 24 "C:\workgit\oyasar.codegenerator\OYASAR.CodeGenerator.Lib\TextTemplate\DataAccessConfTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(model.NameSpace));

            #line default
            #line hidden
            this.Write("\r\n{\r\n    internal partial class ");

            #line 26 "C:\workgit\oyasar.codegenerator\OYASAR.CodeGenerator.Lib\TextTemplate\DataAccessConfTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(model.Class));

            #line default
            #line hidden
            this.Write("Conf : IEntityTypeConfiguration<");

            #line 26 "C:\workgit\oyasar.codegenerator\OYASAR.CodeGenerator.Lib\TextTemplate\DataAccessConfTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(model.Class));

            #line default
            #line hidden
            this.Write(">\r\n    {\r\n        public virtual void Configure(EntityTypeBuilder<");

            #line 28 "C:\workgit\oyasar.codegenerator\OYASAR.CodeGenerator.Lib\TextTemplate\DataAccessConfTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(model.Class));

            #line default
            #line hidden
            this.Write("> builder)\r\n        {\r\n          //  builder.HasOne(x => x.Country)\r\n          //" +
                       "         .WithMany()\r\n          //         .HasForeignKey(y => y.CountryID);\r\n  " +
                       "      }\r\n    }\r\n}\r\n");
            return(this.GenerationEnvironment.ToString());
        }