示例#1
0
        public string GenerateMapper(GeneratorConfiguration config)
        {
            var text      = new StringBuilder(Resources.MapperExample);
            var variables = config.Variables.Where(vari => vari.DoMap).ToList();

            text.Replace("<!NAMESPACE!>", config.Namespace);
            text.Replace("<!BUSINESSOBJECTNAME!>", config.BusinessObjectName);
            text.Replace("<!BONAMEPARAMETER!>", config.BusinessObjectNameAsParameter);
            text.Replace("<!BYTEARRAYSIZE!>", config.Variables.Find(vari => vari.Variable.VariableLevel == 1).Bytes);
            text.Replace("<!MAPFROMCOBOL!>", string.Join("\n        \n", variables.Select(vari => vari.GetMappingFromCobol())));
            text.Replace("<!MAPTOCOBOL!>", string.Join("\n        \n", variables.Select(vari => vari.GetMappingToCobol(config.BusinessObjectNameAsParameter))));

            return(text.ToString());
        }