title: TVF with EF6 and WCF 5.6.3
body: <p>I'm running into an exception when attempting to use Table Value Functions with Entity Framework 6.1.3 and WCF 5.6.3. End goal is to perform Restful queries against these TVFs, which return a result table back to the requester for further formatting. One question I do have is, do I need to also import the associated tables associated with the TVFs into the model?</p>
  
  <pre><code>The server encountered an error processing the request. 
  The exception message is 'Exception has been thrown by the target of an invocation.'. 
  See server logs for more details. The exception stack trace is:
  
  at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) 
  at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) 
  at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) 
  at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) 
  at System.Data.Services.DataServiceConfiguration.InvokeStaticInitialization(Type type) 
  at System.Data.Services.DataServiceConfiguration.Initialize(Type type) 
  at System.Data.Services.DataService`1.CreateConfiguration(Type dataServiceType, IDataServiceMetadataProvider provider, Boolean isInternallyCreatedProvider) 
  at System.Data.Services.DataService`1.CreateProvider() 
  at System.Data.Services.DataService`1.EnsureProviderAndConfigForRequest() 
  at System.Data.Services.DataService`1.HandleRequest() 
  at System.Data.Services.DataService`1.ProcessRequestForMessage(Stream messageBody) at SyncInvokeProcessRequestForMessage(Object , Object[] , Object[] ) 
  at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp; outputs) 
  at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc) 
  at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc) 
  at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&amp; rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
  </code></pre>
  
  <p>In the model's class, each corresponding TVF has a method:</p>
  
  <pre><code>    [DbFunction("MyEntities", "func_Info")]
      public virtual IQueryable&lt;func_Info_Result&gt; func_Info(string buildNumber)
      {
          var bNumberParameter = bNumber != null ?
              new ObjectParameter("bNumber", bNumber) :
              new ObjectParameter("bNumber", typeof(string));
  
          return ((IObjectContextAdapter)this).ObjectContext.CreateQuery&lt;func_Info_Result&gt;("[MyEntities].[func_Info](@bNumber)", bNumberParameter);
      }
  </code></pre>
  
  <p>And I'm calling it in the typical fashion in InitializeService, which is where the exception is generated:</p>
  
  <pre><code>config.SetEntitySetAccessRule("func_Info", EntitySetRights.AllRead);
  </code></pre>
  
  <p>EDIT: Inner Exception:</p>
  
  <pre><code>&lt;Message&gt;The given name 'func_Info' was not found in the entity sets.
  </code></pre>
  
  <p>Parameter name: name</p>