public override bool ResolveTypeMapping(SchemaMapping schemaMapping)
        {
            if (BccTypeMapping == null)
            {
                //complexTypeName + ((IBcc)GetTargetElement(sourceElement)).Cdt.Name

                ComplexTypeMapping complexTypeMapping =
                    schemaMapping.GetComplexTypeToCdtMapping(SourceItem.XsdTypeName + Bcc.Cdt.Name);


                //ComplexTypeMapping complexTypeMapping = schemaMapping.GetComplexTypeMapping(sourceElement.XsdType);

                if (!complexTypeMapping.IsMappedToCdt)
                {
                    throw new MappingError("Complex typed element '" + SourceItem.Path +
                                           "' mapped to BCC, but the complex type is not mapped to a CDT.");
                }
                if (complexTypeMapping.TargetCdt.Id != Bcc.Cdt.Id)
                {
                    throw new MappingError("Complex typed element '" + SourceItem.Path +
                                           "' mapped to BCC with CDT other than the target CDT for the complex type.");
                }
                BccTypeMapping = complexTypeMapping;
            }
            return(true);
        }
 public MappedLibraryGenerator(SchemaMapping schemaMapping, IBLibrary bLibrary, string docLibraryName, string bieLibraryName, string bdtLibraryName, string qualifier, string rootElementName)
 {
     this.bLibrary        = bLibrary;
     this.docLibraryName  = docLibraryName;
     this.bieLibraryName  = bieLibraryName;
     this.bdtLibraryName  = bdtLibraryName;
     this.qualifier       = qualifier;
     this.rootElementName = rootElementName;
     this.schemaMapping   = schemaMapping;
 }
        /// <summary>
        /// </summary>
        public void ImportMapping()
        {
            var mapForceMapping = LinqToXmlMapForceMappingImporter.ImportFromFiles(mapForceMappingFiles);

            var xmlSchemaSet = new XmlSchemaSet();

            foreach (string xmlSchema in xmlSchemaFiles)
            {
                xmlSchemaSet.Add(XmlSchema.Read(XmlReader.Create(xmlSchema), null));
            }

            mappings = new SchemaMapping(mapForceMapping, xmlSchemaSet, ccLibrary, cctsRepository);
            var mappedLibraryGenerator = new MappedLibraryGenerator(mappings, bLibrary, docLibraryName, bieLibraryName, bdtLibraryName, qualifier, rootElementName);

            mappedLibraryGenerator.GenerateLibraries();
        }
        public override bool ResolveTypeMapping(SchemaMapping schemaMapping)
        {
            ComplexTypeMapping complexTypeMapping = schemaMapping.GetComplexTypeMapping(SourceItem.XsdType);

            if (!complexTypeMapping.IsMappedToSingleACC)
            {
                throw new MappingError("Complex typed element '" + SourceItem.Path +
                                       "' mapped to ASCC, but the complex type is not mapped to a single ACC: TargetACCs: [" + string.Join(", ", complexTypeMapping.TargetACCs.Select(acc => acc.Name).ToArray()) + "], number of children mapped to ASMAs: " + complexTypeMapping.AsmaMappings.Count() + ".");
            }
            IAcc complexTypeACC = complexTypeMapping.TargetACCs.ElementAt(0);

            if (complexTypeACC.Id != Ascc.AssociatedAcc.Id)
            {
                throw new MappingError("Complex typed element '" + SourceItem.Path +
                                       "' mapped to ASCC with associated ACC other than the target ACC for the complex type.");
            }
            TargetMapping = complexTypeMapping;
            return(true);
        }
 public override bool ResolveTypeMapping(SchemaMapping schemaMapping)
 {
     // do nothing
     return(true);
 }
Example #6
0
 public override bool ResolveTypeMapping(SchemaMapping schemaMapping)
 {
     TargetMapping = schemaMapping.GetComplexTypeMapping(SourceItem.XsdType);
     return(TargetMapping is ComplexTypeToAccMapping || TargetMapping is ComplexTypeToMaMapping);
 }
Example #7
0
 public abstract bool ResolveTypeMapping(SchemaMapping schemaMapping);