当前位置: 首页>>代码示例>>C#>>正文


C# MetadataWorkspace.TryGetEntityContainer方法代码示例

本文整理汇总了C#中MetadataWorkspace.TryGetEntityContainer方法的典型用法代码示例。如果您正苦于以下问题:C# MetadataWorkspace.TryGetEntityContainer方法的具体用法?C# MetadataWorkspace.TryGetEntityContainer怎么用?C# MetadataWorkspace.TryGetEntityContainer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MetadataWorkspace的用法示例。


在下文中一共展示了MetadataWorkspace.TryGetEntityContainer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: VerifyExtent

        // Verifies the given extent is present in the given workspace.
        private static void VerifyExtent(MetadataWorkspace workspace, EntitySetBase extent)
        {
            // get the container to which the given extent belongs
            EntityContainer actualContainer = extent.EntityContainer;

            // try to retrieve the container in the given workspace
            EntityContainer referenceContainer = null;
            if (null != actualContainer)
            {
                workspace.TryGetEntityContainer(
                    actualContainer.Name, actualContainer.DataSpace, out referenceContainer);
            }
            
            // determine if the given extent lives in a container from the given workspace
            // (the item collections for each container are reference equivalent when they are declared in the
            // same item collection)
            if (null == actualContainer || null == referenceContainer ||
                !Object.ReferenceEquals(actualContainer, referenceContainer)) 
            {
                // 



                throw EntityUtil.Update(System.Data.Entity.Strings.Update_WorkspaceMismatch, null);
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:27,代码来源:UpdateTranslator.cs

示例2: FindFunctionImport

        // requires: all arguments must be given
        internal static EdmFunction FindFunctionImport(MetadataWorkspace workspace, string containerName, string functionImportName)
        {
            Debug.Assert(null != workspace && null != containerName && null != functionImportName);
            // find entity container
            EntityContainer entityContainer;
            if (!workspace.TryGetEntityContainer(containerName, DataSpace.CSpace, out entityContainer))
            {
                throw EntityUtil.InvalidOperation(System.Data.Entity.Strings.EntityClient_UnableToFindFunctionImportContainer(
                    containerName));
            }

            // find function import
            EdmFunction functionImport = null;
            foreach (EdmFunction candidate in entityContainer.FunctionImports)
            {
                if (candidate.Name == functionImportName)
                {
                    functionImport = candidate;
                    break;
                }
            }
            if (null == functionImport)
            {
                throw EntityUtil.InvalidOperation(System.Data.Entity.Strings.EntityClient_UnableToFindFunctionImport(
                    containerName, functionImportName));
            }
            if (functionImport.IsComposableAttribute)
            {
                throw EntityUtil.InvalidOperation(System.Data.Entity.Strings.EntityClient_FunctionImportMustBeNonComposable(containerName + "." + functionImportName));
            }
            return functionImport;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:33,代码来源:CommandHelper.cs

示例3: FindFunctionImport

        // requires: all arguments must be given
        internal static EdmFunction FindFunctionImport(MetadataWorkspace workspace, string containerName, string functionImportName)
        {
            DebugCheck.NotNull(workspace);
            DebugCheck.NotNull(containerName);
            DebugCheck.NotNull(functionImportName);

            // find entity container
            EntityContainer entityContainer;
            if (!workspace.TryGetEntityContainer(containerName, DataSpace.CSpace, out entityContainer))
            {
                throw new InvalidOperationException(
                    Strings.EntityClient_UnableToFindFunctionImportContainer(
                        containerName));
            }

            // find function import
            EdmFunction functionImport = null;
            foreach (var candidate in entityContainer.FunctionImports)
            {
                if (candidate.Name == functionImportName)
                {
                    functionImport = candidate;
                    break;
                }
            }
            if (null == functionImport)
            {
                throw new InvalidOperationException(
                    Strings.EntityClient_UnableToFindFunctionImport(
                        containerName, functionImportName));
            }
            if (functionImport.IsComposableAttribute)
            {
                throw new InvalidOperationException(
                    Strings.EntityClient_FunctionImportMustBeNonComposable(containerName + "." + functionImportName));
            }
            return functionImport;
        }
开发者ID:jwanagel,项目名称:jjwtest,代码行数:39,代码来源:CommandHelper.cs


注:本文中的MetadataWorkspace.TryGetEntityContainer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。