Skip to main content

Entity Framework ( Database First Code First Model First)


When using Entity Framework there is probably three approaches you will follow

First is Database First

It is the simplest way you could use Entity framework is when you already have the database and you generate the model from it, using the entity frame work Generator which is  the custom Generator option file (though I would not recommend such action as this too coupled with the ORM, the best is to use a custom Generator tool such this http://visualstudiogallery.msdn.microsoft.com/23df0450-5677-4926-96cc-173d02752313  it is an awesome tool or you could simply write your own Generation tool  using T4). Not my personal favorite .

Second Model First

My Personal Favorite till very lately, Ok how it works? it starts with the EDMX file draw you model using the designer then afterwords you can generate the database from the model and also you can generate the POCO entities very easily not a lot  (see the link above for the generation tool) it is pretty much easy to use though it is a little missy as if the model or database changes you will have to change the model and then the POCO and so on.

Third and Last is the Code First 

My new personal favorite , it is the least manipulative you start with the POCO Entities and create your own Data Context everything is under your control the best part I like about it is that you don’t do anything with designer its all code. If I need to change anything I will change the code you code override the database changes and create the data base from scratch all from code.

Comments

Popular posts from this blog

(AsyncWebClient) Async Webclient for windows phone 8

Using windows phone web client is pretty common but the thing is you can not use it using Async -> Await mechanism so i used threading to create an async functionality for The Download string and upload string methods here is the code below // Comment public class AsyncWebClient { public Task DownloadString(Uri uri) { var task = new TaskCompletionSource(); try { var client = new WebClient(); client.DownloadStringCompleted += (s, e) => { task.SetResult(e.Result); }; client.DownloadStringAsync(uri); } catch (Exception ex) { task.SetException(ex); } return task.Task; } public Task UploadString(Uri uri, string content) { var task = new TaskCompletionSource(); try { var client…

RuntimeBinderException cannot resolver property in Unit Test in case of dynamic return.. Solved

Xamarin UI Tests – Deep dive Part 1

IntroAs the title may describe this is the first of the series of articles that will cover the UI Test of Xamarin in a deep dive, we will start simple and then dig deeper as we go. Since this is very well the first of the series, it will mostly cover up the architecture and the testing technique that Xamarin UI Tests uses.

The Technology
Xamarin UI Test is an automation testing framework similar to selenium, Watir, Watin (.net), Robot and Sikuli, if you have used BDD (Behavioral Driven Development) or a more advanced TDD (Test Driven Development) approach at least you must have come across one of these frameworks, and in that perspective comes Xamarin UI Testing as an automation framework designed specifically for Xamarin Automation testing, For starter Xamarin UI Tests was not build from scratch, instead it was built on top of another UI Automation testing framework that is targeting android and iOS sepecifically which is Calabash, I have to say that this choice was made wisely as of n…