2

What are the benefits of using ADO.Net Entity Model and EF?

Can we use both of them together in a project. I came across an example where, the user had used both edmx and ef for his application. I am not sure what is the purpose of that.

Thanks

tjRulz
  • 441
  • 5
  • 9
  • 3
    The "ADO.NET Entity model (edmx)" ***IS*** Entity Framework (the database- or model-first approach). So what exactly is your question? – marc_s Oct 23 '12 at 20:16
  • Hi Marc_s, Sorry for not being clear. It is more of an architecture question. Wanted to know if I can just use EDMX in an application or do I need Entity Framework over the EDMX. – tjRulz Oct 29 '12 at 19:24
  • I don't think there's any way to use the EDMX file without using Entity Framework - they're very tightly coupled. Then the question is: **why** would you want to use the EDMX *without* using Entity Framework? – marc_s Oct 29 '12 at 19:26
  • Thanks Marc_s. I read through an example of EDMX and EF. It makes total sense of what you are trying to say. This is the first time for me to go through this technology. – tjRulz Nov 06 '12 at 18:02

1 Answers1

2

Edmx artifact (either in the form of a file on the disk for Model First and Database First approaches or being generated by the EF runtime - Code First approach) describes your model, your database and the mapping between these. At the moment EF always needs it to work. The only nuance is that for CodeFirst applications (or, in general, applications using DbContext) this file is generated on the fly from your classes and you don't deal with it directly while in case of Model First/Database First where you use the ObjectContext the file is on your disk and (usually) is split and embedded in your assembly.

EDIT

EF6 no longer creates and uses artifacts internally (at least for CSDL and SSDL parts). However you can still dump the model in form of EDMX using EdmxWriter.WriteEdmx

Pawel
  • 31,342
  • 4
  • 73
  • 104