Getting Started with Entity Framework 4.0 Screencast Recorded session from Cairo Code Camp - Part 6

by mosessaur| 26 September 2011| 0 Comments

About Part 6

6th part is about 12 min in length. Covers Entity SQL, LINQ to Entities and EF4 new feature of using database built in functions & user defined functions UDF. And how to use them with LINQ to Entities.

More...

Getting Started with Entity Framework 4.0 Screencast Recorded session from Cairo Code Camp - Part 5

by mosessaur| 24 September 2010| 0 Comments

About Part 5

Fifth part is about 9:45 min in length. Part 5. Covers EDM -Entity Data Model- showing its elements (SSDL, CSDL & MSL). Also this screencast shows how to query your conceptual model using LINQ to Entities.

More...

Using LinqPad to Query OData Services – Screencast

by mosessaur| 29 May 2010| 0 Comments

Last week I introduced a new screencast on another OData Developer tool. It was about how to use LinqPad to query OData service with C#, LINQ & WCF Data Services Client APIs.

The screencast shows how to use LinqPad to connect to and query OData Services using LINQ and WCF Data Services Client APIs. Showing how LinqPad can be useful as a developer tool to test queries against any OData Service.

I case you missed it, you can watch it on ODataPrimer website. You can also download an HD video (~48Mbs). The package contains 2 videos. One of them is the one hosted and it’s a 10 min video. And the other is ~14 min. I had to trim it to fit into youtube. The 14 min video contains additional stuff in case you are interested.

You can also subscribe to ODataPrimer channel on yourtube for future updates and videos.

Hope you’ll enjoy it.

Domain Driven Design & Test Driven Development\Design using Entity Framework, Part 2.A Unit Testing Entities With Moq 3

by mosessaur| 24 March 2009| 3 Comments

I had about DDD & TDD with Entity Framework that you might need to return to them before you proceed with this post. To summarize these posts, I was trying to build testable Models that is based on EF. But EF doesn't support Persistence Ignorance in its first version which make testing it in most cases require a database connection where you can test you code against it. My target was to build a testable models based on EF and that is independent of any underlying data source.

Introduction, Domain Model Review:

EntityModel-DDD

More...

Domain Driven Design & Test Driven Design\Development with Entity Framework Part 1.b Integration Testing for ObjectContext

by mosessaur| 23 February 2009| 0 Comments

I decided to provide some integration testing before proceeding as a proof of concept. In integration testing I will connect to the database and perform unit testing while connecting to the database.\

This unit test is almost identical to the one in my previous post. Except here I am testing the results that is coming out from EF and Database.

My target is to test IDataContext Implemented methods in NorthwindDataContext. Find below the Integration unit testing class. More...

Domain Driven Design & Test Driven Development\Design with Entity Framework Part 1.b, Review

by mosessaur| 21 February 2009| 3 Comments

In return to my previous posts about DDD & TDD with EF. I discovered few catches in my design that I wished to high light and discuss in this post. To summarize my take here are the head lines:

  • What is the Responsibility of ObjectContext in EF?
  • What is the Responsibilities of Repositories and whether they should be coupled with EF or not?

I come up with this post after few discussions through e-mail with Davy Landman.

More...

Domain Driven Design & Test Driven Development\Design with Entity Framework, Part 1.a Refactoring & Unit Testing

by mosessaur| 11 February 2009| 6 Comments

In I talked about building domain model for Northwind using Entity Framework. I used the generated ObjectContext class which is NorthwindDataContext as the basic Data Access Layer Helper. But my NorthwindDataContext is implementing custom interface I created in order to be able to make my Data Access Layer testable as well as to be independent from EF.

My target is to achieve decoupling between EF and all layers above it. This include Repository classes. This might not be of a big benefit to everyone, because my repositories implementation will still dependent on IDataContext. But for me it will help to do TDD more smoothly regardless of my underlying data access layer. Beside it might allow me in future to be able to switch from EF to LINQ to SQL and just implement my IDataContext interface for LINQ to SQL.

Source code is attached to this post, feel free to download it and explore the code

More...

PagedList Sorted Edition

by mosessaur| 04 November 2008| 10 Comments

Me and Amr Elsehemy are working together in something and he requested a feature in some APIs I built. In fact he liked the Rob Conery's PagedList that had been modified by Troy Goode. He used it on his jBlogMVC post series about building Blog Engine using MVC.

That was pretty simple and I noticed something missing on the PagedList that I wished to add! What about sorting. I mean build a PagedList that is sorted. So I made slight changes to the enhanced PagedList made by Troy to support sorting.

Prerequisites:

It is required that you refer to Rob Conery's PagedList and the modified version by Troy Goode before you proceed in order to understand how this PagedList is useful and helpful with MVC and LINQ to SQL as well as LINQ to Entities.

Summary of changes:

To summarize the changes I made, simply I used Lambda Expressions to enable sorting. And had to modify Class declaration (with constructors) and the Initialize method. Sorting is provided by OrderBy extension method. Please return to method documentation for more details.

More...

LINQ to Entities, Workarounds on what is not supported

by mosessaur| 31 August 2008| 11 Comments

In my previous post I talked about what is not supported in LINQ to Entities and made a simple comparison with LINQ to SQL show that these unsupported things works fine in LINQ to SQL.

Here I am going to provide workarounds these things. First one will be wrapping the entities with Business Classes. And the second way will be using client evaluation which is converting to work with LINQ to Object. Before you go further, I recommend that you read my previous post to save your time.

More...

LINQ to Entities, what is not supported?

by mosessaur| 24 August 2008| 11 Comments

Recently and after .Net 3.5 SP1 & Visual Studio.Net 2008 SP1 released, I started to play with LINQ to Entities. Really Entity Framework is interesting. Maybe not the best ORM tool, but still it is interesting and easy to use plus it is all one IDE at the end.

At the same time I was watching screen-casts made by Rob Conery about Building MVC Storefront along with TDD. In fact he was using LINQ to SQL. And I liked his coding techniques presented in his sample application and screen-casts.

I decided to play around with LINQ to Entities with MVC. Here I am going to talk about my adventures with LINQ to Entities, and really it is completely different from working with LINQ to SQL.

My recommendation for every developer is to start by reading Supported and Unsupported Methods (LINQ to Entities). Yes it will save you sometime. Do You know LINQ to SQL? Then you are familiar with LINQ. But you need to know what there and what is not there in LINQ to Entities. This even Might help you to build a wish list for LINQ to Entities also ;O).

Here I'm going to use some code samples presented in MVC Storefront and show some of the techniques that will not work with LINQ to Entities. And I will compare code with LINQ to SQL. In some other post, I'm going to present some other workarounds provided by ADO.NET Team when I asked them about the issues I have with LINQ to Entities. Also I'll present my own workarounds. And I'll compare the Generate SQL statements. I am not query optimizer, so I will not say what is the best choice. But you can help me in that.
More...