What is the Entity Framework?

I keep hearing about the Entity Framework fluent-api, but I'm trying my best to find a good link to this. What is it?

We use entity infrastructure and modeling tool. It's all? Or is it something else?

Similarly, if this is not a too broad question, what is POCO? I know what this means Plain Old CLR Objects, but what does it mean for me, as for those who use EF already using the designer model tool? If this question is too vague, please ignore it. I am just studying here and any information you are willing to provide is useful.

+46
c # orm entity-framework entity-framework-4 ef-fluent-api
Jun 13 2018-11-06T15
source share
5 answers

Entity Framework 4.1 introduces the first code approach for writing database models. This is also called POCO (regular CLR objects). The idea is that you can create your database from these classes, and not first create a database and create a model from it.

There are many good blog articles and MSDN documentation on this. A good place to start would be

http://blogs.msdn.com/b/adonet/archive/2010/12/14/ef-feature-ctp5-fluent-api-samples.aspx

http://weblogs.asp.net/scottgu/archive/2010/12/08/announcing-entity-framework-code-first-ctp5-release.aspx

http://weblogs.asp.net/manavi/archive/2011/03/27/associations-in-ef-4-1-code-first-part-1-introduction-and-basic-concepts.aspx

Relatively free API, it is mainly using EF classes to create your database, for example:

modelBuilder.Entity<Category>().HasKey(c => c.CategoryCode); 

So, you manually declare that the Category table has a primary key named "CategoryCode". You can also declare PK as follows:

 public class Category { [Key] public int CategoryCode { get; set;} } 

The [Key] attribute comes from Data Annotation

+49
Jun 13 2018-11-11T00:
source share

POCO stands for regular CLR object.

An article about the Fluent API.

+6
Jun 13 2018-11-11T00:
source share

You can also check the first level API section of the code on MSDN here http://msdn.microsoft.com/en-us/library/hh295844

+1
Jan 12 2018-12-12T00:
source share

Answering your POCO question: in the application I'm currently working in, I use POCO to transfer data to my Silverlight interface (EF just didn't cut it). Essentially, I use entities created by the creator of EF, massaging them into a serializable version, and then sending them back and forth through the wire. POCO, where necessary, provides an abstraction layer. I think of it as adapting the DAO template to serialization, instead of using it to access the database, as usual, a DAO template.

0
Jun 13 2018-11-11T00:
source share

See the paragraph on POCO classes at http://www.asp.net/entity-framework/tutorials/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application

Essentially, in the EF context, POCO classes are entity classes that are not inherited from the Entity Framework EntityObject class (this is what you get by default in Database First or Model First). As mentioned in one of the other answers, this simplifies the serialization of objects, but also some development and automated testing methodologies prefer working with objects that do not have a reference to the Entity Framework.

0
Jun 15 2018-11-11T00:
source share



All Articles