Esempio n. 1
0
 private static IEnumerable<XElement> CUDFunctionMappingResults(CUDFunctionMapping functionMapping)
 {
     foreach (var result in functionMapping.ResultsMapping)
     {
         yield return new XElement(mslNamespace + "ResultBinding",
             new XAttribute("Name", result.Key.Name),
             new XAttribute("ColumnName", result.Value));
     }
 }
Esempio n. 2
0
        private static IEnumerable<XElement> CUDFunctionMappingAssociation(CUDFunctionMapping functionMapping)
        {
            foreach (CUDFunctionAssociationMapping cudFunctionAssiociation in functionMapping.AssociationMappings)
            {
                XElement associationEndElement = new XElement(mslNamespace + "AssociationEnd",
                    new XAttribute("AssociationSet", cudFunctionAssiociation.Association.AssociationSetName),
                    new XAttribute("From", cudFunctionAssiociation.FromRole),
                    new XAttribute("To", cudFunctionAssiociation.ToRole));

                associationEndElement.Add(CUDFunctionMappingScalarPropertiesParameters(cudFunctionAssiociation.AssociationPropertiesMapping));

                yield return associationEndElement;
            }
        }
Esempio n. 3
0
 private static IEnumerable<XElement> CUDFunctionMappingParameters(CUDFunctionMapping functionMapping)
 {
     return CUDFunctionMappingParameters(functionMapping.ParametersMapping);
 }
Esempio n. 4
0
 private static CUDFunctionMapping SetCUDFunctionMapping(SSDLContainer ssdlContainer, EntityType entityType, XElement functionMappingElement)
 {
     var cudFunctionMapping = new CUDFunctionMapping();
     var ssdlFunction = ssdlContainer.Functions.GetByName(GetName(functionMappingElement.Attribute("FunctionName").Value));
     cudFunctionMapping.SSDLFunction = ssdlFunction;
     SetCUDFunctionParametersMapping(entityType, functionMappingElement, cudFunctionMapping.ParametersMapping, ssdlFunction);
     foreach (var scalarPropertyElement in functionMappingElement.Elements(XName.Get("ResultBinding", mslNamespace.NamespaceName)))
         cudFunctionMapping.ResultsMapping[entityType.AllScalarProperties.GetByName(scalarPropertyElement.Attribute("Name").Value)] = scalarPropertyElement.Attribute("ColumnName").Value;
     foreach (var associationEndElement in functionMappingElement.Elements(XName.Get("AssociationEnd", mslNamespace.NamespaceName)))
     {
         var navigationProperty = entityType.NavigationProperties.First(np => np.Association.AssociationSetName == associationEndElement.Attribute("AssociationSet").Value);
         var cudFunctionAssociationMapping = new CUDFunctionAssociationMapping { Association = navigationProperty.Association, FromRole = associationEndElement.Attribute("From").Value, ToRole = associationEndElement.Attribute("To").Value };
         cudFunctionMapping.AssociationMappings.Add(cudFunctionAssociationMapping);
         SetCUDFunctionParametersScalarMapping(navigationProperty.RelatedEntityType, associationEndElement, cudFunctionAssociationMapping.AssociationPropertiesMapping, ssdlFunction);
     }
     return cudFunctionMapping;
 }