This is a migrated thread and some comments may be shown as answers.

WCF Data Service native implementation?

3 Answers 114 Views
Web Services
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kendall Bennett
Top achievements
Rank 2
Kendall Bennett asked on 25 Apr 2011, 10:26 PM
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?

3 Answers, 1 is accepted

Sort by
0
Jordan
Telerik team
answered on 27 Apr 2011, 01:20 PM
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.

Greetings,
Jordan
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
0
Kendall Bennett
Top achievements
Rank 2
answered on 27 Apr 2011, 04:34 PM
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 :(
0
Viktor Zhivkov
Telerik team
answered on 04 May 2012, 09:19 AM
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.

Regards,
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!
Tags
Web Services
Asked by
Kendall Bennett
Top achievements
Rank 2
Answers by
Jordan
Telerik team
Kendall Bennett
Top achievements
Rank 2
Viktor Zhivkov
Telerik team
Share this question
or