Exemple #1
0
        private void ExecuteTemplateFilterBasicExtension(TableInfo tableInfo, Context configContext, IEnumerable <Info> infos)
        {
            if (tableInfo.CodeCustomImplemented)
            {
                return;
            }

            if (!tableInfo.MakeDomain)
            {
                return;
            }


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


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

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

            var classBuilder        = base.GenericTagsTransformer(tableInfo, configContext, textTemplateClass);
            var classBuilderFilters = string.Empty;

            classBuilderFilters = base.BuilderSampleFilters(infos, textTemplateFilters, classBuilderFilters, configContext);

            classBuilder = classBuilder.Replace("<#filtersExpressions#>", classBuilderFilters);

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