コード例 #1
0
        private void ExecuteTemplateEntitysBase(TableInfo tableInfo, Context configContext, IEnumerable <Info> infos)
        {
            if (tableInfo.CodeCustomImplemented)
            {
                return;
            }

            if (tableInfo.MovedBaseClassToShared)
            {
                return;
            }

            if (!tableInfo.MakeDomain)
            {
                return;
            }

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

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

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

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

            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("<#parametersRequired#>", this.ParametersRequired(infos));
            classBuilder = classBuilder.Replace("<#ctorparametersRequired#>", base.ConstructorParametersRequired(infos));
            classBuilder = classBuilder.Replace("<#ctorparametersRequiredBase#>", base.ConstructorParametersRequiredBase(infos));
            classBuilder = classBuilder.Replace("<#property#>", base.BuilderPropertys(infos, textTemplatePropertys, configContext));
            classBuilder = classBuilder.Replace("<#initParametersRequired#>", this.InitParametersRequired(infos));
            classBuilder = classBuilder.Replace("<#parametersRequired#>", this.ParametersRequired(infos));
            classBuilder = classBuilder.Replace("<#methodsSeters#>", this.MethodsSeters(infos, tableInfo));
            classBuilder = base.GenericTagsTransformer(tableInfo, configContext, classBuilder);


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