/// <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); } } }