示例#1
0
		/// <summary>
		/// Given a EDMX storage subtree, adapt it using the instance IModelAdapter
		/// </summary>
		/// <param name="storageReader">The EDMX storage subtree to walk</param>
		/// <returns></returns>
		private XmlReader AdaptStorageMetadata(XmlReader storageReader)
		{
			var xml = XElement.Load(storageReader);

			// Walk the SSDL EntitySets and adapt
			foreach (var storeEntitySet in xml.Descendants(DefaultNamespace + "EntitySet"))
				ModelAdapter.AdaptStoreEntitySet(storeEntitySet);
			// Walk the associative endpoints and adapt 
			foreach (var associationEnd in xml.Descendants(DefaultNamespace + "AssociationSet").Descendants(DefaultNamespace + "End"))
				ModelAdapter.AdaptStoreAssociationEnd(associationEnd);
			// Walk the Functions and adapt
			foreach (var function in xml.Descendants(DefaultNamespace + "Function"))
				ModelAdapter.AdaptStoreFunction(function);

			return xml.CreateReader();
		}