config.SetServiceOperationAccessRule issue

5 posts, 0 answers
  1. Paul
    Paul avatar
    113 posts
    Member since:
    May 2009

    Posted 02 Apr 2012 Link to this post

    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.
    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
  2. Viktor Zhivkov
    Admin
    Viktor Zhivkov avatar
    291 posts

    Posted 05 Apr 2012 Link to this post

    Hello Paul,

    Thank you very much for reporting a new bug in our custom data service provider. We have added it in our internal issue tracking system and we will implement a fix in near future.
    While we fix the issue you have two possible work around options available:
    1. Create a new separate service that contains all the service operations that you want and keep the OpenAccess Data Service as it is generated by our wizard.
    2. Implement a custom data service provider that can handle the scenario. Here is a MSDN documentation start point about custom data service providers and here is a detailed article how to implement one step by step.

    If your intention is to solely get a list of Cars OpenAccess Data Service already provides such method so you don't have to extend the service at all.

    I am sorry for the inconvenience that we have caused you and I have added 500 Telerik Points to your account as a "new bug bounty". 

    All the best,
    Viktor Zhivkov
    the Telerik team
    Telerik OpenAccess ORM Q1 2012 release is here! Check out what's new or download a free trial >>
  3. DevCraft banner
  4. Viktor Zhivkov
    Admin
    Viktor Zhivkov avatar
    291 posts

    Posted 14 Jun 2012 Link to this post

    Hello Paul,

    I am happy to announce that we have fixed our implementation of DataServices and now we support custom service operations out of the box in the OpenAccess Q2 2012 release. 
    You can check What's new in Q2 2012 page or the release notes for more information about all changes and new features.

    All the best,
    Viktor Zhivkov
    the Telerik team
    Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
  5. Ben
    Ben avatar
    8 posts
    Member since:
    Mar 2011

    Posted 03 Sep 2012 Link to this post

    I have this problem as well. So I went to the website, downloaded the Q2 2012 SP2 release. Installed it.
    But the problem remains. Actually when I looked in my C:\Program Files(x86)\Telerik\OpenAccess ORM, none of the existing directories or files have been changed, I still see the old version. The only thing I see is a new directory 'ProductSDK'.
    So what exactly do I need to install to have this problem solved?

    Thanks

      Ben
  6. Ben
    Ben avatar
    8 posts
    Member since:
    Mar 2011

    Posted 03 Sep 2012 Link to this post

    Running Telerik_OpenAccess_ORM_2012_2_607_dev.msi installed it.
    Problem solved.


Back to Top
DevCraft banner