本文整理汇总了C#中DataService类的典型用法代码示例。如果您正苦于以下问题:C# DataService类的具体用法?C# DataService怎么用?C# DataService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DataService类属于命名空间,在下文中一共展示了DataService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ZGWSAMPLE_SRV_SendingRequest
/// <summary>
/// The event handler of this entity container which occurs on each
/// Request sent to the serivce.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void ZGWSAMPLE_SRV_SendingRequest(object sender, System.Data.Services.Client.SendingRequestEventArgs e)
{
HttpWebRequest webRequest = e.Request as HttpWebRequest;
//ADN Modif
ServiceDetails serviceDetail = null; // ConfigurationReaderHandler.Instance.GetServiceDetails("ZGWSAMPLE_SRV");
if (serviceDetail == null)
{
serviceDetail = new ServiceDetails { Url = @"https://sapes1.sapdevcenter.com:443/sap/opu/odata/sap/ZGWSAMPLE_SRV/", Client = "", SSO = "BASIC" };
}
string language = System.Globalization.CultureInfo.CurrentUICulture.Name;
webRequest.Headers["Accept-Language"] = language;
BusinessConnectivityHelper.HandleSAPConnectivity(serviceDetail,ref webRequest);
//The Below section helps you handle delta token. If you wish to use the details then pass the AtomDeltaToken back to your application.
//To enable this section please set the value of "EnableDeltaToken" for the corresponding service to "Enabled".
if (serviceDetail.HandleDeltaTokenDecision)
{
DataService dataService = new DataService();
if (webRequest.Method == "GET")
{
HttpWebRequest clonedWebRequest = webRequest.CloneRequestForXSRFToken(webRequest.RequestUri.AbsoluteUri);
HttpWebResponse webResponse = clonedWebRequest.GetResponse() as HttpWebResponse;
if (webResponse.StatusCode == HttpStatusCode.OK)
{
string response = webResponse.ReadResponse();
this.AtomDeltaToken = dataService.ReadResponse<AtomDeltaTokens>(response);
}
}
}
}
示例2: Test1
public void Test1()
{
var ds = new DataService<NorthwindDB>();
var mp = ds.GetService(typeof(IDataServiceMetadataProvider));
}
示例3: AddRemoveCategory
public void AddRemoveCategory()
{
var context = new CoreDataContext();
var uow = new EntityFrameworkUnitOfWork(context);
var repo = new EntityFrameworkRepository<Guid, Category, GuidIdInitializer>(context);
var caregoryService = new DataService<Guid, Category, EntityFrameworkRepository<Guid, Category, GuidIdInitializer>>(uow, repo);
var newCategory = caregoryService.Add(new Category
{
Name = "Computres",
Categories = new List<Category>
{
new Category { Name = "-DeskTops" },
new Category { Name = "-Servers" },
new Category { Name = "-Laptops", Categories = new List<Category>
{
new Category { Name = "--Tablets" },
new Category { Name = "--Shmablets" },
}
},
}
});
var justAdded = caregoryService.Get(c => c.Id == newCategory.Id);
Assert.AreEqual(justAdded.Categories.Count, newCategory.Categories.Count);
caregoryService.Remove(justAdded);
justAdded = caregoryService.Get(c => c.Id == newCategory.Id);
Assert.IsNull(justAdded);
}
示例4: MapViewModel
public MapViewModel(INavigationResolver resolver, DataService.IGeoDataService service)
{
_resolver = resolver;
_service = service;
Issues = new ObservableCollection<DataService.IssueItem>();
InitData();
}
示例5: when_a_customer_is_requested
public when_a_customer_is_requested()
{
fakeDataService = A.Fake<DataService>();
//A.CallTo(() => fakeDataService.AddMessage()).MustHaveHappened();
handler = new GetIndex(fakeDataService);
}
示例6: SyncService
/// <summary>
/// Fire up the repos and service context in the constructor.
/// </summary>
/// <param name="oAuthorization"></param>
public SyncService(OAuthorizationdto oAuthorization)
{
dataserviceFactory = new DataserviceFactory(oAuthorization);
dataService = dataserviceFactory.getDataService();
syncObjects = new Syncdto();
syncRepository = new SyncRepository();
}
示例7: TestDeleteValue
public void TestDeleteValue()
{
DataService dataService = new DataService();
dataService.SetValue("TestKey", "TestValue");
dataService.DeleteValue("TestKey");
Assert.IsInstanceOf(typeof(KeyNotFoundException), dataService.GetValue("TestKey").ThrownException);
}
示例8: client_GetGestureDataCompleted
void client_GetGestureDataCompleted(object sender, DataService.GetGestureDataCompletedEventArgs e)
{
if (e.Error == null)
{
gestureInfo = SerializationHelper.Desirialize(e.Result);
defBuilder.AddGesture(gestureInfo);
}
}
示例9: Load_Data
private void Load_Data()
{
DataService dataservice = new DataService();
dataSet = dataservice.GetSubjectAndWords();
Page.Session["DataSet"] = dataSet;
}
示例10: getAnswers
//Metodo para obtener las Respuestas desde la base de datos.
public void getAnswers(){
ds = new DataService("medicina.db"); /*Especifia nombre de la base de datos*/
ds.CreateDB ();
var respuestas=ds.GetRespuestas(); /*El numero 1 es el ID de la pregunta que estamos evaluando*/
foreach(var respuesta in respuestas){
answer = respuesta.Texto;
}
}
示例11: SqliteEntityLiteProvider
public SqliteEntityLiteProvider(DataService dataService)
: base(dataService)
{
if (DataService.ProviderName != ProviderName)
{
throw new InvalidOperationException(this.GetType().Name + " is for " + ProviderName + ". Not for " + DataService.ProviderName);
}
}
示例12: LayDsQuyDinh
public DataTable LayDsQuyDinh()
{
SqlCommand cmd = new SqlCommand("SELECT * FROM QUYDINH");
DataService dS = new DataService();
dS.Load(cmd);
m_QuyDinhData = dS;
return m_QuyDinhData;
}
示例13: XoaPhieuThu
public int XoaPhieuThu(int SoPT)
{
SqlCommand cmd = new SqlCommand("dbo.Delete_PhieuThu");
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@SoPT", SoPT));
DataService dS = new DataService();
return dS.ExecuteNoneQuery(cmd);
}
示例14: Main
static void Main(string[] args)
{
DataService dataService = new DataService(new IntData());
dataService.SendAndReceive();
dataService.SetData(new StringData());
dataService.SendAndReceive();
}
示例15: LayDsNhanVien
public DataTable LayDsNhanVien()
{
SqlCommand cmd = new SqlCommand(TruyVanChung());
DataService dS = new DataService();
dS.Load(cmd);
m_NhanVienData = dS;
return m_NhanVienData;
}