Entity Framework in C#
Entity Framework is an ORM (Object-Relational Mapping) framework that allows a program to work with relational databases using object-oriented concepts. It provides several classes and interfaces in the System.Data.Entity namespace to support database operations. Here's an example code that demonstrates how to use Entity Framework to query a database:
using (var context = new MyContext())
{
var customers = from c in context.Customers
where c.City == "London"
select c;
foreach (var customer in customers)
{
Console.WriteLine(customer.Name);
}
}
No comments:
Post a Comment