本文整理汇总了C#中System.CodeDom.CodeNamespace.DeclareExtensionMethodContainerType方法的典型用法代码示例。如果您正苦于以下问题:C# CodeNamespace.DeclareExtensionMethodContainerType方法的具体用法?C# CodeNamespace.DeclareExtensionMethodContainerType怎么用?C# CodeNamespace.DeclareExtensionMethodContainerType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.CodeDom.CodeNamespace
的用法示例。
在下文中一共展示了CodeNamespace.DeclareExtensionMethodContainerType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddFunctionsInNamespaceIfRequired
/// <summary>
/// Adds functions into the Poco code generator
/// </summary>
/// <param name="namespaceName">Namespace of functions to add</param>
/// <param name="codeNamespace">Namespace to put static Extension type container</param>
/// <param name="functions">functions from the model</param>
protected override void AddFunctionsInNamespaceIfRequired(string namespaceName, CodeNamespace codeNamespace, IEnumerable<Function> functions)
{
// Only get functions that are bound to an entityType or collection other wise not interesting to add an extension method
IEnumerable<Function> namespaceFunctions = functions.Where(func => func.NamespaceName == namespaceName && func.Annotations.OfType<ServiceOperationAnnotation>().Any(s => s.BindingKind.IsBound()));
if (functions != null)
{
CodeTypeDeclaration functionExtensionClass = null;
foreach (Function function in namespaceFunctions)
{
// add the extension method container class
if (functionExtensionClass == null)
{
functionExtensionClass = codeNamespace.DeclareExtensionMethodContainerType(namespaceName + "ExtensionMethod");
}
this.DeclareExtensionMethod(functionExtensionClass, function);
}
}
}