A very successful bridge between relational db's and object oriented software.
Text
Text
With 2 more bids, and collection1 has type ICollection<Bid>
Entity Framework (EF) is an object-relational mapper (ORM) that enables .NET developers to work with relational data using domain-specific objects. It eliminates the need for most of the data-access code that developers usually need to write.
We're using Entity Framework Core. EF Core 9 (EF9) was released in 11/24. EF Core 10 (EF10) will be released in 11/25
Start using the Repository and/or Service pattern
Demo: Use a good design
Text
Text
IEnumerable<T> and/or IQueryableSystem.Linq and System.Linq.ExpressionsUsing Fluent Syntax
Take a critical look at your favorite web applications.
Ask yourself how they do it? How does the data model support the features?
A reminder of the POST problem
// GET: GuestController/Create
public IActionResult Create()
{
return View();
}
// POST: GuestController/Create
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Create(Guest guest)
{
if(ModelState.IsValid)
{
// add new object to repository/database
// sends a 302 Found (despite 303 See Other being the correct answer here)
return RedirectToAction("Thanks");
}
return View(guest);
}
public IActionResult Thanks()
{
return View();
}Found many errors (data types, constraints) when using SQLite.
But rarely with SQL Server
Can manually configure with Fluent API
We will use migrations for authentication (ASP.NET Core Identity). But they're not frequent.