0

전 ADO.NET/WCF Data Services를 처음 사용했습니다.V2를 사용하도록 ADO.NET Data Services MaxProtocolVersion을 어떻게 설정합니까?

config.DataServiceBehavior.MaxProtocolVersion = Common.DataServiceProtocolVersion.V2 

그러나이 속성은되지 않습니다 : 온라인

The response requires that version 2 of the protocol be used, but the MaxProtocolVersion of the data service is set to DataServiceProtocolVersion.V1.

참조 내가 설정할 필요가 있음을 나타냅니다 설정과 ADO.NET 데이터 서비스를 테스트 나의 처음에, 나는이 수수께끼 오류에 달렸다 IntelliSense에서 사용할 수 있으며 수동으로 코딩 할 때 빌드 오류가 발생합니다.

Visual Studio 2008 SP1, .NET 3.5 SP1 및 VB.NET을 사용하고 있습니다. 프로토콜 버전 2를 어떻게 활성화합니까?

답변

1

는 하루 정도 및 검색 (그리고 VS2008에 SP1을 다시 적용)의 절반 후,이 블로그 기사는 마지막까지 일을 삭제 :

Astoria V.Next Ships for .NET 3.5 SP1 -> Versioning Issue

모든 것을 내 설치에 괜찮다고 밝혀,하지만 난 생략했다 InitilizeService() 메서드의 시그니처가 미묘하게 변경되었다는 사실을 넘어서야합니다. 스티븐 포르테는 자신의 블로그에서 알 수 있듯이 :

1: //change the IDataServiceConfiguration to DataServiceConfiguration 
2: public static void InitializeService(DataServiceConfiguration config) 
3: { 
4:  config.SetEntitySetAccessRule("*", EntitySetRights.All); 
5:  //take advantage of the "2.0" features 
6:  config.DataServiceBehavior.MaxProtocolVersion = 
7:   System.Data.Services.Common.DataServiceProtocolVersion.V2; 
8: } 

The first thing that you need to change is on line 2, change the interface IDataServiceConfiguration to be just DataServiceConfiguration (I am sure that there is a better way to do this, I have not figured it out yet.). Next, set the MaxProtocolVersion property of DataServiceBehavior to V2. After that you can take advantage of all the new features!

강조 광산. 단순한 "나"의 차이점을 놀라게합니다. 스티븐의 우려에 대답하기 위해,이 또한 MSDN에 의해 ​​지원을 받고 있습니다,하지만 그들은 현재 구현 객체 대 인터페이스를 참조에 차이를 지적하지 않습니다

: 여기

Configuring the Data Service (ADO.NET Data Services)

VB에서 코드입니다

'change the IDataServiceConfiguration to DataServiceConfiguration 
Public Shared Sub InitializeService(ByVal config As DataServiceConfiguration) 
    config.SetEntitySetAccessRule("*", EntitySetRights.All) 
    'take advantage of the "2.0" features 
    config.DataServiceBehavior.MaxProtocolVersion = System.Data.Services.Common.DataServiceProtocolVersion.V2 
End Sub 

컴파일, 테스트 및 통과되었습니다. 나는 방금 더 큰 세상으로 첫발을 내디뎠다. ...