title: Custom Odata v4 function - is not a valid odata route template - resource not found for the segment
body: <p>I have something in mind like this ( the action on itself is probably okay)</p>
  
  <pre><code>    [HttpPost]
      [ODataRoute("GenerateFromProduct")]
      public async Task&lt;IHttpActionResult&gt; GenerateFromProduct([FromBodyAttribute] Product product)
      {
          if(!ModelState.IsValid)
          {
              return BadRequest();
          }
  
          List&lt;string[]&gt; combos = new List&lt;string[]&gt;();
          List&lt;ProductVariant&gt; productVariants = product.GenerateProductVariants();
          db.ProductVariants.AddRange(productVariants);
  
          await db.SaveChangesAsync();
  
          return Ok(productVariants);
      }
  </code></pre>
  
  <p>The action defined in WebApiConfig would probably be something like this:</p>
  
  <pre><code> builder.EntityType&lt;ProductVariant&gt;().Collection
   .Function("GenerateFromProduct").Returns&lt;List&lt;ProductVariant&gt;&gt;().EntityParameter&lt;Product&gt;("product");
  </code></pre>
  
  <p>But i keep getting the following error ( after several rewrites)</p>
  
  <pre><code>An exception of type 'System.InvalidOperationException' occurred in System.Web.OData.dll but was not handled in user code
  
  Additional information: The path template 'GenerateFromProduct' on the action 'GenerateFromProduct' in controller 'ProductVariants' is not a valid OData path template. Resource not found for the segment 
  </code></pre>
  
  <p>Any ideas what i'm doing wrong? I didn't find a lot of information online about odata and custom functions / actions except the ones on msdn.</p>