private void BuildEnumFile(EnumInfo enumInfo) { foreach (Configuration.FileInfo fileInfo in _configuration.EnumFileInfos) { string name = enumInfo.type.Name; string templateFileName = Path.Combine(_configuration.TemplateRoot, fileInfo.template); string targetFileName = Path.Combine(_configuration.TargetRoot, Replace(fileInfo.target, DefinedPlaceholder.DOMAIN_ENUMNAME, name)); targetFileName = Replacer.Replace(_configuration.ProjectReplaceInfos, targetFileName); CheckExistenceTemplateFile(templateFileName); CheckExistenceDestinationFile(targetFileName, fileInfo.overwrite); Replacer replacer = new Replacer(templateFileName); // for each enum value /* --- still not needed at the moment --- */ // common replacer.Replace(DefinedPlaceholder.DOMAIN_ENUMNAME, name); ReplaceCommon(replacer, enumInfo.type); replacer.Save(targetFileName); } }
private void ReplaceCommon(Replacer replacer, Type type) { replacer.Replace(DefinedPlaceholder.PROJECT_ROOTNAMESPACE, _configuration.ProjectNamespaceRoot); replacer.Replace(DefinedPlaceholder.DOMAIN_ROOTNAMESPACE, _configuration.DomainNamespaceRoot); replacer.Replace(DefinedPlaceholder.DOMAIN_ASSEMBLYNAME, GetAssemblyName(type)); replacer.Replace(DefinedPlaceholder.DOMAIN_QUALIFIEDCLASSTYPENAME, GetTypeName(type)); replacer.Replace(DefinedPlaceholder.ROOT_TEMPLATE_DIR, _configuration.TemplateRoot); replacer.Replace(DefinedPlaceholder.ROOT_TARGET_DIR, _configuration.TargetRoot); replacer.Replace (DefinedPlaceholder.WEB_CLIENT_GUID, Guid.NewGuid().ToString()); replacer.Replace(_configuration.ProjectReplaceInfos); }
private void BuildClassFile(Type type, IBusinessObjectClass businessObjectClass, IBusinessObjectProperty[] properties) { foreach (Configuration.FileInfo fileInfo in _configuration.ClassFileInfos) { string name = GetName(businessObjectClass.Identifier); string templateFileName = Path.Combine(_configuration.TemplateRoot, fileInfo.template); string targetFileName = Path.Combine(_configuration.TargetRoot, Replace(fileInfo.target, DefinedPlaceholder.DOMAIN_CLASSNAME, name)); targetFileName = Replacer.Replace(_configuration.ProjectReplaceInfos, targetFileName); CheckExistenceTemplateFile(templateFileName); CheckExistenceDestinationFile(targetFileName, fileInfo.overwrite); Replacer replacer = new Replacer(templateFileName); // for each property replacer.Include( DefinedPlaceholder.INCLUDE_FOREACHPROPERTY, GetPropertyInfos(businessObjectClass, properties)); replacer.Repeat( DefinedPlaceholder.REPEAT_FOREACHPROPERTY_BEGIN, DefinedPlaceholder.REPEAT_FOREACHPROPERTY_END, GetPropertyInfos(businessObjectClass, properties)); replacer.Repeat( DefinedPlaceholder.REPEAT_FOREACHREFERENCEDPROPERTY_BEGIN, DefinedPlaceholder.REPEAT_FOREACHREFERENCEDPROPERTY_END, GetReferencedPropertyInfos(businessObjectClass, properties, true), "isList=true"); replacer.Repeat( DefinedPlaceholder.REPEAT_FOREACHREFERENCEDPROPERTY_BEGIN, DefinedPlaceholder.REPEAT_FOREACHREFERENCEDPROPERTY_END, GetReferencedPropertyInfos(businessObjectClass, properties, false), "isList=false"); // common replacer.Replace(DefinedPlaceholder.DOMAIN_CLASSNAME, name); ReplaceCommon(replacer, type); replacer.Save(targetFileName); } }