Example #1
0
        internal ResourceSetWrapper GetContainer(ResourceSetWrapper sourceContainer, ResourceType sourceResourceType, ResourceProperty navigationProperty)
        {
            ResourceAssociationSet set = this.GetResourceAssociationSet(sourceContainer, sourceResourceType, navigationProperty);

            if (set != null)
            {
                ResourceAssociationSetEnd end = set.GetRelatedResourceAssociationSetEnd(sourceContainer, sourceResourceType, navigationProperty);
                return(this.ValidateResourceSet(end.ResourceSet));
            }
            return(null);
        }
        internal static string GetAssociationName(ResourceAssociationSet associationSet)
        {
            ResourceAssociationSetEnd end  = (associationSet.End1.ResourceProperty != null) ? associationSet.End1 : associationSet.End2;
            ResourceAssociationSetEnd end2 = (end == associationSet.End1) ? ((associationSet.End2.ResourceProperty != null) ? associationSet.End2 : null) : null;
            string str = end.ResourceType.Name + '_' + end.ResourceProperty.Name;

            if (end2 != null)
            {
                str = string.Concat(new object[] { str, '_', end2.ResourceType.Name, '_', end2.ResourceProperty.Name });
            }
            return(str);
        }
Example #3
0
        internal ResourceAssociationSetEnd GetRelatedResourceAssociationSetEnd(ResourceSetWrapper resourceSet, ResourceType resourceType, ResourceProperty resourceProperty)
        {
            ResourceAssociationSetEnd end = this.GetResourceAssociationSetEnd(resourceSet, resourceType, resourceProperty);

            if (end == null)
            {
                return(null);
            }
            if (end != this.End1)
            {
                return(this.End1);
            }
            return(this.End2);
        }
Example #4
0
        /// <summary>
        /// Retrieve the related end for the given resource set, type and property.
        /// </summary>
        /// <param name="resourceSet">resource set for the source end</param>
        /// <param name="resourceType">resource type for the source end</param>
        /// <param name="resourceProperty">resource property for the source end</param>
        /// <returns>Related resource association set end for the given parameters</returns>
        internal ResourceAssociationSetEnd GetRelatedResourceAssociationSetEnd(ResourceSetWrapper resourceSet, ResourceType resourceType, ResourceProperty resourceProperty)
        {
            Debug.Assert(resourceSet != null, "resourceSet != null");
            Debug.Assert(resourceType != null, "resourceType != null");

            ResourceAssociationSetEnd thisEnd = this.GetResourceAssociationSetEnd(resourceSet, resourceType, resourceProperty);

            if (thisEnd != null)
            {
                return(thisEnd == this.End1 ? this.End2 : this.End1);
            }

            return(null);
        }
Example #5
0
 public ResourceAssociationSet(string name, ResourceAssociationSetEnd end1, ResourceAssociationSetEnd end2)
 {
     WebUtil.CheckStringArgumentNullOrEmpty(name, "name");
     WebUtil.CheckArgumentNull <ResourceAssociationSetEnd>(end1, "end1");
     WebUtil.CheckArgumentNull <ResourceAssociationSetEnd>(end2, "end2");
     if ((end1.ResourceProperty == null) && (end2.ResourceProperty == null))
     {
         throw new ArgumentException(Strings.ResourceAssociationSet_ResourcePropertyCannotBeBothNull);
     }
     if ((end1.ResourceType == end2.ResourceType) && (end1.ResourceProperty == end2.ResourceProperty))
     {
         throw new ArgumentException(Strings.ResourceAssociationSet_SelfReferencingAssociationCannotBeBiDirectional);
     }
     this.name = name;
     this.end1 = end1;
     this.end2 = end2;
 }
Example #6
0
 public ResourceAssociationSet(string name, ResourceAssociationSetEnd end1, ResourceAssociationSetEnd end2)
 {
     WebUtil.CheckStringArgumentNullOrEmpty(name, "name");
     WebUtil.CheckArgumentNull<ResourceAssociationSetEnd>(end1, "end1");
     WebUtil.CheckArgumentNull<ResourceAssociationSetEnd>(end2, "end2");
     if ((end1.ResourceProperty == null) && (end2.ResourceProperty == null))
     {
         throw new ArgumentException(Strings.ResourceAssociationSet_ResourcePropertyCannotBeBothNull);
     }
     if ((end1.ResourceType == end2.ResourceType) && (end1.ResourceProperty == end2.ResourceProperty))
     {
         throw new ArgumentException(Strings.ResourceAssociationSet_SelfReferencingAssociationCannotBeBiDirectional);
     }
     this.name = name;
     this.end1 = end1;
     this.end2 = end2;
 }
Example #7
0
        public override ResourceAssociationSet GetResourceAssociationSet(ResourceSet resourceSet, ResourceType resourceType, ResourceProperty resourceProperty)
        {
            ResourceSet  set;
            ResourceType type;
            string       str;

            WebUtil.CheckArgumentNull <ResourceSet>(resourceSet, "resourceSet");
            WebUtil.CheckArgumentNull <ResourceType>(resourceType, "resourceType");
            WebUtil.CheckArgumentNull <ResourceProperty>(resourceProperty, "resourceProperty");
            if (!base.TryResolveResourceSet(resourceSet.Name, out set) || (set != resourceSet))
            {
                throw new InvalidOperationException(System.Data.Services.Strings.BadProvider_UnknownResourceSet(resourceSet.Name));
            }
            if (!base.TryResolveResourceType(resourceType.FullName, out type) || (type != resourceType))
            {
                throw new InvalidOperationException(System.Data.Services.Strings.BadProvider_UnknownResourceType(resourceType.FullName));
            }
            if (resourceType != DataServiceProviderWrapper.GetDeclaringTypeForProperty(resourceType, resourceProperty, null))
            {
                throw new InvalidOperationException(System.Data.Services.Strings.BadProvider_ResourceTypeMustBeDeclaringTypeForProperty(resourceType.FullName, resourceProperty.Name));
            }
            ResourceType type2 = resourceProperty.ResourceType;

            if (type2.ResourceTypeKind != ResourceTypeKind.EntityType)
            {
                throw new InvalidOperationException(System.Data.Services.Strings.BadProvider_PropertyMustBeNavigationPropertyOnType(resourceProperty.Name, resourceType.FullName));
            }
            ResourceSet containerForResourceType = InternalGetContainerForResourceType(type2.InstanceType, base.EntitySets.Values);

            if (base.Types.Count <ResourceType>(rt => (rt.Name == resourceType.Name)) > 1)
            {
                str = resourceType.FullName.Replace('.', '_') + '_' + resourceProperty.Name;
            }
            else
            {
                str = resourceType.Name + '_' + resourceProperty.Name;
            }
            ResourceAssociationSetEnd end = new ResourceAssociationSetEnd(resourceSet, resourceType, resourceProperty);

            return(new ResourceAssociationSet(str, end, new ResourceAssociationSetEnd(containerForResourceType, type2, null)));
        }
Example #8
0
        private void PairUpNavigationProperty(MetadataProviderEdmEntityContainer entityContainer, ResourceSetWrapper resourceSet, ResourceType resourceType, ResourceProperty navigationProperty)
        {
            string key = string.Concat(new object[] { resourceSet.Name, '_', resourceType.FullName, '_', navigationProperty.Name });

            if (!this.associationSetByKeyCache.ContainsKey(key))
            {
                ResourceAssociationSet resourceAssociationSet = this.MetadataProvider.GetResourceAssociationSet(resourceSet, resourceType, navigationProperty);
                if (resourceAssociationSet != null)
                {
                    string str2;
                    string str3;
                    ResourceAssociationSetEnd end = resourceAssociationSet.GetRelatedResourceAssociationSetEnd(resourceSet, resourceType, navigationProperty);
                    if (end.ResourceProperty != null)
                    {
                        ResourceAssociationSet set2 = this.MetadataProvider.GetResourceAssociationSet(this.MetadataProvider.ValidateResourceSet(end.ResourceSet), end.ResourceType, end.ResourceProperty);
                        if ((set2 == null) || (resourceAssociationSet.Name != set2.Name))
                        {
                            throw new InvalidOperationException(System.Data.Services.Strings.ResourceAssociationSet_BidirectionalAssociationMustReturnSameResourceAssociationSetFromBothEnd);
                        }
                    }
                    if (end.ResourceProperty != null)
                    {
                        str2 = string.Concat(new object[] { end.ResourceSet.Name, '_', end.ResourceType.FullName, '_', end.ResourceProperty.Name });
                    }
                    else
                    {
                        str2 = string.Concat(new object[] { end.ResourceSet.Name, "_Null_", resourceType.FullName, '_', navigationProperty.Name });
                    }
                    if (this.associationSetByKeyCache.TryGetValue(str2, out str3))
                    {
                        throw new InvalidOperationException(System.Data.Services.Strings.ResourceAssociationSet_MultipleAssociationSetsForTheSameAssociationTypeMustNotReferToSameEndSets(str3, resourceAssociationSet.Name, end.ResourceSet.Name));
                    }
                    ResourceAssociationType resourceAssociationType = resourceAssociationSet.ResourceAssociationType;
                    this.PairUpNavigationPropertyWithResourceAssociationSet(entityContainer, resourceAssociationSet, resourceAssociationType, resourceType, navigationProperty);
                    this.associationSetByKeyCache.Add(str2, resourceAssociationSet.Name);
                    this.associationSetByKeyCache.Add(key, resourceAssociationSet.Name);
                }
            }
        }
Example #9
0
        public ResourceAssociationSet GetResourceAssociationSet(ResourceSetWrapper resourceSet, ResourceType resourceType, ResourceProperty resourceProperty)
        {
            ResourceAssociationSet set;

            resourceType = GetDeclaringTypeForProperty(resourceType, resourceProperty, null);
            string key = string.Concat(new object[] { resourceSet.Name, '_', resourceType.FullName, '_', resourceProperty.Name });

            if (!this.ResourceAssociationSetCache.TryGetValue(key, out set))
            {
                set = this.metadataProvider.GetResourceAssociationSet(resourceSet.ResourceSet, resourceType, resourceProperty);
                if (set != null)
                {
                    ResourceAssociationSetEnd end     = set.GetResourceAssociationSetEnd(resourceSet, resourceType, resourceProperty);
                    ResourceAssociationSetEnd end2    = set.GetRelatedResourceAssociationSetEnd(resourceSet, resourceType, resourceProperty);
                    ResourceSetWrapper        wrapper = this.ValidateResourceSet(end2.ResourceSet);
                    if (wrapper == null)
                    {
                        set = null;
                    }
                    else
                    {
                        ResourceType     type     = this.ValidateResourceType(end2.ResourceType);
                        ResourceProperty property = null;
                        if (end2.ResourceProperty != null)
                        {
                            ResourcePropertyKind stream = ResourcePropertyKind.Stream;
                            property = type.TryResolvePropertyName(end2.ResourceProperty.Name, stream);
                        }
                        resourceType = this.ValidateResourceType(end.ResourceType);
                        if ((((end.ResourceSet != resourceSet.ResourceSet) || (end.ResourceType != resourceType)) || ((end.ResourceProperty != resourceProperty) || (end2.ResourceSet != wrapper.ResourceSet))) || ((end2.ResourceType != type) || (end2.ResourceProperty != property)))
                        {
                            set = new ResourceAssociationSet(set.Name, new ResourceAssociationSetEnd(resourceSet.ResourceSet, resourceType, resourceProperty), new ResourceAssociationSetEnd(wrapper.ResourceSet, type, property));
                        }
                    }
                }
                this.ResourceAssociationSetCache.Add(key, set);
            }
            return(set);
        }
Example #10
0
 /// <summary>
 /// Writes the metadata for association set end.
 /// </summary>
 /// <param name="xmlWriter">xmlWriter in which metadata needs to be written</param>
 /// <param name="associationSetEnd">association set end to be written.</param>
 /// <param name="associationTypeEnd">corresponding association type end</param>
 private static void WriteAssociationSetEnd(XmlWriter xmlWriter, ResourceAssociationSetEnd associationSetEnd, ResourceAssociationTypeEnd associationTypeEnd)
 {
     xmlWriter.WriteStartElement(XmlConstants.End);
     xmlWriter.WriteAttributeString(XmlConstants.Role, associationTypeEnd.Name);
     xmlWriter.WriteAttributeString(XmlConstants.EntitySet, associationSetEnd.ResourceSet.Name);
     xmlWriter.WriteEndElement();
 }
        /// <summary>
        /// Gets the ResourceAssociationSet instance when given the source association end.
        /// </summary>
        /// <param name="resourceSet">Resource set of the source association end.</param>
        /// <param name="resourceType">Resource type of the source association end.</param>
        /// <param name="resourceProperty">Resource property of the source association end.</param>
        /// <returns>ResourceAssociationSet instance.</returns>
        public override ResourceAssociationSet GetResourceAssociationSet(ResourceSet resourceSet, ResourceType resourceType, ResourceProperty resourceProperty)
        {
            Debug.Assert(resourceSet != null, "resourceSet != null");
            Debug.Assert(resourceType != null, "resourceType != null");
            Debug.Assert(resourceProperty != null, "resourceProperty != null");
            Debug.Assert(resourceType == DataServiceProviderWrapper.GetDeclaringTypeForProperty(resourceType, resourceProperty), "resourceType should be the declaring type for resourceProperty");

            ResourceType targetType = resourceProperty.ResourceType;
            Debug.Assert(targetType != null && targetType.ResourceTypeKind == ResourceTypeKind.EntityType, "targetType != null && targetType.ResourceTypeKind == ResourceTypeKind.EntityType");

            ResourceSet targetSet = InternalGetContainerForResourceType(targetType.InstanceType, this.EntitySets.Values);
            Debug.Assert(targetSet != null, "targetSet != null");

            string associationName = resourceType.Name + '_' + resourceProperty.Name;

            // EF associations are first-class, navigation properties come second. So you actually
            // define the two-way association first, then say that the nav props "go through" them.
            // For CLR, however, there is no such constraint - in fact, we're very happy with one-way (link) associations.
            // For one-way associations, the target property is always null.
            ResourceAssociationSetEnd sourceEnd = new ResourceAssociationSetEnd(resourceSet, resourceType, resourceProperty);
            ResourceAssociationSetEnd targetEnd = new ResourceAssociationSetEnd(targetSet, targetType, null);
            return new ResourceAssociationSet(associationName, sourceEnd, targetEnd);
        }
Example #12
0
 public ResourceAssociationSet(string name, ResourceAssociationSetEnd end1, ResourceAssociationSetEnd end2)
 {
     throw new NotImplementedException();
 }
Example #13
0
		public ResourceAssociationSet (string name, ResourceAssociationSetEnd end1, ResourceAssociationSetEnd end2)
		{
			throw new NotImplementedException ();
		}
Example #14
0
        private void PairUpNavigationPropertyWithResourceAssociationSet(MetadataProviderEdmEntityContainer entityContainer, ResourceAssociationSet resourceAssociationSet, ResourceAssociationType resourceAssociationType, ResourceType resourceType, ResourceProperty navigationProperty)
        {
            string            associationEndName;
            EdmMultiplicity   multiplicity;
            EdmOnDeleteAction deleteBehavior;
            string            str3;
            EdmMultiplicity   multiplicity2;
            EdmOnDeleteAction none;
            string            typeNamespace;
            bool   flag          = (resourceAssociationSet.End1.ResourceProperty != null) && (resourceAssociationSet.End2.ResourceProperty != null);
            string entitySetName = MetadataProviderUtils.GetEntitySetName(resourceAssociationSet.End1.ResourceSet);
            string name          = MetadataProviderUtils.GetEntitySetName(resourceAssociationSet.End2.ResourceSet);
            bool   isPrinciple   = false;
            List <IEdmStructuralProperty> dependentProperties = null;

            if (resourceAssociationType != null)
            {
                associationEndName = resourceAssociationType.End1.Name;
                deleteBehavior     = resourceAssociationType.End1.DeleteBehavior;
                multiplicity2      = MetadataProviderUtils.ConvertMultiplicity(resourceAssociationType.End1.Multiplicity);
                str3         = resourceAssociationType.End2.Name;
                none         = resourceAssociationType.End2.DeleteBehavior;
                multiplicity = MetadataProviderUtils.ConvertMultiplicity(resourceAssociationType.End2.Multiplicity);
                ResourceReferentialConstraint referentialConstraint = resourceAssociationType.ReferentialConstraint;
                if (referentialConstraint != null)
                {
                    isPrinciple = object.ReferenceEquals(resourceAssociationType.End1, referentialConstraint.PrincipalEnd);
                    IEdmEntityType type = isPrinciple ? ((IEdmEntityType)this.EnsureSchemaType(resourceAssociationSet.End2.ResourceType)) : ((IEdmEntityType)this.EnsureSchemaType(resourceAssociationSet.End1.ResourceType));
                    dependentProperties = new List <IEdmStructuralProperty>();
                    foreach (ResourceProperty property in referentialConstraint.DependentProperties)
                    {
                        IEdmProperty property2 = type.FindProperty(property.Name);
                        dependentProperties.Add((IEdmStructuralProperty)property2);
                    }
                }
            }
            else
            {
                if (!flag)
                {
                    if (resourceAssociationSet.End1.ResourceProperty != null)
                    {
                        associationEndName = resourceType.Name;
                        str3 = navigationProperty.Name;
                    }
                    else
                    {
                        associationEndName = navigationProperty.Name;
                        str3 = resourceType.Name;
                    }
                }
                else
                {
                    associationEndName = MetadataProviderUtils.GetAssociationEndName(resourceAssociationSet.End1.ResourceType, resourceAssociationSet.End1.ResourceProperty);
                    str3 = MetadataProviderUtils.GetAssociationEndName(resourceAssociationSet.End2.ResourceType, resourceAssociationSet.End2.ResourceProperty);
                }
                multiplicity   = MetadataProviderUtils.GetMultiplicity(resourceAssociationSet.End1.ResourceProperty);
                deleteBehavior = EdmOnDeleteAction.None;
                multiplicity2  = MetadataProviderUtils.GetMultiplicity(resourceAssociationSet.End2.ResourceProperty);
                none           = EdmOnDeleteAction.None;
            }
            string associationName = (resourceAssociationType == null) ? MetadataProviderUtils.GetAssociationName(resourceAssociationSet) : resourceAssociationType.Name;

            if ((resourceAssociationType == null) || (resourceAssociationType.NamespaceName == null))
            {
                ResourceAssociationSetEnd end = (resourceAssociationSet.End1.ResourceProperty != null) ? resourceAssociationSet.End1 : resourceAssociationSet.End2;
                typeNamespace = this.GetTypeNamespace(end.ResourceType);
            }
            else
            {
                typeNamespace = resourceAssociationType.NamespaceName;
            }
            ResourceProperty resourceProperty = resourceAssociationSet.End1.ResourceProperty;
            ResourceProperty property4        = resourceAssociationSet.End2.ResourceProperty;
            MetadataProviderEdmNavigationProperty partnerProperty = null;
            MetadataProviderEdmNavigationProperty property6       = null;

            if (resourceProperty != null)
            {
                IEdmEntityType type2 = (IEdmEntityType)this.EnsureSchemaType(resourceAssociationSet.End1.ResourceType);
                partnerProperty = (MetadataProviderEdmNavigationProperty)type2.FindProperty(resourceProperty.Name);
            }
            if (property4 != null)
            {
                IEdmEntityType type3 = (IEdmEntityType)this.EnsureSchemaType(resourceAssociationSet.End2.ResourceType);
                property6 = (MetadataProviderEdmNavigationProperty)type3.FindProperty(property4.Name);
            }
            IEdmNavigationProperty property7 = (partnerProperty != null) ? ((IEdmNavigationProperty)partnerProperty) : ((IEdmNavigationProperty) new MetadataProviderEdmSilentNavigationProperty(property6, deleteBehavior, multiplicity, associationEndName));
            IEdmNavigationProperty partner   = (property6 != null) ? ((IEdmNavigationProperty)property6) : ((IEdmNavigationProperty) new MetadataProviderEdmSilentNavigationProperty(partnerProperty, none, multiplicity2, str3));

            MetadataProviderUtils.FixUpNavigationPropertyWithAssociationSetData(property7, partner, isPrinciple, dependentProperties, deleteBehavior, multiplicity);
            MetadataProviderUtils.FixUpNavigationPropertyWithAssociationSetData(partner, property7, !isPrinciple, dependentProperties, none, multiplicity2);
            EdmEntitySet entitySet = (EdmEntitySet)entityContainer.FindEntitySet(entitySetName);
            EdmEntitySet target    = (EdmEntitySet)entityContainer.FindEntitySet(name);

            if (partnerProperty != null)
            {
                entitySet.AddNavigationTarget(partnerProperty, target);
                this.SetAssociationSetName(entitySet, partnerProperty, resourceAssociationSet.Name);
                this.SetAssociationSetAnnotations(entitySet, partnerProperty, MetadataProviderUtils.ConvertCustomAnnotations(this, resourceAssociationSet.CustomAnnotations), MetadataProviderUtils.ConvertCustomAnnotations(this, resourceAssociationSet.End1.CustomAnnotations), MetadataProviderUtils.ConvertCustomAnnotations(this, resourceAssociationSet.End2.CustomAnnotations));
            }
            if (property6 != null)
            {
                target.AddNavigationTarget(property6, entitySet);
                this.SetAssociationSetName(target, property6, resourceAssociationSet.Name);
                if (partnerProperty == null)
                {
                    this.SetAssociationSetAnnotations(entitySet, property6, MetadataProviderUtils.ConvertCustomAnnotations(this, resourceAssociationSet.CustomAnnotations), MetadataProviderUtils.ConvertCustomAnnotations(this, resourceAssociationSet.End1.CustomAnnotations), MetadataProviderUtils.ConvertCustomAnnotations(this, resourceAssociationSet.End2.CustomAnnotations));
                }
            }
            this.SetAssociationNamespace(property7, typeNamespace);
            this.SetAssociationName(property7, associationName);
            this.SetAssociationEndName(property7, associationEndName);
            this.SetAssociationNamespace(partner, typeNamespace);
            this.SetAssociationName(partner, associationName);
            this.SetAssociationEndName(partner, str3);
            if (resourceAssociationType != null)
            {
                this.SetAssociationAnnotations(property7, MetadataProviderUtils.ConvertCustomAnnotations(this, resourceAssociationType.CustomAnnotations), MetadataProviderUtils.ConvertCustomAnnotations(this, (property7.GetPrimary() == property7) ? resourceAssociationType.End1.CustomAnnotations : resourceAssociationType.End2.CustomAnnotations), MetadataProviderUtils.ConvertCustomAnnotations(this, (property7.GetPrimary() == property7) ? resourceAssociationType.End2.CustomAnnotations : resourceAssociationType.End1.CustomAnnotations), MetadataProviderUtils.ConvertCustomAnnotations(this, (resourceAssociationType.ReferentialConstraint != null) ? resourceAssociationType.ReferentialConstraint.CustomAnnotations : null));
            }
        }
Example #15
0
 public ResourceAssociationSet(string name, ResourceAssociationSetEnd end1, ResourceAssociationSetEnd end2)
 {
     Contract.Requires(!string.IsNullOrEmpty(name));
     Contract.Requires(end1 != null);
     Contract.Requires(end2 != null);
 }
 public ResourceAssociationSet(string name, ResourceAssociationSetEnd end1, ResourceAssociationSetEnd end2)
 {
   Contract.Requires(!string.IsNullOrEmpty(name));
   Contract.Requires(end1 != null);
   Contract.Requires(end2 != null);
 }
 public override ResourceAssociationSet GetResourceAssociationSet(ResourceSet resourceSet, ResourceType resourceType, ResourceProperty resourceProperty)
 {
     ResourceSet set;
     ResourceType type;
     string str;
     WebUtil.CheckArgumentNull<ResourceSet>(resourceSet, "resourceSet");
     WebUtil.CheckArgumentNull<ResourceType>(resourceType, "resourceType");
     WebUtil.CheckArgumentNull<ResourceProperty>(resourceProperty, "resourceProperty");
     if (!base.TryResolveResourceSet(resourceSet.Name, out set) || (set != resourceSet))
     {
         throw new InvalidOperationException(System.Data.Services.Strings.BadProvider_UnknownResourceSet(resourceSet.Name));
     }
     if (!base.TryResolveResourceType(resourceType.FullName, out type) || (type != resourceType))
     {
         throw new InvalidOperationException(System.Data.Services.Strings.BadProvider_UnknownResourceType(resourceType.FullName));
     }
     if (resourceType != DataServiceProviderWrapper.GetDeclaringTypeForProperty(resourceType, resourceProperty, null))
     {
         throw new InvalidOperationException(System.Data.Services.Strings.BadProvider_ResourceTypeMustBeDeclaringTypeForProperty(resourceType.FullName, resourceProperty.Name));
     }
     ResourceType type2 = resourceProperty.ResourceType;
     if (type2.ResourceTypeKind != ResourceTypeKind.EntityType)
     {
         throw new InvalidOperationException(System.Data.Services.Strings.BadProvider_PropertyMustBeNavigationPropertyOnType(resourceProperty.Name, resourceType.FullName));
     }
     ResourceSet containerForResourceType = InternalGetContainerForResourceType(type2.InstanceType, base.EntitySets.Values);
     if (base.Types.Count<ResourceType>(rt => (rt.Name == resourceType.Name)) > 1)
     {
         str = resourceType.FullName.Replace('.', '_') + '_' + resourceProperty.Name;
     }
     else
     {
         str = resourceType.Name + '_' + resourceProperty.Name;
     }
     ResourceAssociationSetEnd end = new ResourceAssociationSetEnd(resourceSet, resourceType, resourceProperty);
     return new ResourceAssociationSet(str, end, new ResourceAssociationSetEnd(containerForResourceType, type2, null));
 }