/// <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="System.Data.Entity.Core.Metadata.Edm.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;

            var timestampMembers = _edmType.Members.Where(ObjectContextUtilities.IsConcurrencyTimestamp).ToArray();

            if (timestampMembers.Length == 1)
            {
                _timestampMember = timestampMembers[0];
            }

            if (edmType.BuiltInTypeKind != BuiltInTypeKind.EntityType)
            {
                return;
            }
            // if any FK member of any association is also part of the primary key, then the key cannot be marked
            // Editable(false)
            var entityType = (EntityType)edmType;

            _foreignKeyMembers = new HashSet <EdmMember>(entityType.NavigationProperties.SelectMany(p => p.GetDependentProperties()));
            foreach (var foreignKeyMember in _foreignKeyMembers)
            {
                if (!entityType.KeyMembers.Contains(foreignKeyMember))
                {
                    continue;
                }
                _keyIsEditable = true;
                break;
            }
        }
        public LinqToEntitiesMetadataProvider(Type contextType, MetadataProvider parent, bool isDbContext)
            : base(parent)
        {
            _isDbContext = isDbContext;

            _typeDescriptionContext = TdpContextMap.GetOrAdd(
                contextType,
                type => new LinqToEntitiesTypeDescriptionContext(contextType, _isDbContext));
        }
        /// <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="System.Data.Entity.Core.Metadata.Edm.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;

            var timestampMembers = _edmType.Members.Where(ObjectContextUtilities.IsConcurrencyTimestamp).ToArray();
            if (timestampMembers.Length == 1)
                _timestampMember = timestampMembers[0];

            if (edmType.BuiltInTypeKind != BuiltInTypeKind.EntityType)
                return;
            // if any FK member of any association is also part of the primary key, then the key cannot be marked
            // Editable(false)
            var entityType = (EntityType) edmType;
            _foreignKeyMembers = new HashSet<EdmMember>(entityType.NavigationProperties.SelectMany(p => p.GetDependentProperties()));
            foreach (var foreignKeyMember in _foreignKeyMembers) {
                if (!entityType.KeyMembers.Contains(foreignKeyMember))
                    continue;
                _keyIsEditable = true;
                break;
            }
        }