本文整理汇总了C#中DataService类的典型用法代码示例。如果您正苦于以下问题:C#DataService类的具体用法?C#DataService怎么用?C#DataService使用的例子?这里精选的类代码示例或许可以为您提供帮助。
示例1:ZGWSAMPLE_SRV_SendingRequest
///
///Theeventhandlerofthisentitycontainerwhichoccursoneach
///Requestsenttotheserivce.
///
///
///
voidZGWSAMPLE_SRV_SendingRequest(objectsender,System.Data.Services.Client.SendingRequestEventArgse)
{
HttpWebRequestwebRequest=e.RequestasHttpWebRequest;
//ADNModif
ServiceDetailsserviceDetail=null;//ConfigurationReaderHandler.Instance.GetServiceDetails("ZGWSAMPLE_SRV");
if(serviceDetail==null)
{
serviceDetail=newServiceDetails{Url=@"https://sapes1.sapdevcenter.com:443/sap/opu/odata/sap/ZGWSAMPLE_SRV/",Client="",SSO="BASIC"};
} stringlanguage=System.Globalization.CultureInfo.CurrentUICulture.Name;
webRequest.Headers["Accept-Language"]=language;
BusinessConnectivityHelper.HandleSAPConnectivity(serviceDetail,refwebRequest);
//TheBelowsectionhelpsyouhandledeltatoken.IfyouwishtousethedetailsthenpasstheAtomDeltaTokenbacktoyourapplication.
//Toenablethissectionpleasesetthevalueof"EnableDeltaToken"forthecorrespondingserviceto"Enabled".
if(serviceDetail.HandleDeltaTokenDecision) { DataServicedataService=newDataService(); if(webRequest.Method=="GET") { HttpWebRequestclonedWebRequest=webRequest.CloneRequestForXSRFToken(webRequest.RequestUri.AbsoluteUri); HttpWebResponsewebResponse=clonedWebRequest.GetResponse()asHttpWebResponse; if(webResponse.StatusCode==HttpStatusCode.OK) { stringresponse=webResponse.ReadResponse(); this.AtomDeltaToken=dataService.ReadResponse(response); } } } }
原文链接:http://www.jxszl.com/biancheng/C/556880.html