本文整理汇总了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++;
}
}
}
示例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);
}
}
}
}