public static string MakeAuditFields(TableInfo tableInfo, Info item, string textTemplateAudit, DefineTemplateFolder defineTemplateFolder)
        {
            var pathTemplateAudit = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, defineTemplateFolder.Define(tableInfo), DefineTemplateName.ModelsAudit(tableInfo));

            if (string.IsNullOrEmpty(textTemplateAudit))
            {
                textTemplateAudit = Read.AllText(tableInfo, pathTemplateAudit, defineTemplateFolder);
            }

            textTemplateAudit = textTemplateAudit.Replace("<#className#>", tableInfo.ClassName);

            if (item.PropertyName == "UserCreateId" || item.PropertyName == "UserAlterId")
            {
                var cast = String.Format("({0})userId", TypeConvertCSharp.Convert(item.TypeOriginal, item.IsNullable));

                if (item.PropertyName == "UserCreateId")
                {
                    textTemplateAudit = textTemplateAudit.Replace("<#propertCastInsert#>", cast);
                }

                if (item.PropertyName == "UserAlterId")
                {
                    textTemplateAudit = textTemplateAudit.Replace("<#propertCastUpdate#>", cast);
                }
            }
            return(textTemplateAudit);
        }
Example #2
0
        private void ExecuteTemplateApiMore(TableInfo tableInfo, Context configContext, IEnumerable <Info> infos)
        {
            var pathOutput = PathOutput.PathOutputApiMore(tableInfo, configContext);

            if (!tableInfo.MakeApi)
            {
                return;
            }

            if (File.Exists(pathOutput) && tableInfo.CodeCustomImplemented)
            {
                return;
            }

            if (File.Exists(pathOutput) && Convert.ToBoolean(ConfigurationManager.AppSettings["GerarApiExistentes"]) == false)
            {
                return;
            }


            var pathTemplateClass = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.ApiMore(tableInfo));

            if (!File.Exists(pathTemplateClass))
            {
                return;
            }

            var textTemplateClass = Read.AllText(tableInfo, pathTemplateClass, this._defineTemplateFolder);

            var classBuilder = GenericTagsTransformer(tableInfo, configContext, textTemplateClass);

            if (!tableInfo.Authorize)
            {
                classBuilder = classBuilder.Replace("[Authorize]", string.Empty);
            }

            using (var stream = new HelperStream(pathOutput).GetInstance())
            {
                stream.Write(classBuilder);
            }
        }
Example #3
0
        private void ExecuteTemplateApiStart(TableInfo tableInfo, Context configContext)
        {
            if (!tableInfo.MakeApi)
            {
                return;
            }

            var pathOutput = PathOutput.PathOutputWebApiStart(configContext);

            if (File.Exists(pathOutput))
            {
                return;
            }

            var pathTemplateClass = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.ApiStart(tableInfo));

            if (!File.Exists(pathTemplateClass))
            {
                return;
            }

            var textTemplateClass = Read.AllText(tableInfo, pathTemplateClass, this._defineTemplateFolder);
            var classBuilder      = GenericTagsTransformer(tableInfo, configContext, textTemplateClass);

            using (var stream = new HelperStream(pathOutput).GetInstance())
            {
                stream.Write(classBuilder);
            }
        }
Example #4
0
        private void ExecuteTemplateContainerPartial(TableInfo tableInfo, Context configContext)
        {
            if (!tableInfo.MakeApi)
            {
                return;
            }

            var pathOutput = PathOutput.PathOutputContainerPartialApi(configContext);

            if (File.Exists(pathOutput) && tableInfo.CodeCustomImplemented)
            {
                return;
            }

            if (File.Exists(pathOutput) && Convert.ToBoolean(ConfigurationManager.AppSettings["GerarContainerClassPartialExistentes"]) == false)
            {
                return;
            }

            var pathTemplateClass = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.ContainerPartial(tableInfo));

            if (!File.Exists(pathTemplateClass))
            {
                return;
            }

            var textTemplateClass = Read.AllText(tableInfo, pathTemplateClass, this._defineTemplateFolder);

            var classBuilder = GenericTagsTransformer(tableInfo, configContext, textTemplateClass);

            using (var stream = new HelperStream(pathOutput).GetInstance())
            {
                stream.Write(classBuilder);
            }
        }
Example #5
0
        private void ExecuteTemplateApi(TableInfo tableInfo, Context configContext, IEnumerable <Info> infos)
        {
            var pathOutput = PathOutput.PathOutputApi(tableInfo, configContext);

            if (!tableInfo.MakeApi)
            {
                return;
            }

            if (File.Exists(pathOutput) && tableInfo.CodeCustomImplemented)
            {
                return;
            }

            if (File.Exists(pathOutput) && Convert.ToBoolean(ConfigurationManager.AppSettings["GerarApiExistentes"]) == false)
            {
                return;
            }


            var pathTemplateClass  = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.ApiBase(tableInfo));
            var pathTemplateApiGet = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.ApiGet(tableInfo));

            if (!File.Exists(pathTemplateClass))
            {
                return;
            }

            var textTemplateClass  = Read.AllText(tableInfo, pathTemplateClass, this._defineTemplateFolder);
            var TextTemplateApiGet = Read.AllText(tableInfo, pathTemplateApiGet, this._defineTemplateFolder);

            var classBuilder = GenericTagsTransformer(tableInfo, configContext, textTemplateClass);

            var classBuilderApiGet = string.Empty;

            if (!tableInfo.IsCompositeKey && tableInfo.Keys.IsAny())
            {
                classBuilderApiGet = TextTemplateApiGet;
                classBuilderApiGet = classBuilderApiGet.Replace("<#className#>", tableInfo.ClassName);
                classBuilderApiGet = classBuilderApiGet.Replace("<#namespace#>", configContext.Namespace);
                classBuilderApiGet = classBuilderApiGet.Replace("<#inheritClassName#>", tableInfo.InheritClassName);
                classBuilderApiGet = classBuilderApiGet.Replace("<#KeyName#>", tableInfo.Keys.FirstOrDefault());
                classBuilderApiGet = classBuilderApiGet.Replace("<#KeyType#>", tableInfo.KeysTypes.FirstOrDefault());
            }
            classBuilder = classBuilder.Replace("<#ApiGet#>", classBuilderApiGet);

            var pathTemplateCustoMethod = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.ApiCustomMethod(tableInfo));

            classBuilder = this.CustomMethods(tableInfo, configContext, classBuilder, pathTemplateCustoMethod);

            if (!tableInfo.Authorize)
            {
                classBuilder = classBuilder.Replace("[Authorize]", string.Empty);
            }


            using (var stream = new HelperStream(pathOutput).GetInstance())
            {
                stream.Write(classBuilder);
            }
        }
Example #6
0
        private void ExecuteTemplateFilter(TableInfo tableInfo, Context configContext, IEnumerable <Info> infos)
        {
            if (tableInfo.MovedBaseClassToShared)
            {
                return;
            }

            var pathOutput            = PathOutput.PathOutputFilterWithFolder(tableInfo, configContext);
            var pathTemplateClass     = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.Filter(tableInfo));
            var pathTemplatePropertys = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.ModelsProperty(tableInfo));

            var textTemplateClass     = Read.AllText(tableInfo, pathTemplateClass, this._defineTemplateFolder);
            var TextTemplatePropertys = Read.AllText(tableInfo, pathTemplatePropertys, this._defineTemplateFolder);

            if (!File.Exists(pathTemplateClass))
            {
                return;
            }

            var classBuilder = GenericTagsTransformer(tableInfo, configContext, textTemplateClass);

            var classBuilderPropertys = string.Empty;

            if (infos.IsAny())
            {
                foreach (var item in infos)
                {
                    classBuilderPropertys = MakeFilterDateRange(TextTemplatePropertys, classBuilderPropertys, item);

                    if (item.Type == "bool")
                    {
                        classBuilderPropertys = AddPropertyFilter(TextTemplatePropertys, classBuilderPropertys, item, item.PropertyName, "bool?");
                    }
                    else
                    {
                        classBuilderPropertys = AddPropertyFilter(TextTemplatePropertys, classBuilderPropertys, item, item.PropertyName, item.Type);
                    }
                }
            }

            classBuilder = classBuilder.Replace("<#property#>", classBuilderPropertys);

            using (var stream = new HelperStream(pathOutput).GetInstance())
            {
                stream.Write(classBuilder);
            }
        }
Example #7
0
        private void ExecuteTemplateContainer(TableInfo tableInfo, Context configContext)
        {
            if (!tableInfo.MakeApi)
            {
                return;
            }

            var pathOutput = PathOutput.PathOutputContainerApi(configContext);

            var pathTemplateClass = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.Container(tableInfo));

            if (!File.Exists(pathTemplateClass))
            {
                return;
            }

            var pathTemplateInjections = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.ContainerInjections(tableInfo));


            var textTemplateClass      = Read.AllText(tableInfo, pathTemplateClass, this._defineTemplateFolder);
            var TextTemplateInjections = Read.AllText(tableInfo, pathTemplateInjections, this._defineTemplateFolder);

            if (configContext.Module.IsNullOrEmpty())
            {
                textTemplateClass = textTemplateClass.Replace("<#domainSource#>", configContext.ProjectName);
            }
            var classBuilder = GenericTagsTransformer(tableInfo, configContext, textTemplateClass);

            var classBuilderMappers = string.Empty;

            foreach (var item in configContext.TableInfo)
            {
                if (!string.IsNullOrEmpty(item.ClassName))
                {
                    var itemInjections = TextTemplateInjections.
                                         Replace("<#namespace#>", configContext.Namespace).
                                         Replace("<#module#>", configContext.Module.IsNullOrEmpty() ? configContext.ProjectName : configContext.Module).
                                         Replace("<#className#>", item.ClassName).
                                         Replace("<#domainSource#>", configContext.DomainSource.IsNullOrEmpty() ? configContext.ProjectName : configContext.DomainSource).
                                         Replace("<#namespaceDomainSource#>", configContext.NamespaceDomainSource);


                    classBuilderMappers += string.Format("{0}{1}", itemInjections, System.Environment.NewLine);
                }
            }


            classBuilder = classBuilder.Replace("<#injections#>", classBuilderMappers);


            using (var stream = new HelperStream(pathOutput).GetInstance())
            {
                stream.Write(classBuilder);
            }
        }
Example #8
0
        private void ExecuteTemplateEntityMapBase(TableInfo tableInfo, Context configContext, IEnumerable <Info> infos)
        {
            if (!tableInfo.MakeDomain)
            {
                return;
            }

            if (!tableInfo.Scaffold)
            {
                return;
            }

            var pathOutput        = PathOutput.PathOutputEntityMapBase(tableInfo, configContext);
            var pathTemplateClass = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.EntityMapBase(tableInfo));

            if (!File.Exists(pathTemplateClass))
            {
                return;
            }

            var pathTemplateLength       = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.MapsLength(tableInfo));
            var pathTemplateRequired     = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.MapsRequired(tableInfo));
            var pathTemplateMapper       = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.MapsMapper(tableInfo));
            var pathTemplateManyToMany   = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.MapsManyToMany(tableInfo));
            var pathTemplateCompositeKey = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.MapsCompositeKey(tableInfo));

            var textTemplateClass        = Read.AllText(tableInfo, pathTemplateClass, this._defineTemplateFolder);
            var textTemplateLength       = Read.AllText(tableInfo, pathTemplateLength, this._defineTemplateFolder);
            var textTemplateRequired     = Read.AllText(tableInfo, pathTemplateRequired, this._defineTemplateFolder);
            var textTemplateMapper       = Read.AllText(tableInfo, pathTemplateMapper, this._defineTemplateFolder);
            var textTemplateManyToMany   = Read.AllText(tableInfo, pathTemplateManyToMany, this._defineTemplateFolder);
            var textTemplateCompositeKey = Read.AllText(tableInfo, pathTemplateCompositeKey, this._defineTemplateFolder);

            var classBuilderitemTemplateLength    = string.Empty;
            var classBuilderitemTemplateRequired  = string.Empty;
            var classBuilderitemplateMapper       = string.Empty;
            var classBuilderitemplateMapperKey    = string.Empty;
            var classBuilderitemplateManyToMany   = string.Empty;
            var classBuilderitemplateCompositeKey = string.Empty;

            string classBuilder = base.MakeClassBuilderMapORM(tableInfo, configContext, infos, textTemplateClass, textTemplateLength, textTemplateRequired, textTemplateMapper, textTemplateManyToMany, textTemplateCompositeKey, ref classBuilderitemTemplateLength, ref classBuilderitemTemplateRequired, ref classBuilderitemplateMapper, ref classBuilderitemplateMapperKey, ref classBuilderitemplateManyToMany, ref classBuilderitemplateCompositeKey);

            using (var stream = new HelperStream(pathOutput).GetInstance())
            {
                stream.Write(classBuilder);
            }
        }
Example #9
0
        private void ExecuteTemplateDbContext(TableInfo tableInfo, Context configContext)
        {
            if (!tableInfo.MakeDomain)
            {
                return;
            }

            var pathOutput        = PathOutput.PathOutputDbContext(configContext);
            var pathTemplateClass = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.Context(tableInfo));

            if (!File.Exists(pathTemplateClass))
            {
                return;
            }

            var pathTemplateRegister = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.ContextMappers(tableInfo));


            var textTemplateClass   = Read.AllText(tableInfo, pathTemplateClass, this._defineTemplateFolder);
            var TextTemplateMappers = Read.AllText(tableInfo, pathTemplateRegister, this._defineTemplateFolder);

            textTemplateClass = textTemplateClass.Replace("<#module#>", configContext.ContextName);

            var classBuilder = GenericTagsTransformer(tableInfo, configContext, textTemplateClass);


            var classBuilderMappers = string.Empty;


            foreach (var item in configContext.TableInfo.Where(_ => _.Scaffold))
            {
                var itemMappaer = TextTemplateMappers.
                                  Replace("<#className#>", item.ClassName);

                classBuilderMappers += string.Format("{0}{1}{2}", Tabs.TabMaps(), itemMappaer, System.Environment.NewLine);
            }

            classBuilder = classBuilder.Replace("<#mappers#>", classBuilderMappers);


            using (var stream = new HelperStream(pathOutput).GetInstance())
            {
                stream.Write(classBuilder);
            }
        }
Example #10
0
        private void ExecuteTemplateEntitysExt(TableInfo tableInfo, Context configContext, IEnumerable <Info> infos)
        {
            if (tableInfo.CodeCustomImplemented)
            {
                return;
            }

            if (!tableInfo.MakeDomain)
            {
                return;
            }

            var pathOutput = PathOutput.PathOutputDomainEntitysExt(tableInfo, configContext);

            if (File.Exists(pathOutput) && tableInfo.CodeCustomImplemented)
            {
                return;
            }

            if (File.Exists(pathOutput) && Convert.ToBoolean(ConfigurationManager.AppSettings["GerarModelPartialExistentes"]) == false)
            {
                return;
            }

            var pathTemplateClass = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.EntityExt(tableInfo));

            if (!File.Exists(pathTemplateClass))
            {
                return;
            }

            var pathTemplatePropertys = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.EntityProperty(tableInfo));
            var textTemplateClass     = Read.AllText(tableInfo, pathTemplateClass, this._defineTemplateFolder);
            var textTemplatePropertys = Read.AllText(tableInfo, pathTemplatePropertys, this._defineTemplateFolder);


            var classBuilder = textTemplateClass;

            classBuilder = classBuilder.Replace("<#classBaseEntity#>", this.InheritEntityBase(infos));
            classBuilder = classBuilder.Replace("<#ctorparametersRequired#>", this.ConstructorParametersRequired(infos));
            classBuilder = classBuilder.Replace("<#ctorparametersRequiredBase#>", this.ConstructorParametersRequiredBase(infos));
            classBuilder = classBuilder.Replace("<#parametersRequired#>", this.ParametersRequired(infos));
            classBuilder = classBuilder.Replace("<#parametersRequiredToBase#>", this.ParametersRequiredToBase(infos));
            classBuilder = classBuilder.Replace("<#property#>", base.BuilderPropertys(infos, textTemplatePropertys, configContext));
            classBuilder = classBuilder.Replace("<#initParametersRequired#>", this.InitParametersRequired(infos));
            classBuilder = classBuilder.Replace("<#methodsSeters#>", this.MethodsSeters(infos, tableInfo));
            classBuilder = classBuilder.Replace("<#parametersRequiredConstruction#>", this.ParametersRequiredConstruction(infos));
            classBuilder = classBuilder.Replace("<#methodsSetersConstruction#>", this.MethodsSetersConstruction(infos));
            classBuilder = base.GenericTagsTransformer(tableInfo, configContext, classBuilder);



            using (var stream = new HelperStream(pathOutput).GetInstance())
            {
                stream.Write(classBuilder);
            }
        }
Example #11
0
        private void ExecuteTemplateOrderByDomainExtension(TableInfo tableInfo, Context configContext, IEnumerable <Info> infos)
        {
            if (tableInfo.CodeCustomImplemented)
            {
                return;
            }

            if (!tableInfo.MakeDomain)
            {
                return;
            }


            var pathOutput = PathOutput.PathOutputInfraOrderByDomainExtension(tableInfo, configContext);

            if (File.Exists(pathOutput))
            {
                return;
            }

            var pathTemplateClass = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.EntityOrderByDomainExtension(tableInfo));

            if (!File.Exists(pathTemplateClass))
            {
                return;
            }

            var textTemplateClass = Read.AllText(tableInfo, pathTemplateClass, this._defineTemplateFolder);
            var classBuilder      = base.GenericTagsTransformer(tableInfo, configContext, textTemplateClass);

            using (var stream = new HelperStream(pathOutput).GetInstance())
            {
                stream.Write(classBuilder);
            }
        }
Example #12
0
        private string MethodsSeters(IEnumerable <Info> infos, TableInfo tableInfo)
        {
            var pathTemplateMethosSeters = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.EntityMethodSeters(tableInfo));
            var textTemplateMethosSeters = Read.AllText(tableInfo, pathTemplateMethosSeters, this._defineTemplateFolder);

            var _methods = string.Empty;

            foreach (var item in infos)
            {
                if (Audit.IsAuditField(item.PropertyName))
                {
                    continue;
                }

                if (!IsRequired(item))
                {
                    _methods += string.Format("{0}{1}", textTemplateMethosSeters.Replace("<#propertyName#>", item.PropertyName).Replace("<#propertyNameLower#>", item.PropertyName.ToLower()).Replace("<#type#>", item.Type), System.Environment.NewLine);
                }
            }

            return(_methods);
        }
Example #13
0
        private void ExecuteTemplateAppTestsMoq(TableInfo tableInfo, Context configContext, IEnumerable <Info> infos)
        {
            if (!tableInfo.MakeApp)
            {
                return;
            }


            var pathOutput        = PathOutput.PathOutputApplicationTestMoq(tableInfo, configContext);
            var pathTemplateClass = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.AppTestMoq(tableInfo));

            if (!File.Exists(pathTemplateClass))
            {
                return;
            }

            var pathTemplateMoqValues = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.AppTestMoqValues(tableInfo));

            var textTemplateClass     = Read.AllText(tableInfo, pathTemplateClass, this._defineTemplateFolder);
            var TextTemplateMoqValues = Read.AllText(tableInfo, pathTemplateMoqValues, this._defineTemplateFolder);

            var classBuilder = GenericTagsTransformer(tableInfo, configContext, textTemplateClass);

            var classBuilderMoqValues = string.Empty;

            foreach (var item in infos)
            {
                if (item.IsKey == 1)
                {
                    continue;
                }

                if (Audit.IsAuditField(item.PropertyName))
                {
                    continue;
                }

                var itemvalue = TextTemplateMoqValues.
                                Replace("<#propertyName#>", item.PropertyName).
                                Replace("<#length#>", IsString(item) && IsNotVarcharMax(item) ? item.Length : string.Empty).
                                Replace("<#moqMethod#>", DefineMoqMethd(item.Type));

                classBuilderMoqValues += string.Format("{0}{1}", itemvalue, System.Environment.NewLine);
            }

            classBuilder = classBuilder.Replace("<#moqValuesinsert#>", classBuilderMoqValues);

            using (var stream = new HelperStream(pathOutput).GetInstance())
            {
                stream.Write(classBuilder);
            }
        }
Example #14
0
        private void ExecuteTemplateAppTestsMoqPartial(TableInfo tableInfo, Context configContext, IEnumerable <Info> infos)
        {
            var pathOutput = PathOutput.PathOutputApplicationTestMoqPartial(tableInfo, configContext);

            if (!tableInfo.MakeApp)
            {
                return;
            }

            if (File.Exists(pathOutput) && tableInfo.CodeCustomImplemented)
            {
                return;
            }

            if (File.Exists(pathOutput) && Convert.ToBoolean(ConfigurationManager.AppSettings["GerarMoqClassPartialExistentes"]) == false)
            {
                return;
            }

            var pathTemplateClass         = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.AppTestMoqPartial(tableInfo));
            var pathTemplateReletedValues = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.AppTestReleted(tableInfo));

            var textTemplateClass         = Read.AllText(tableInfo, pathTemplateClass, this._defineTemplateFolder);
            var TextTemplateReletedValues = Read.AllText(tableInfo, pathTemplateReletedValues, this._defineTemplateFolder);

            var classBuilder = GenericTagsTransformer(tableInfo, configContext, textTemplateClass);

            classBuilder = MakeReletedIntanceValues(tableInfo, configContext, TextTemplateReletedValues, classBuilder);

            var classBuilderMoqValues = string.Empty;


            using (var stream = new HelperStream(pathOutput).GetInstance())
            {
                stream.Write(classBuilder);
            }
        }
Example #15
0
        private void ExecuteTemplateAppTests(TableInfo tableInfo, Context configContext, IEnumerable <Info> infos)
        {
            var pathOutput = PathOutput.PathOutputApplicationTest(tableInfo, configContext);

            if (!tableInfo.MakeTest)
            {
                return;
            }

            if (!tableInfo.MakeApp)
            {
                return;
            }

            var pathTemplateClass = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.AppTest(tableInfo));

            var textTemplateClass = Read.AllText(tableInfo, pathTemplateClass, this._defineTemplateFolder);

            var classBuilder = GenericTagsTransformer(tableInfo, configContext, textTemplateClass);

            using (var stream = new StreamWriter(pathOutput))
            {
                stream.Write(classBuilder);
            }
        }
Example #16
0
        private void ExecuteTemplateApiTestsBasic(TableInfo tableInfo, Context configContext)
        {
            var pathOutput = PathOutput.PathOutputApiTest(tableInfo, configContext);

            if (File.Exists(pathOutput))
            {
                return;
            }

            if (!tableInfo.MakeTest)
            {
                return;
            }

            if (!tableInfo.MakeApi)
            {
                return;
            }


            var pathTemplateClass = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateName.ApiTest(tableInfo));
            var textTemplateClass = Read.AllText(tableInfo, pathTemplateClass, this._defineTemplateFolder);

            var classBuilder = GenericTagsTransformer(tableInfo, configContext, textTemplateClass);

            classBuilder = classBuilder.Replace("<#filterByModel#>", MakeKFilterByModel(tableInfo));

            using (var stream = new StreamWriter(pathOutput))
            {
                stream.Write(classBuilder);
            }
        }