Entity Framework 6 and Visual Studio 2013

Entity Framework 6 has been included in Visual Studio 2013. It is also available as a NuGet Package which can be installed by using NuGet Package Manager.

There are three ways you can work with data models in the Entity Framework: Code First, Model First, and Database First .

Code First

Whether you have an existing database or not, you can use the Entity Framework without using the Entity Framework Designer or an .edmx file. If you don’t have a database, you can code your own classes and properties that correspond to tables and columns. If you do have a database, Entity Framework tools can generate the classes and properties that correspond to existing tables and columns. The mapping between the store schema and the conceptual model represented by your code is handled by convention and by a special mapping API. If you let Code First create the database, you can use Code First Migrations to automate the process of deploying the database to production. Migrations can also automate the deployment of database schema changes to production when your data model changes. The following are details:

Model First

If you don’t have a database yet, you can begin by creating a model in an .edmx file by using the Entity Framework graphical designer in Visual Studio. When the model is finished, the Entity Framework designer can generate DDL (data definition language) statements to create the database. As in Database First, the .edmx file stores model and mapping information.

The detail of how to use model first is here.

Database First

If you already have a database, the Entity Framework designer built into Visual Studio can automatically generate a data model that consists of classes and properties that correspond to existing database objects such as tables and columns. The information about your database structure (store schema), your data model (conceptual model), and the mapping between them is stored in XML in an .edmx file. The Entity Framework designer provides a graphical UI that you can use to display and edit the .edmx file.

The detail of how to use database first is here.

About henry416
I am a computer technology explorer and an university student based on Toronto. If you have any question, please feel free to discuss and comment here

4 Responses to Entity Framework 6 and Visual Studio 2013

  1. 4nh7i3m says:

    Do you know if there is an open source Migration for SQLite with Code First? There is a commercial product of devart but no open source available. I see this article describing a very interesting solution for SQLite Migraion http://hintdesk.com/sqlite-with-entity-framework-code-first-and-migration/ , but it’s better if we have a exact solution.

  2. the realaadz says:

    Sorry , one last consideration is whether i should implement object classes and then use those for data transaction, and write to DB when confirmed/commit. i have implemented some object classes in another version (for project, user , task Tables) but i am also not winning with regard to my DB Manager class interacting with it. Am i meant to be using a Object Class generator that checks DB and outputs it , and if so (or not) where does this come into the picture and how should i be going about with this ?, or you could also tell me at what i should be considering. (Just to clear up, i dont have a lot of coding experience and i do really enjoy it, this is something that has to be completed in a month, so that is also why i want to use more simpler items as it becomes more automated in terms of coding, so its not that i do not want to learn or go into complex coding situations but time is a big constraint and researching all to reach a complex level will take a lot of time). Thanks again

  3. the realaadz says:

    Okay , this is pushing you and i am really sorry just one last consideration;

    My dev machine is running OS Win7 64Bit edition. The Release will also most likely run on my machine, but soon after it will run on another machine that is 32Bit edition, so what will i have to do with all my elements to make sure that it is compatible with other 32Bit machines, does this significantly affect me?, also if my DB runs on a 32Bit server as well.

    I have researched an error that i could not fix last month and there was some evidence to suggest that a EF Element was not able to function correctly due to some type of version conflict and that it could be related to my machine being 64Bit.

    Thanks , That’s lucky number 3, lol i promise its my last query till a response.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s