執行存儲過程所以我有一個WCF數據服務並與.NET 4.5運行時,EF6 & WCF數據服務5.6,並在InitializeService以下WCF數據服務使用OData的錯誤協議版本
public static void InitializeService(DataServiceConfiguration config)
{
config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
config.UseVerboseErrors = true;
}
我有一個我已經添加了一個服務引用過,一切的.Net MVC應用程序似乎不過是工作和訪問,當我嘗試和返回複雜類型我得到以下錯誤的集合:
Collection types are only supported in version 3.0 of the OData protocol and higher versions. They are not supported in version 1.0.
我也注意到我的service.edmx有dataService v1:
<edmx:DataServices m:DataServiceVersion="1.0" m:MaxDataServiceVersion="3.0" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
我已經測試了下面的存儲過程和參數提琴手服務URL,我可以看到它使用serviceVersion 1.0在頭然而,當我嘗試使用VAR它拋出上述異常的參數。
string querystring = string.Format("GetSecurityIdByName?securityName='{0}'", maincompany.Name);
IEnumerable<get_security_id_by_name_Result> getsecurityid = context.Execute<get_security_id_by_name_Result>(new Uri(querystring, UriKind.Relative), "GET", false);
我在想什麼?我如何強制它/使用v3執行sproc?
TIA