Usage of WCF RIA Services without the Entity Framework - entity-framework

Can WCF RIA Services be used without the Entity Framework (for example, if the datasource is no classical database)

RIA services is not tied to Entity framework. RIA services uses the provider model to make it easy to plug in other datasources.
Here is a link to an example xml provider: MSDN Custom MetaData Provider

Related

Per request instance of Entity Framework db in ASP.NET with unity

I have an ASP.NET MVC 4 application and I need to create dbContext for Entity Framework database with a lifetime of "per request".
How can I do this with Unity container?
PS: I use dependency injection of the dbContext.

Using WebApi + Odata on an Edmx

We are currently looking at converting from WCF Data Services to WebApi with Odata. Our entity model is defined using an entity framework defined as an edmx. Im struggling to get the edmx working with WebApi OData due to relationships and complex properties.
I'm just wondering whether someone has successfully implemented webAPI with odata on a bigger sized edmx (that has relationships as well)? Any advice would be great.
You may try using RESTier -- a .Net framework built upon Web API OData. There are several things you may need to pay attention:
RESTier has an EF provider which is quite similar with WCF data services. So it should work wiht the edmx model with little tweak.
RESTier is not a "competitor" for Web API OData, it's built upon Web API OData and can fallback to Web API OData.
RESTier currently is a preview version, but it has good support for the common features used of OData service.
If you tried out and find it cannot work, you can create an issues on https://github.com/odata/restier/issues with more detailed information, if you successfully make it work, it will be great you share your experience.

WebAPI OData frontend with WCF Data Services backend

In a project I'm working on, there's a need for following architecture (simplified):
[WebAPI] -> [WCF -> Entity Framework] -> [Database]
I've seen a lot of demo's where you can expose your Entity Model directly over a WebAPI with OData syntax.
I was wondering though, whether it is possible to expose a WCF OData Service (backend server) over a WebAPI OData service (frontend server) with the benefits you get with OData filtering.
For example: I don't want to get all Customers from WCF when I filter on country in my WebAPI (http://domain.com/api/Customers?$filter=country eq 'USA').
Thanks!
If you mean WCF Data Services, it is already an OData service endpoint that supports filter.
e.g.:
http://services.odata.org/OData/OData.svc/Categories?$filter=Name eq 'Food'
If you mean WCF service backended by EF, then you're to make the WebAPI OData service a proxy to the WCF service. That is viable as long as you could write client code to consume the WCF service.
Please refer to:
http://aspnet.codeplex.com/SourceControl/latest#Samples/WebApi/OData/v4/ODataServiceSample/ODataService/
You can simply replace the code snippet inside ProductsController::Get, retrieve data from the WCF service, then return the data there. The [EnableQuery] attribute would make the query options available.

Generate Entity Classes using Odata service

I want to generate custom classess of my odata service. I am planning to use Entity Framework for that.
Can somebody help me on this ?
Technology I am using: .Net Framework 4.0
See here for an intro to OData and the Entity Framework:
http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/supporting-odata-crud-operations

RIA Services and EF validation

I'm developing a Silverlight application with Entity Framework and RIA Services. When I create the RIA Service I have the option to generate a metadata class for basic validation.
What is the difference between the validation I can do directly with EF and the one in the metadata class generated with RIA service? I mean, if I have a property in the EF model which is not null, I don't need to mark it in the metadata class as [Required]... Is it because this is already done by the EF model??
THANKS!
With the metadata classes you can add more validation logic to your entities. See the namespace System.ComponentModel.DataAnnotations for more details. EF currently only supportes the Required attribute. The namespace provides more attributes, such as RangeAttribute, StringLength or custom attributes that you define for your own validation logic.
Jeff Handly has a good series of blog post, that describe the validation process and elements in WCF Ria Services.