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

Windows 8 – XAML/C# how to Add multi push pins to map control Bing maps

Greetings readers I promised you in my previous post that I am gonna go a little bit deeper in the Bing map control and I will should more advanced scenarios and one is push pins, Basically I am going to tell you how you can add push pin to your map and also how to dynamically populate those push pins using binding Refer to my previous article Using bing maps part one  for more details cause I am going build on it so if you ever feel that you don’t understand something just click the link and spend a few minutes reading it, I promise you it will prove worthy. First lets add a normal push pin to our map  < Grid Background = " {StaticResource ApplicationPageBackgroundThemeBrush} " > < bm : Map x:Name = " MyMap " Width = " 640 " Height = " 480 " Credentials = " {StaticResource BingMapsApiKey} " > < bm : Map.Children > < bm : Pushpin x:Name = ...

Windows Phone 8 - Application bar command binding MVVM

This is a short post in which i will explain how on Windows phone 8 to bind the application bar button or menu item, first this is only a fix for the  BindableApplicationbar  which supports windows phone 7 only, i just made it support windows 8 no features added or anything. i have uploaded the dll file here so it can be accessible easily here is the link to download http://sdrv.ms/RApUal now that you got the link lets check how we gonna use it you can refer to BinableApplicationbar  or check out the code here that i actually used in my app and i already read it there !  Add a reference to the BindableApplicationBar library here is the link again  http://sdrv.ms/RApUal Add XML namespace declaration in your page's XAML: xmlns : bar ="clr-namespace:BindableApplicationBar;assembly=BindableApplicationBar" Set Bindable.ApplicationBar property on your page code as in the snippet below: < phone : PhoneApplicationPage >  ...

Windows 8 RTM Using bing map control. How to use the map control in a metro (modern) style App

This is a briefing article on how to start using Bing map control using XAML & C#, to begin with you must first follow a set of instruction to get a license key for using Bing maps. Lets talk first about bing maps and the map control Bing map control is a part of the Bing SDK for windows 8 modern style apps About the SDK as Microsoft says : Bing Maps SDK for Metro style apps (RTM Beta)   combines the power of Windows 8 and   Bing Maps ™ to provide an enhanced mapping experience for modern style apps. Developers can use this Bing Maps control to incorporate the latest road maps and aerial views into a Windows 8 Metro style app. This SDK includes controls for apps built using JavaScript, as well as apps built using C#, C++, and Visual Basic, and requires a   Bing Maps Key   for a Windows Metro style app. (If you have an existing “Metro style apps (BETA)” key, it will still work until the evaluation period expires.) Now lets get started and here...