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


C# Reference.AddMetaInfo方法代码示例

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


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

示例1: Process_OperationContractReferences

        /// <summary>
        /// Creates references for operation contract.
        /// </summary>
        /// <param name="node">The node.</param>
        private void Process_OperationContractReferences(dynamic node)
        {
            OperationContract operationContract = context.GetObject(node);

            // This
            Reference thisReference = new Reference();
            thisReference.Name = "this";
            thisReference.Object = operationContract.Contract;
            operationContract.References.Add(thisReference);

            // Result
            if (operationContract.Operation.ReturnType != PseudoType.Async && operationContract.Operation.ReturnType != PseudoType.Void)
            {
                Reference resultReference = new Reference();
                resultReference.Name = "result";
                resultReference.Object = operationContract.Operation.ReturnType;
                resultReference.AddMetaInfo(new SourceLocationInfo(node.Operation.ReturnType, context));
                context.AddObject(node.Operation.ReturnType, resultReference);
                operationContract.References.Add(resultReference);
            }

            // Parameters
            if (node.Operation.Parameters != null)
            {
                int index = 0;
                foreach (dynamic parameter in node.Operation.Parameters)
                {
                    Reference parameterReference = new Reference();
                    parameterReference.Name = parameter.Name;
                    parameterReference.Object = operationContract.Operation.Parameters[index];
                    parameterReference.AddMetaInfo(new SourceLocationInfo(parameter, context));
                    context.AddObject(parameter, parameterReference);

                    try
                    {
                        NameContext.Current.CheckName(parameterReference.Name, typeof(Reference));
                        operationContract.References.Add(parameterReference);
                    }
                    catch (NameCollisionException exception)
                    {
                        Error_NameExists(parameterReference, exception);
                    }

                    index++;
                }
            }
        }
开发者ID:st9200,项目名称:soal-oslo,代码行数:51,代码来源:ExpressionParser.cs

示例2: Process_OperationAuthorizationReferences

        /// <summary>
        /// Creates references for operation authorization.
        /// </summary>
        /// <param name="node">The node.</param>
        private void Process_OperationAuthorizationReferences(dynamic node)
        {
            OperationAuthorization operationAuthorization = context.GetObject(node);

            // This
            Reference thisReference = new Reference();
            thisReference.Name = "this";
            thisReference.Object = operationAuthorization.Authorization;
            operationAuthorization.References.Add(thisReference);

            // Parameters
            if (node.Operation.Parameters != null)
            {
                int index = 0;
                foreach (dynamic parameter in node.Operation.Parameters)
                {
                    Reference parameterReference = new Reference();
                    parameterReference.Name = parameter.Name;
                    parameterReference.Object = operationAuthorization.Operation.Parameters[index];
                    parameterReference.AddMetaInfo(new SourceLocationInfo(parameter, context));
                    context.AddObject(parameter, parameterReference);

                    try
                    {
                        NameContext.Current.CheckName(parameterReference.Name, typeof(Reference));
                        operationAuthorization.References.Add(parameterReference);
                    }
                    catch (NameCollisionException exception)
                    {
                        Error_NameExists(parameterReference, exception);
                    }

                    index++;
                }
            }

            // Claims
            if (node.OperationAuthorizationClaims != null)
            {
                foreach (dynamic claim in node.OperationAuthorizationClaims)
                {
                    Reference claimReference = new Reference();
                    claimReference.Name = claim.Name;
                    claimReference.AddMetaInfo(new SourceLocationInfo(claim, context));
                    context.AddObject(claim, claimReference);

                    try
                    {
                        List<string> identifiers = this.Process_IdentifierList(claim.Type);
                        SoaObject scope = NameContext.Current.ResolveFirstName(identifiers[0], typeof(Namespace), typeof(ClaimsetType));
                        for (int i = 1; i < identifiers.Count; i++)
                        {
                            scope = NameContext.ResolveName(scope, identifiers[i], typeof(Namespace), typeof(ClaimsetType), typeof(ClaimField));
                        }
                        claimReference.Object = scope;
                    }
                    catch (NameNotFoundException ex)
                    {
                        Error_NameNotFound(new SourceLocationInfo(claim, context), ex);
                    }
                    catch (NameCollisionException ex)
                    {
                        Error_NameCollision(new SourceLocationInfo(claim, context), ex);
                    }

                    try
                    {
                        NameContext.Current.CheckName(claimReference.Name, typeof(Reference));
                        operationAuthorization.References.Add(claimReference);
                    }
                    catch (NameCollisionException exception)
                    {
                        Error_NameExists(claimReference, exception);
                    }
                }
            }
        }
开发者ID:st9200,项目名称:soal-oslo,代码行数:81,代码来源:ExpressionParser.cs


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