本文整理汇总了C#中MetadataWorkspace.TryGetObjectSpaceType方法的典型用法代码示例。如果您正苦于以下问题:C# MetadataWorkspace.TryGetObjectSpaceType方法的具体用法?C# MetadataWorkspace.TryGetObjectSpaceType怎么用?C# MetadataWorkspace.TryGetObjectSpaceType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetadataWorkspace
的用法示例。
在下文中一共展示了MetadataWorkspace.TryGetObjectSpaceType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetClrTypeForCSpaceType
/// <summary>Gets the CLR type mapped to the specified C-Space type.</summary>
/// <param name="workspace">Workspace in which the type is defined.</param>
/// <param name="edmType">C-Space type whose matching clr type needs to be looked up.</param>
/// <returns>The resolved <see cref="Type"/> for the given <paramref name="edmType"/>.</returns>
internal static Type GetClrTypeForCSpaceType(MetadataWorkspace workspace, StructuralType edmType)
{
Debug.Assert(workspace != null, "workspace != null");
Debug.Assert(edmType != null, "edmType != null");
Debug.Assert(
edmType.BuiltInTypeKind == BuiltInTypeKind.EntityType || edmType.BuiltInTypeKind == BuiltInTypeKind.ComplexType,
"Must be entityType or complexType");
StructuralType ospaceType;
if (workspace.TryGetObjectSpaceType(edmType, out ospaceType))
{
ObjectItemCollection objectItemCollection = (ObjectItemCollection)workspace.GetItemCollection(DataSpace.OSpace);
return objectItemCollection.GetClrType(ospaceType);
}
return null;
}