Beispiel #1
0
        private void ExecuteTemplateEntityMapExtension(TableInfo tableInfo, Context configContext, IEnumerable <Info> infos)
        {
            var pathOutput = PathOutput.PathOutputEntityMapExtension(tableInfo, configContext);

            if (!tableInfo.MakeDomain)
            {
                return;
            }

            if (!tableInfo.Scaffold)
            {
                return;
            }

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

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

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

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


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