我试图从我的MetadataWorkspace中找到与FunctionImport映射的ComplexType。
相关的xml在edmx的CSSpace中存在,但我无法弄清如何将其取出。
我可以从SSpace中获取EdmFunction本身,但这并不告诉我它映射到的ComplexType,对吗?我也可以在CSpace中获取ComplexType本身,但这并不告诉我它映射到的FunctionImport...
在edmx中相关的xml为:
<FunctionImportMapping FunctionImportName="GetContactsByName" FunctionName="Test2Model.Store.GetContactsByName">
<ResultMapping>
<ComplexTypeMapping TypeName="Test2Model.GetContactsByName_Result">
<ScalarProperty Name="FirstName" ColumnName="FirstName" />
<ScalarProperty Name="LastName" ColumnName="LastName" />
<ScalarProperty Name="Address1" ColumnName="Address1" />
<ScalarProperty Name="Address2" ColumnName="Address2" />
<ScalarProperty Name="City" ColumnName="City" />
<ScalarProperty Name="StateID" ColumnName="StateID" />
<ScalarProperty Name="Country" ColumnName="Country" />
</ComplexTypeMapping>
</ResultMapping>
</FunctionImportMapping>
运行时,我可以获取StorageEntityMappingCollection,但我不确定接下来该怎么做:
((System.Data.Mapping.StorageMappingItemCollection)
metadataWorkspace.GetItemCollection(DataSpace.CSSpace)).First() // then what....all I see after this is a bunch of MetadataProperties which seem to take me in circles...