This question is locked. New answers and comments are not allowed.
Hi, i have a problem with stored procedures when using WCF.
No error when querying a Telerik Data Access Domain Model.
To make things easier i create a simple stored procedure, just to get a server date/time.
After mapping a domain method result to a single scalar value, i can run the code below with no problem, when querying a Telerik Data Access Domain Model.
In WCF i crated a create a service operation method and changed the service operation access rules in the InitializeService method.
When a execute the code below, even in a browser (using the url) it works just a few times, 8 or 9 e becames very slow geting timeouts.
Thank you
No error when querying a Telerik Data Access Domain Model.
To make things easier i create a simple stored procedure, just to get a server date/time.
CREATE PROCEDURE dbo.ServerDateTime
AS
BEGIN
select SYSDATETIME()
END
After mapping a domain method result to a single scalar value, i can run the code below with no problem, when querying a Telerik Data Access Domain Model.
using
(EntitiesModel dbContext =
new
EntitiesModel())
{
for
(
int
n = 0; n < 10; n++)
{
DateTime result = dbContext.ServerDateTime();
Console.WriteLine(
"Server time: {0}"
, result);
}
}
In WCF i crated a create a service operation method and changed the service operation access rules in the InitializeService method.
public
partial
class
EntitiesModelService : OpenAccessDataService<SPinWCFdal.EntitiesModel>
{
[WebGet]
public
DateTime ServerDateTime()
{
return
this
.CurrentDataSource.ServerDateTime();
}
}
public
static
void
InitializeService(DataServiceConfiguration config)
{
config.SetEntitySetAccessRule(
"Table1"
, EntitySetRights.All);
config.SetServiceOperationAccessRule(
"ServerDateTime"
, ServiceOperationRights.All);
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
}
When a execute the code below, even in a browser (using the url) it works just a few times, 8 or 9 e becames very slow geting timeouts.
// http://localhost:63187/EntitiesModelService.svc/ServerDateTime()
EntitiesModel dataManager =
new
EntitiesModel(
new
Uri(
"http://localhost:63187/EntitiesModelService.svc/"
));
for
(
int
n = 0; n < 10; n++)
{
DateTime result = dataManager.Execute<DateTime>(
new
Uri(
string
.Format(
"{0}ServerDateTime()"
, dataManager.BaseUri))).FirstOrDefault();
Console.WriteLine(
"Server time: {0}"
, result);
}
Thank you