Exemple #1
0
        private void ExecuteTemplateMapsBase(TableInfo tableInfo, Context configContext, IEnumerable <Info> infos)
        {
            var pathOutput               = PathOutput.PathOutputMaps(tableInfo, configContext);
            var pathTemplateClass        = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), "maps");
            var pathTemplateLength       = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), "maps.length");
            var pathTemplateRequired     = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), "maps.required");
            var pathTemplateMapper       = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), "maps.mapper");
            var pathTemplateManyToMany   = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), "maps.manytomany");
            var pathTemplateCompositeKey = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), "maps.compositekey");

            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 = 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 StreamWriter(pathOutput))
            {
                stream.Write(classBuilder);
            }
        }