This question is locked. New answers and comments are not allowed.
Hi,
No matter what I try and what example I use I can not seem to get the config.SetServiceOperationAccessRule to work.
I have even tried all of your examples that use Data service and on everyone it errors with The given name 'GetCars' was not found in the service operations. Parameter name: name. This works with MS DataService instead of OpenAccessDataService.
Should this work in the way I have extend the code above. Please provide an example of this working if possible.
Thanks
No matter what I try and what example I use I can not seem to get the config.SetServiceOperationAccessRule to work.
I have even tried all of your examples that use Data service and on everyone it errors with The given name 'GetCars' was not found in the service operations. Parameter name: name. This works with MS DataService instead of OpenAccessDataService.
using
System;
using
System.Collections.Generic;
using
System.Data.Services;
using
System.Data.Services.Common;
using
System.Linq;
using
System.ServiceModel.Web;
using
System.Web;
using
SofiaCarRentalDAL;
using
Telerik.OpenAccess.DataServices;
namespace
SofiaCarRentalDataService
{
[System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults =
true
)]
public
class
SofiaCarRentalService : OpenAccessDataService<SofiaCarRentalEntityDiagrams>
{
public
static
void
InitializeService(DataServiceConfiguration config)
{
config.UseVerboseErrors =
true
;
config.SetEntitySetAccessRule(
"*"
, EntitySetRights.All);
config.SetServiceOperationAccessRule(
"GetCars"
, ServiceOperationRights.All);
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
}
protected
override
void
HandleException(HandleExceptionArgs args)
{
base
.HandleException(args);
}
[WebGet]
public
IQueryable<Car> GetCars() {
return
this
.CurrentDataSource.Cars;
}
[ChangeInterceptor(
"RentalOrders"
)]
public
void
InterceptOrders(RentalOrder order, UpdateOperations operations)
{
if
(operations == UpdateOperations.Add)
{
order.CustomerID =
base
.CurrentDataSource.Customers.First().CustomerID;
order.EmployeeID =
base
.CurrentDataSource.Employees.First().EmployeeID;
}
}
}
}
Should this work in the way I have extend the code above. Please provide an example of this working if possible.
Thanks