Ejemplo n.º 1
0
        public void GenerateDataContext()
        {
            string path = project.PathFiles + "CodeHelper/" + project.InfraLayer + "/Data/Context/";
            DirectoryInfo di = new DirectoryInfo(path);
            if (!di.Exists)
            {
                di.Create();
            }

            DataContext dc = new DataContext();

            dc.Project = project;
            StreamWriter linhas = new StreamWriter(path + project.DataContext + ".cs");
            linhas.Write(dc.TransformText());
            linhas.Close();

            UnitOfWork uow = new UnitOfWork();

            uow.Project = project;
            uow.Interface = false;
            linhas = new StreamWriter(path + "UnitOfWork.cs");
            linhas.Write(uow.TransformText());
            linhas.Close();

            uow = new UnitOfWork();
            uow.Project = project;
            uow.Interface = true;
            linhas = new StreamWriter(path + "IUnitOfWork.cs");
            linhas.Write(uow.TransformText());
            linhas.Close();

            path = project.PathFiles + "CodeHelper/" + project.InfraLayer + "/Data/" + project.RepositoryPlural + "/";
            di = new DirectoryInfo(path);
            if (!di.Exists)
            {
                di.Create();
            }

            RepositoryGeneric rb = new RepositoryGeneric();
            rb.Project = project;
            linhas = new StreamWriter(path + project.RepositoryClass + project.RepositoryBase + ".cs");
            linhas.Write(rb.TransformText());
            linhas.Close();


            path = project.PathFiles + "CodeHelper/" + project.DomainLayer + "/Interfaces/" + project.RepositoryPlural + "/";
            di = new DirectoryInfo(path);
            if (!di.Exists)
            {
                di.Create();
            }

            IRepositoryGeneric irb = new IRepositoryGeneric();
            irb.Project = project;
            linhas = new StreamWriter(path + "I" + project.RepositoryClass + project.RepositoryBase + ".cs");
            linhas.Write(irb.TransformText());
            linhas.Close();


            path = project.PathFiles + "CodeHelper/" + project.DomainLayer + "/Interfaces/" + project.ServicePlural + "/";
            di = new DirectoryInfo(path);
            if (!di.Exists)
            {
                di.Create();
            }

            IServiceGeneric isg = new IServiceGeneric();
            isg.Project = project;
            linhas = new StreamWriter(path + "I" + project.ServiceClass + project.ServiceBase + ".cs");
            linhas.Write(isg.TransformText());
            linhas.Close();


            path = project.PathFiles + "CodeHelper/" + project.DomainLayer + "/" + project.ServicePlural + "/";
            di = new DirectoryInfo(path);
            if (!di.Exists)
            {
                di.Create();
            }


            ServiceGeneric sg = new ServiceGeneric();
            sg.Project = project;
            linhas = new StreamWriter(path + project.ServiceClass + project.ServiceBase + ".cs");
            linhas.Write(sg.TransformText());
            linhas.Close();

            path = project.PathFiles + "CodeHelper/" + project.ApplicationLayer + "/Interfaces/";
            di = new DirectoryInfo(path);
            if (!di.Exists)
            {
                di.Create();
            }

            IAppServiceGeneric iasg = new IAppServiceGeneric();
            iasg.Project = project;
            linhas = new StreamWriter(path + "I" + project.ApplicationClass + project.ApplicationBase + ".cs");
            linhas.Write(iasg.TransformText());
            linhas.Close();


            path = project.PathFiles + "CodeHelper/" + project.ApplicationLayer + "/" + project.ApplicationPlural + "/";
            di = new DirectoryInfo(path);
            if (!di.Exists)
            {
                di.Create();
            }


            AppServiceGeneric asg = new AppServiceGeneric();
            asg.Project = project;
            linhas = new StreamWriter(path + project.ApplicationClass + project.ApplicationBase + ".cs");
            linhas.Write(asg.TransformText());
            linhas.Close();


        }