예제 #1
0
        /// <summary>
        ///     This method will go through function-import result-column type mappings.
        ///     For each type-mapping checks whether there exists a type-mapping that involves the passed-in property.
        ///     If a match is found, the corresponding column name is returned.
        ///     If no match could be found, an empty string is returned.
        /// </summary>
        /// <param name="property"></param>
        /// <returns></returns>
        internal static string GetFunctionImportResultColumnName(FunctionImport functionImport, Property property)
        {
            if (functionImport == null)
            {
                throw new ArgumentException("functionImport is null.");
            }

            if (property == null)
            {
                throw new ArgumentException("property is null");
            }

            var mapping = functionImport.FunctionImportMapping;

            if (mapping != null &&
                mapping.ResultMapping != null)
            {
                foreach (var typeMapping in mapping.ResultMapping.TypeMappings())
                {
                    var scalarProperty = typeMapping.FindScalarProperty(property);
                    if (scalarProperty != null)
                    {
                        Debug.Assert(!String.IsNullOrEmpty(scalarProperty.ColumnName.Value), "Function Import Result Column name is empty");
                        if (!String.IsNullOrEmpty(scalarProperty.ColumnName.Value))
                        {
                            return(scalarProperty.ColumnName.Value);
                        }
                    }
                }
            }
            return(String.Empty);
        }
예제 #2
0
파일: EdmUtils.cs 프로젝트: phekmat/ef6
 // <summary>
 //     Return the corresponding FunctionImport's result-column name for a given property.
 // </summary>
 internal static string GetFunctionImportResultColumnName(EntityModel.FunctionImport functionImport, EntityModel.Property property)
 {
     if (functionImport != null)
     {
         var columnName = EntityModel.FunctionImport.GetFunctionImportResultColumnName(functionImport, property);
         if (!String.IsNullOrEmpty(columnName))
         {
             return(columnName);
         }
     }
     return(property.LocalName.Value);
 }
예제 #3
0
 internal override bool ParseSingleElement(ICollection <XName> unprocessedElements, XElement elem)
 {
     if (elem.Name.LocalName == EntitySet.ElementName)
     {
         EntitySet es = new ConceptualEntitySet(this, elem);
         AddEntitySet(es);
         es.Parse(unprocessedElements);
     }
     else if (elem.Name.LocalName == FunctionImport.ElementName)
     {
         var fi = new FunctionImport(this, elem);
         _functionImports.Add(fi);
         fi.Parse(unprocessedElements);
     }
     else
     {
         return(base.ParseSingleElement(unprocessedElements, elem));
     }
     return(true);
 }
예제 #4
0
 internal void AddFunctionImport(FunctionImport fi)
 {
     _functionImports.Add(fi);
 }
예제 #5
0
 internal ComposableDefaultableValue(FunctionImport parent)
     : base(parent, AttributeIsComposable)
 {
 }