WCF Data Service native implementation?

Thread is closed for posting
4 posts, 0 answers
  1. Kendall Bennett
    Kendall Bennett avatar
    80 posts
    Member since:
    Feb 2010

    Posted 25 Apr 2011 Link to this post

    Hi Guys,

    I noticed that when I try creating a WCF Data Service using the wizard for a simple model, I end up with a class generated called DataManager, that does the actual implementation of the necessary services used by the DataService<> class from Microsoft. However if you use the lasted CP2 from Microsoft with Entity Framework, creating a WCF Data Services service is as simple as:

    public class EFService : DataService<StoreEntities>
        // This method is called only once to initialize service-wide policies.
        public static void InitializeService(DataServiceConfiguration config)
            config.SetEntitySetAccessRule("*", EntitySetRights.All);
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;

    It would be nice if the OpenAccess context implemented the necessary interfaces that is implemented by the generated DataManager class natively, so we would not have to generate this class? The main reason why is because I don't want to have to maintain the DataManager class, and since it is generated one time (not generated every build with a template), if there a bug fixes or changes to do things better, they will be missed unless I regenerate the code?

    Is this something planned for the future?
  2. Jordan
    Jordan avatar
    547 posts

    Posted 27 Apr 2011 Link to this post

    Hi Kendall Bennett,

    Indeed at the moment there is no implementation of a WCF Data Services provider for the OpenAccess context, this is why the DataManager class is generated and used.

    We have already started working on a full blown implementation of a WCF Data Services provider that will allow the OpenAccess context to be used with WCF Data Services in a way very similar to the EF example that you have given. Unfortunately, I cannot share at the moment when this functionality will be released officially as part of OpenAccess.

    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Kendall Bennett
    Kendall Bennett avatar
    80 posts
    Member since:
    Feb 2010

    Posted 27 Apr 2011 Link to this post

    Ok thanks. This has become less of an issue because as much as I would like to use WCF Data Services, I need to access it from Windows Mobile and I can't seem to find any OData client code for Windows Mobile so I will have to stick to rolling my own WCF Services :(
  4. Viktor Zhivkov
    Viktor Zhivkov avatar
    324 posts

    Posted 04 May 2012 Link to this post

    Hi Kendall,

    There is a new version of OpenAccess that provides easy data service generation with a wizard. You will be able to generate several types of services (and related infrastructure like DTOs, etc.) including:
    • Plain WCF Services
    • WCF Data Services V1 and V2 (a.k.a. Astoria)
    • RESTful Collection Services
    • AtomPub Services

    For example, the code of the service generated for WCF Data Services looks like: 
    [System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)]
    public partial class FluentModel2ContextService : OpenAccessDataService<FluentModel2.FluentModel2Context>
        /// <summary>
        /// Initializes the service.
        /// </summary>
        /// <param name="config">The configuration object.</param>
        public static void InitializeService(DataServiceConfiguration config)
            config.SetEntitySetAccessRule("Products", EntitySetRights.All);
            // TODO: Set service behavior configuration options
            // Examples:
            // config.DataServiceBehavior.AcceptCountRequests = true;
            // config.DataServiceBehavior.AcceptProjectionRequests = true;
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
    Which is pretty much identical to the code that you have posted.

    You can find the new wizard either by:
    • right clicking on a .RLINQ file or
    • right clicking on a ASP.NET web application project
    and clicking on Generate OpenAccess Domain Model Service... menu item.

    The wizard is in "Beta" state and the documentation is still under construction so keep tuned for further updates.

    Viktor Zhivkov
    the Telerik team
    Follow @OpenAccessORM Twitter channel to get first the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
Back to Top