Skip to content

Tag: EntityFramework

C#/.NET 27

Converting ODataQueryOptions into LINQ Expressions in C#

OData makes it very easy for us to pass query options from the URL down to an object mapper like EntityFramework. However, this somehow happens automagically and cannot be really controlled in code. In this blog post I show how we can extract and convert FilterQueryOption and OrderByQueryOption to manually apply them to our underlying LINQ provider. Let’s start with […]

C#/.NET 4

More Fun with your ODATA Models and AutoMapper

In our last post Separating your ODATA Models from the Persistence Layer with AutoMapper I showed how we can separate our public API Model from the internal persistence layer. In this post I will show how we can re-model the public API model without changing the internal data model. In the example from the previous post I showed our model […]

C#/.NET 0

Using Generic Test Classes and EntityFramework test doubles to facilitate Unit Testing

This is some kind of follow-up to my previous posts regarding generic Odata controllers and decoupled domain managers. If you have followed my posts Using Dependency Injection with StructureMap to decouple business logic from WebApi OData Controllers and Simplifying OData Controllers by using generic controller classes you will remember that we use managers that contain the business logic and odata […]

C#/.NET 0

ODataQueryOptions do not correctly apply $filter and $orderby Options to IQueryable when using EntityFramework 6 with SQL Server

This blog post is a bit more lengthly than my usual posts and the idea came from an issue I faced when working in one of our project where we use an OData v3 REST interface that talks to an MS SQL Server (2012 R2) via EntityFramework v6.1.3. In short: we wanted to implement ‘entity framework row level security’ (in […]

LightSwitch 0

Using LightSwitch with EntityFramework 6 and CodeFirst based ODATA Controllers

Enhancing LightSwitch applications with additional ODATA or WebAPI controllers is a pretty common task. However when you try to build a CodeFirst based controller in combination with EntityFramework 6, you will run into a lot of errors by default. Here are the steps to get this cleared and running: 1. Create a Visual Studio LightSwitch HTML project In this example […]