Пример #1
0
        private SimplePolymorphicColumnMap CreatePolymorphicColumnMap(
            TypeInfo typeInfo,
            string name)
        {
            Dictionary <object, TypedColumnMap> dictionary = new Dictionary <object, TypedColumnMap>(typeInfo.RootType.DiscriminatorMap == null ? (IEqualityComparer <object>)null : (IEqualityComparer <object>)TrailingSpaceComparer.Instance);
            List <TypedColumnMap> allMaps   = new List <TypedColumnMap>();
            TypeInfo        rootType        = (TypeInfo)typeInfo.RootType;
            SimpleColumnMap typeIdColumnMap = this.CreateTypeIdColumnMap(rootType.TypeIdProperty);

            if (TypeSemantics.IsComplexType(typeInfo.Type))
            {
                this.CreateComplexTypeColumnMap(rootType, name, (ComplexTypeColumnMap)null, dictionary, allMaps);
            }
            else
            {
                this.CreateEntityColumnMap(rootType, name, (EntityColumnMap)null, dictionary, allMaps, true);
            }
            TypedColumnMap typedColumnMap1 = (TypedColumnMap)null;

            foreach (TypedColumnMap typedColumnMap2 in allMaps)
            {
                if (TypeSemantics.IsStructurallyEqual(typedColumnMap2.Type, typeInfo.Type))
                {
                    typedColumnMap1 = typedColumnMap2;
                    break;
                }
            }
            System.Data.Entity.Core.Query.PlanCompiler.PlanCompiler.Assert(null != typedColumnMap1, "Didn't find requested type in polymorphic type hierarchy?");
            return(new SimplePolymorphicColumnMap(typeInfo.Type, name, typedColumnMap1.Properties, typeIdColumnMap, dictionary));
        }
Пример #2
0
 private static bool UntypedNullAwareIsStructurallyEqual(TypeUsage fromType, TypeUsage toType)
 {
     if (fromType == null)
     {
         return(SemanticResolver.UntypedNullAwareIsPromotableTo(fromType, toType));
     }
     return(TypeSemantics.IsStructurallyEqual(fromType, toType));
 }
 internal override bool IsEquivalent(Op other)
 {
     if (other.OpType == this.OpType)
     {
         return(TypeSemantics.IsStructurallyEqual(this.Type, other.Type));
     }
     return(false);
 }
Пример #4
0
 /// <summary>
 /// Resolves <paramref name="argTypes"/> against the list of function signatures.
 /// </summary>
 /// <returns>Funciton metadata</returns>
 internal static EdmFunction ResolveFunctionOverloads(IList <EdmFunction> functionsMetadata,
                                                      IList <TypeUsage> argTypes,
                                                      bool isGroupAggregateFunction,
                                                      out bool isAmbiguous)
 {
     return(ResolveFunctionOverloads(
                functionsMetadata,
                argTypes,
                (edmFunction) => edmFunction.Parameters,
                (functionParameter) => functionParameter.TypeUsage,
                (functionParameter) => functionParameter.Mode,
                (argType) => TypeSemantics.FlattenType(argType),
                (paramType, argType) => TypeSemantics.FlattenType(paramType),
                (fromType, toType) => TypeSemantics.IsPromotableTo(fromType, toType),
                (fromType, toType) => TypeSemantics.IsStructurallyEqual(fromType, toType),
                isGroupAggregateFunction,
                out isAmbiguous));
 }
Пример #5
0
 internal static EdmFunction ResolveFunctionOverloads(
     IList <EdmFunction> functionsMetadata,
     IList <TypeUsage> argTypes,
     bool isGroupAggregateFunction,
     out bool isAmbiguous)
 {
     return(FunctionOverloadResolver.ResolveFunctionOverloads <EdmFunction, FunctionParameter>(functionsMetadata, argTypes, (Func <EdmFunction, IList <FunctionParameter> >)(edmFunction => (IList <FunctionParameter>)edmFunction.Parameters), (Func <FunctionParameter, TypeUsage>)(functionParameter => functionParameter.TypeUsage), (Func <FunctionParameter, ParameterMode>)(functionParameter => functionParameter.Mode), (Func <TypeUsage, IEnumerable <TypeUsage> >)(argType => TypeSemantics.FlattenType(argType)), (Func <TypeUsage, TypeUsage, IEnumerable <TypeUsage> >)((paramType, argType) => TypeSemantics.FlattenType(paramType)), (Func <TypeUsage, TypeUsage, bool>)((fromType, toType) => TypeSemantics.IsPromotableTo(fromType, toType)), (Func <TypeUsage, TypeUsage, bool>)((fromType, toType) => TypeSemantics.IsStructurallyEqual(fromType, toType)), isGroupAggregateFunction, out isAmbiguous));
 }
Пример #6
0
 public bool Equals(TypeUsage x, TypeUsage y)
 {
     return(TypeSemantics.IsStructurallyEqual(x, y));
 }
Пример #7
0
 /// <summary>
 ///     Two scalarOps are equivalent (usually) if their OpTypes and types are the
 ///     same. Obviously, their arguments need to be equivalent as well - but that's
 ///     checked elsewhere
 /// </summary>
 /// <param name="other"> The other Op to compare against </param>
 /// <returns> true, if the Ops are indeed equivalent </returns>
 internal override bool IsEquivalent(Op other)
 {
     return(other.OpType == OpType && TypeSemantics.IsStructurallyEqual(Type, other.Type));
 }