-1

Can anyone help me understand DataContext and DataSet ? I am leaning Entity Framework and I need to clear this concepts in my mind properly.

I tried to read in the book, read some articles but all the language there was so complex, can anyone explain me these terms using simple words with example?

Also if you can provide me the link of any video tutorials that could help me.

Thanks.

Devin
  • 7,690
  • 6
  • 39
  • 54
Rushabh Shah
  • 405
  • 1
  • 6
  • 16

1 Answers1

0

DbContext and DbSet are two classes that when you use EF code first approach, you can work with them. Using Entity Framework you can simply define a mapping between your entities and tables.

In simple words, you can imagine DbContext as an In-Memory database, and DataSets as In-Memory tables(that initially are empty), you can imagine entity objects as rows of your tables in your database, too: enter image description here

In your application you can query DbSets or do CUD(Creat,Update,Delete) operations on them instead direct access to your database and tables. You could execute multiple CRUD operations on DbSets, in simple database transaction, too.

Masoud
  • 8,020
  • 12
  • 62
  • 123