コード例 #1
0
        // effects: try to find setter expression for the given member
        // requires: command tree must be an insert or update tree (since other DML trees hnabve 
        private static bool TryGetSetterExpression(DbModificationCommandTree tree, EdmMember member, ModificationOperator op, out DbSetClause setter)
        {
            Debug.Assert(op == ModificationOperator.Insert || op == ModificationOperator.Update, "only inserts and updates have setters");
            IEnumerable<DbModificationClause> clauses;
            if (ModificationOperator.Insert == op)
            {
                clauses = ((DbInsertCommandTree)tree).SetClauses;
            }
            else
            {
                clauses = ((DbUpdateCommandTree)tree).SetClauses;
            }
            foreach (DbSetClause setClause in clauses)
            {
                // check if this is the correct setter
                if (((DbPropertyExpression)setClause.Property).Property.EdmEquals(member))
                {
                    setter = setClause;
                    return true;
                }
            }

            // no match found
            setter = null;
            return false;
        }
コード例 #2
0
        /// <summary>
        /// Constructor taking a metadata context, an structural type, and a parent custom type descriptor
        /// </summary>
        /// <param name="typeDescriptionContext">The <see cref="LinqToEntitiesTypeDescriptionContext"/> context.</param>
        /// <param name="edmType">The <see cref="StructuralType"/> type (can be an entity or complex type).</param>
        /// <param name="parent">The parent custom type descriptor.</param>
        public LinqToEntitiesTypeDescriptor(LinqToEntitiesTypeDescriptionContext typeDescriptionContext, StructuralType edmType, ICustomTypeDescriptor parent)
            : base(parent)
        {
            _typeDescriptionContext = typeDescriptionContext;
            _edmType = edmType;

            EdmMember[] timestampMembers = _edmType.Members.Where(p => ObjectContextUtilities.IsConcurrencyTimestamp(p)).ToArray();
            if (timestampMembers.Length == 1)
            {
                _timestampMember = timestampMembers[0];
            }

            if (edmType.BuiltInTypeKind == BuiltInTypeKind.EntityType)
            {
                // if any FK member of any association is also part of the primary key, then the key cannot be marked
                // Editable(false)
                EntityType entityType = (EntityType)edmType;
                _foreignKeyMembers = new HashSet<EdmMember>(entityType.NavigationProperties.SelectMany(p => p.GetDependentProperties()));
                foreach (EdmProperty foreignKeyMember in _foreignKeyMembers)
                {
                    if (entityType.KeyMembers.Contains(foreignKeyMember))
                    {
                        _keyIsEditable = true;
                        break;
                    }
                }
            }
        }
コード例 #3
0
        public EFColumnProvider(EntityType entityType, EFTableProvider table, EdmMember m, bool isPrimaryKey)
            : base(table) {
            EdmMember = m;
            IsPrimaryKey = isPrimaryKey;
            _table = table;
            MaxLength = 0;
            Name = EdmMember.Name;
            // 
            IsCustomProperty = false;

            // 
            var property = EdmMember as EdmProperty;

            if (property != null) {
                IsForeignKeyComponent = DetermineIsForeignKeyComponent(property);
                IsGenerated = IsServerGenerated(property);
            }

            ProcessFacets();

            var navProp = m as NavigationProperty;
            if (navProp != null) {
                _isAssociation = true;
                long key = EFAssociationProvider.BuildRelationshipKey(entityType, navProp.FromEndMember);
                ((EFDataModelProvider)table.DataModel).RelationshipEndLookup[key] = this;
            }
        }
コード例 #4
0
        /// <summary>
        /// Create a column map for a ref type
        /// </summary>
        /// <param name="typeInfo">Type information for the ref type</param>
        /// <param name="name">Name of the column</param>
        /// <returns>Column map for the ref type</returns>
        private RefColumnMap CreateRefColumnMap(TypeInfo typeInfo, string name)
        {
            SimpleColumnMap entitySetIdColumnMap = null;

            if (typeInfo.HasEntitySetIdProperty)
            {
                entitySetIdColumnMap = CreateSimpleColumnMap(md.Helper.GetModelTypeUsage(typeInfo.EntitySetIdProperty), c_EntitySetIdColumnName);
            }

            // get the target entity type,
            md.EntityType entityType = (md.EntityType)(TypeHelpers.GetEdmType <md.RefType>(typeInfo.Type).ElementType);

            // Iterate through the list of "key" properties
            SimpleColumnMap[] keyColList = new SimpleColumnMap[entityType.KeyMembers.Count];
            for (int i = 0; i < keyColList.Length; ++i)
            {
                md.EdmMember property = entityType.KeyMembers[i];
                keyColList[i] = CreateSimpleColumnMap(md.Helper.GetModelTypeUsage(property), property.Name);
            }

            // Create the entity identity
            EntityIdentity identity = CreateEntityIdentity(entityType, entitySetIdColumnMap, keyColList);

            RefColumnMap result = new RefColumnMap(typeInfo.Type, name, identity);

            return(result);
        }
コード例 #5
0
 internal ExplicitDiscriminatorMap(System.Data.Mapping.ViewGeneration.DiscriminatorMap template)
 {
     m_typeMap = template.TypeMap;
     m_discriminatorProperty = template.Discriminator.Property;
     m_properties = template.PropertyMap.Select(propertyValuePair => propertyValuePair.Key)
         .ToList().AsReadOnly();
 }
コード例 #6
0
ファイル: Perspective.cs プロジェクト: uQr/referencesource
 /// <summary>
 /// Given the type in the target space and the member name in the source space,
 /// get the corresponding member in the target space
 /// For e.g.  consider a Conceptual Type 'Foo' with a member 'Bar' and a CLR type
 /// 'XFoo' with a member 'YBar'. If one has a reference to Foo one can
 /// invoke GetMember(Foo,"YBar") to retrieve the member metadata for bar
 /// </summary>
 /// <param name="type">The type in the target perspective</param>
 /// <param name="memberName">the name of the member in the source perspective</param>
 /// <param name="ignoreCase">Whether to do case-sensitive member look up or not</param>
 /// <param name="outMember">returns the member in target space, if a match is found</param>
 internal virtual bool TryGetMember(StructuralType type, String memberName, bool ignoreCase, out EdmMember outMember)
 {
     EntityUtil.CheckArgumentNull(type, "type");
     EntityUtil.CheckStringArgument(memberName, "memberName");
     outMember = null;
     return type.Members.TryGetValue(memberName, ignoreCase, out outMember);
 }
コード例 #7
0
 internal ExplicitDiscriminatorMap(DiscriminatorMap template)
 {
     m_typeMap = template.TypeMap;
     m_discriminatorProperty = template.Discriminator.Property;
     m_properties = template.PropertyMap.Select(propertyValuePair => propertyValuePair.Key)
         .ToList().AsReadOnly();
 }
コード例 #8
0
        public EdmColumnProvider(EntityType entityType, EdmTableProvider table, EdmMember m, bool isPrimaryKey, bool supportPagingAndSorting)
            : base(table)
        {
            EdmMember = m;
            IsPrimaryKey = isPrimaryKey;
            _table = table;
            _supportSorting = supportPagingAndSorting;
            MaxLength = 0;
            Name = EdmMember.Name;
            // REVIEW Seems like extra properties added in partial classes are not even detected by the metadata engine
            IsCustomProperty = false;

            // REVIEW: This should probably be a debug assert or we should only pass an EmdProperty
            var property = EdmMember as EdmProperty;

            if (property != null) {
                IsForeignKeyComponent = DetermineIsForeignKeyComponent(property);
                IsGenerated = IsServerGenerated(property);
            }

            ProcessFacets();

            var navProp = m as NavigationProperty;
            if (navProp != null) {
                _isAssociation = true;
                long key = EdmAssociationProvider.BuildRelationshipKey(entityType, navProp.FromEndMember);
                ((EdmDataModelProvider)table.DataModel).RelationshipEndLookup[key] = this;
            }
        }
コード例 #9
0
        internal EntityProxyMemberInfo(EdmMember member, int propertyIndex)
        {
            Debug.Assert(member != null, "member must be non-null");
            Debug.Assert(propertyIndex > -1, "propertyIndex must be non-negative");

            _member = member;
            _propertyIndex = propertyIndex;
        }
コード例 #10
0
        /// <summary>
        /// Gets the accessibility that should be applied at the property level for a property being
        /// generated from the provided EdmMember.
        ///
        /// defaults to public if no annotation is found.
        /// </summary>
        public static string ForProperty(EdmMember member)
        {
            if (member == null)
            {
                return null;
            }

            string getterAccess, setterAccess, propertyAccess;
            CalculatePropertyAccessibility(member, out propertyAccess, out getterAccess, out setterAccess);
            return propertyAccess;
        }
コード例 #11
0
ファイル: FieldMetadata.cs プロジェクト: uQr/referencesource
        /// <summary>
        /// Used to construct a field metadata object relating a column ordinal and an ImemberMetadata.
        /// </summary>
        /// <param name="ordinal">Column oridnal</param>
        /// <param name="fieldType">Metadata member</param>
        public FieldMetadata(int ordinal, EdmMember fieldType) {
            if (ordinal < 0) {
                throw EntityUtil.ArgumentOutOfRange("ordinal");
            }
            if (null == fieldType) {
                throw EntityUtil.ArgumentNull("fieldType");
            }

            _fieldType = fieldType;
            _ordinal = ordinal;
        }
コード例 #12
0
        /// <summary>
        /// Used to construct a field metadata object relating a column ordinal and an ImemberMetadata.
        /// </summary>
        /// <param name="ordinal">Column oridnal</param>
        /// <param name="fieldType">Metadata member</param>
        public FieldMetadata(int ordinal, EdmMember fieldType)
        {
            if (ordinal < 0)
            {
                throw new ArgumentOutOfRangeException("ordinal");
            }
            if (null == fieldType)
            {
                throw new ArgumentNullException("fieldType");
            }

            _fieldType = fieldType;
            _ordinal = ordinal;
        }
コード例 #13
0
        protected static MemberAttributes AccessibilityFromGettersAndSetters(EdmMember property)
        {
            MemberAttributes scope = MemberAttributes.Private;

            MemberAttributes getter = GetGetterAccessibility(property);
            if (IsLeftMoreAccessableThanRight(getter, scope))
            {
                scope = getter;
            }

            MemberAttributes setter = GetSetterAccessibility(property);
            if (IsLeftMoreAccessableThanRight(setter, scope))
            {
                scope = setter;
            }
            return scope;
        }
コード例 #14
0
        /// <summary>
        /// Given the type in the target space and the member name in the source space,
        /// get the corresponding member in the target space
        /// For e.g.  consider a Conceptual Type Foo with a member bar and a CLR type 
        /// XFoo with a member YBar. If one has a reference to Foo one can
        /// invoke GetMember(Foo,"YBar") to retrieve the member metadata for bar
        /// </summary>
        /// <param name="type">The type in the target perspective</param>
        /// <param name="memberName">the name of the member in the source perspective</param>
        /// <param name="ignoreCase">true for case-insensitive lookup</param>
        /// <param name="outMember">returns the edmMember if a match is found</param>
        /// <returns>true if a match is found, otherwise false</returns>
        internal override bool TryGetMember(StructuralType type, String memberName, bool ignoreCase, out EdmMember outMember)
        {
            outMember = null;
            Map map = null;

            if (this.MetadataWorkspace.TryGetMap(type, DataSpace.OCSpace, out map))
            {
                ObjectTypeMapping objectTypeMap = map as ObjectTypeMapping;

                if (objectTypeMap!=null)
                {
                    ObjectMemberMapping objPropertyMapping = objectTypeMap.GetMemberMapForClrMember(memberName, ignoreCase);
                    if (null != objPropertyMapping)
                    {
                        outMember = objPropertyMapping.EdmMember;
                        return true;
                    }
                }
            }
            return false;
        }
コード例 #15
0
        /// <summary>
        /// Create a column map for a record type. Simply iterates through the
        /// list of fields, and produces a column map for each field
        /// </summary>
        /// <param name="typeInfo">Type information for the record type</param>
        /// <param name="name">column name</param>
        /// <returns></returns>
        private RecordColumnMap CreateRecordColumnMap(TypeInfo typeInfo, string name)
        {
            PlanCompiler.Assert(typeInfo.Type.EdmType is md.RowType, "not RowType");
            SimpleColumnMap nullSentinelColumnMap = null;

            if (typeInfo.HasNullSentinelProperty)
            {
                nullSentinelColumnMap = CreateSimpleColumnMap(md.Helper.GetModelTypeUsage(typeInfo.NullSentinelProperty), c_NullSentinelColumnName);
            }

            md.ReadOnlyMetadataCollection <md.EdmProperty> properties = TypeHelpers.GetProperties(typeInfo.Type);
            ColumnMap[] propertyColumnMapList = new ColumnMap[properties.Count];
            for (int i = 0; i < propertyColumnMapList.Length; ++i)
            {
                md.EdmMember property = properties[i];
                propertyColumnMapList[i] = CreateColumnMap(md.Helper.GetModelTypeUsage(property), property.Name);
            }

            RecordColumnMap result = new RecordColumnMap(typeInfo.Type, name, propertyColumnMapList, nullSentinelColumnMap);

            return(result);
        }
コード例 #16
0
        /// <summary>
        /// Add an entry that the given property of the given var is a computation represented 
        /// by the computationTemplate over the var represented by the given groupAggregateVarInfo        
        /// </summary>
        /// <param name="var"></param>
        /// <param name="groupAggregateVarInfo"></param>
        /// <param name="computationTemplate"></param>
        /// <param name="isUnnested"></param>
        /// <param name="property"></param>
        internal void Add(
            Var var, GroupAggregateVarInfo groupAggregateVarInfo, Node computationTemplate, bool isUnnested, EdmMember property)
        {
            if (property == null)
            {
                Add(var, groupAggregateVarInfo, computationTemplate, isUnnested);
                return;
            }
            if (_groupAggregateVarRelatedVarPropertyToInfo == null)
            {
                _groupAggregateVarRelatedVarPropertyToInfo = new Dictionary<Var, Dictionary<EdmMember, GroupAggregateVarRefInfo>>();
            }
            Dictionary<EdmMember, GroupAggregateVarRefInfo> varPropertyDictionary;
            if (!_groupAggregateVarRelatedVarPropertyToInfo.TryGetValue(var, out varPropertyDictionary))
            {
                varPropertyDictionary = new Dictionary<EdmMember, GroupAggregateVarRefInfo>();
                _groupAggregateVarRelatedVarPropertyToInfo.Add(var, varPropertyDictionary);
            }
            varPropertyDictionary.Add(property, new GroupAggregateVarRefInfo(groupAggregateVarInfo, computationTemplate, isUnnested));

            // Note: The following line is not necessary with the current usage pattern, this method is 
            // never called with a new groupAggregateVarInfo thus it is a no-op.
            _groupAggregateVarInfos.Add(groupAggregateVarInfo);
        }
コード例 #17
0
 /// <summary>
 /// Create a nested property ref for a simple property. Delegates to the function
 /// above
 /// </summary>
 /// <param name="p">the simple property</param>
 /// <returns>a nestedPropertyRef</returns>
 internal PropertyRef CreateNestedPropertyRef(md.EdmMember p)
 {
     return(CreateNestedPropertyRef(new SimplePropertyRef(p)));
 }
コード例 #18
0
 private static int FindPosition(EdmType type, EdmMember member)
 {
     var pos = 0;
     foreach (EdmMember m in TypeHelpers.GetAllStructuralMembers(type))
     {
         if (m.EdmEquals(member))
         {
             return pos;
         }
         pos++;
     }
     PlanCompiler.Assert(false, "Could not find property " + member + " in type " + type.Name);
     return -1;
 }
コード例 #19
0
ファイル: RowType.cs プロジェクト: uQr/referencesource
 /// <summary>
 /// Validates a EdmMember object to determine if it can be added to this type's 
 /// Members collection. If this method returns without throwing, it is assumed
 /// the member is valid. 
 /// </summary>
 /// <param name="member">The member to validate</param>
 /// <exception cref="System.ArgumentException">Thrown if the member is not a EdmProperty</exception>
 internal override void ValidateMemberForAdd(EdmMember member)
 {
     Debug.Assert(Helper.IsEdmProperty(member), "Only members of type Property may be added to Row types.");
 }
コード例 #20
0
        /// <summary>
        /// Returns the list of all the key members for this entity type
        /// </summary>
        /// <exception cref="System.ArgumentNullException">if member argument is null</exception>
        /// <exception cref="System.InvalidOperationException">Thrown if the EntityType has a base type of another EntityTypeBase. In this case KeyMembers should be added to the base type</exception>
        /// <exception cref="System.InvalidOperationException">If the EntityType instance is in ReadOnly state</exception>
        internal void AddKeyMember(EdmMember member)
        {
            EntityUtil.GenericCheckArgumentNull(member, "member");
            Util.ThrowIfReadOnly(this);
            Debug.Assert(
                BaseType == null || ((EntityTypeBase)BaseType).KeyMembers.Count == 0,
                "Key cannot be added if there is a basetype with keys");

            if (!Members.Contains(member))
            {
                AddMember(member);
            }
            _keyMembers.Source.Add(member);
        }
コード例 #21
0
            /// <summary>
            /// Given default values for children members, produces a new default expression for the requested (parent) member.
            /// </summary>
            /// <param name="node">Parent member</param>
            /// <returns>Default value for parent member</returns>
            internal PropagatorResult Visit(EdmMember node)
            {
                PropagatorResult result;
                TypeUsage nodeType = Helper.GetModelTypeUsage(node);

                if (Helper.IsScalarType(nodeType.EdmType))
                {
                    GetPropagatorResultForPrimitiveType(Helper.AsPrimitive(nodeType.EdmType), out result);
                }
                else
                {
                    // Construct a new 'complex type' (really any structural type) member.
                    StructuralType structuralType = (StructuralType)nodeType.EdmType;
                    IBaseList<EdmMember> members = TypeHelpers.GetAllStructuralMembers(structuralType);

                    PropagatorResult[] args = new PropagatorResult[members.Count];
                    for (int ordinal = 0; ordinal < members.Count; ordinal++)
                    //                    foreach (EdmMember member in members)
                    {
                        args[ordinal] = Visit(members[ordinal]);
                    }

                    result = PropagatorResult.CreateStructuralValue(args, structuralType, false);
                }

                return result;
            }
コード例 #22
0
            /// <summary>
            /// Returns a placeholder for a specific metadata member.
            /// </summary>
            /// <param name="member">EdmMember for which to produce a placeholder.</param>
            /// <returns>Placeholder element for the given member.</returns>
            private PropagatorResult CreateMemberPlaceholder(EdmMember member)
            {
                EntityUtil.CheckArgumentNull(member, "member");

                return Visit(member);
            }
コード例 #23
0
ファイル: EntityType.cs プロジェクト: longde123/playscript
 /// <summary>
 /// Get SQL description of a member of this entity type.
 /// Requires: member must belong to this type
 /// </summary>
 /// <param name="member">Member for which to retrieve SQL</param>
 /// <param name="sql">Outputs SQL describing this member</param>
 /// <returns>Whether sql is cached for this member</returns>
 internal bool TryGetMemberSql(EdmMember member, out string sql)
 {
     Debug.Assert(Members.Contains(member));
     sql = null;
     return null != _memberSql && _memberSql.TryGetValue(member, out sql);
 }
コード例 #24
0
 /// <summary>
 /// determines if edmMember is Nullable.
 /// </summary>
 /// <param name="edmMember"></param>
 /// <returns></returns>
 internal static bool IsNullable(EdmMember edmMember)
 {
     return IsNullable(edmMember.TypeUsage);
 }
コード例 #25
0
		private static bool IsStoreGenerated(EdmMember member)
		{
			Facet item = null;
			if (member.TypeUsage.Facets.TryGetValue(MetadataHelpers.StoreGeneratedPatternFacetName, false, out item) &&
				(((StoreGeneratedPattern)item.Value) == StoreGeneratedPattern.Computed || ((StoreGeneratedPattern)item.Value) == StoreGeneratedPattern.Identity))
			{
				return true;
			}
			else
			{
				return false;
			}
		}
コード例 #26
0
 /// <summary>
 /// More useful default constructor
 /// </summary>
 /// <param name="table">table containing this column</param>
 /// <param name="property">property describing this column</param>
 internal ColumnMD(TableMD table, EdmMember property)
     : this(table, property.Name, property.TypeUsage)
 {
     m_property = property;
 }
コード例 #27
0
 /// <summary>
 /// Simple constructor
 /// </summary>
 /// <param name="property">the property metadata</param>
 internal SimplePropertyRef(md.EdmMember property)
 {
     m_property = property;
 }
コード例 #28
0
		// Generates SQL describing a member
		// Requires: member must belong to an entity type (a safe requirement for DML
		// SQL gen, where we only access table columns)
		internal static string GenerateMemberSql(EdmMember member)
		{
			return SqlGenerator.QuoteIdentifier(member.Name);
		}
コード例 #29
0
 // Generates T-SQL describing a member
 // Requires: member must belong to an entity type (a safe requirement for DML
 // SQL gen, where we only access table columns)
 private static string GenerateMemberTSql(EdmMember member)
 {
   return SqlGenerator.QuoteIdentifier(member.Name);
 }
コード例 #30
0
 protected static MemberAttributes GetSetterAccessibility(EdmMember item)
 {
     return GetAccessibilityValue(item, XmlConstants.SetterAccess);
 }
コード例 #31
0
ファイル: EntityType.cs プロジェクト: longde123/playscript
 /// <summary>
 /// Validates a EdmMember object to determine if it can be added to this type's 
 /// Members collection. If this method returns without throwing, it is assumed
 /// the member is valid. 
 /// </summary>
 /// <param name="member">The member to validate</param>
 /// <exception cref="System.ArgumentException">Thrown if the member is not a EdmProperty</exception>
 internal override void ValidateMemberForAdd(EdmMember member)
 {
     Debug.Assert(Helper.IsEdmProperty(member) || Helper.IsNavigationProperty(member),
         "Only members of type Property may be added to Entity types.");
 }
コード例 #32
0
 /// <summary>
 /// Validates a EdmMember object to determine if it can be added to this type's 
 /// Members collection. If this method returns without throwing, it is assumed
 /// the member is valid. 
 /// </summary>
 /// <param name="member">The member to validate</param>
 /// <exception cref="System.ArgumentException">Thrown if the member is not a EdmProperty</exception>
 internal override void ValidateMemberForAdd(EdmMember member)
 {
     Debug.Assert(
         Helper.IsEdmProperty(member) || Helper.IsNavigationProperty(member),
         "Only members of type Property may be added to ComplexType.");
 }
コード例 #33
0
 /// <summary>
 /// Validates a EdmMember object to determine if it can be added to this type's 
 /// Members collection. If this method returns without throwing, it is assumed
 /// the member is valid. 
 /// </summary>
 /// <param name="member">The member to validate</param>
 /// <exception cref="System.ArgumentException">Thrown if the member is not an AssociationEndMember</exception>
 internal override void ValidateMemberForAdd(EdmMember member)
 {
     Debug.Assert(
         (member is AssociationEndMember),
         "Only members of type AssociationEndMember may be added to Association definitions.");
 }
コード例 #34
0
        /// <summary>
        /// determines if edmMember is part of the key of it's defining type.
        /// </summary>
        /// <param name="member"></param>
        /// <returns></returns>
        internal static bool IsPartOfKey(EdmMember edmMember)
        {
            if (Helper.IsRelationshipEndMember(edmMember))
            {
                return ((RelationshipType)edmMember.DeclaringType).KeyMembers.Contains(edmMember);
            }

            if (!Helper.IsEdmProperty(edmMember))
            {
                return false;
            }

            if (Helper.IsEntityTypeBase(edmMember.DeclaringType))
            {
                return ((EntityTypeBase)edmMember.DeclaringType).KeyMembers.Contains(edmMember);
            }

            return false;
        }
コード例 #35
0
ファイル: CqlGenerator.cs プロジェクト: uQr/referencesource
 /// <summary>
 /// Returns the slot index for the following member path: <paramref name="member"/>.<paramref name="child"/>, e.g., CPerson1.pid
 /// </summary>
 private int GetSlotIndex(MemberPath member, EdmMember child)
 {
     MemberPath fullMember = new MemberPath(member, child);
     int index = m_projectedSlotMap.IndexOf(fullMember);
     Debug.Assert(index != -1, "Couldn't locate " + fullMember.ToString() + " in m_projectedSlotMap");
     return index;
 }
コード例 #36
0
 // Generates T-SQL describing a member
 // Requires: member must belong to an entity type (a safe requirement for DML
 // SQL gen, where we only access table columns)
 private static string GenerateMemberTSql(EdmMember member)
 {
     // Don't check for cached sql belonging to this member
     // as methods are internal.
     //
     var entityType = (EntityType)member.DeclaringType;
     return SqlGenerator.QuoteIdentifier(member.Name);
 }
コード例 #37
0
 /// <summary>
 /// Given the type in the target space and the member name in the source space,
 /// get the corresponding member in the target space
 /// For e.g.  consider a Conceptual Type 'Foo' with a member 'Bar' and a CLR type
 /// 'XFoo' with a member 'YBar'. If one has a reference to Foo one can
 /// invoke GetMember(Foo,"YBar") to retrieve the member metadata for bar
 /// </summary>
 /// <param name="type">The type in the target perspective</param>
 /// <param name="memberName">the name of the member in the source perspective</param>
 /// <param name="ignoreCase">Whether to do case-sensitive member look up or not</param>
 /// <param name="outMember">returns the member in target space, if a match is found</param>
 internal virtual bool TryGetMember(StructuralType type, String memberName, bool ignoreCase, out EdmMember outMember)
 {
     EntityUtil.CheckArgumentNull(type, "type");
     EntityUtil.CheckStringArgument(memberName, "memberName");
     outMember = null;
     return(type.Members.TryGetValue(memberName, ignoreCase, out outMember));
 }