This repository is for teaching using Microsoft Entity Framework Core with a modified version of Microsoft NorthWind database.
First lesson walkthrough building the foundation for
- Reading data with and without related data with EF Core and SQL-Server data provider
- Using projections
- Unit testing
- Various DbContext configurations
- Including ProxiesExtensions
- Reverse Engineering a database using EF Power Tools
- Source control, GitHub in Visual Studio
namespace NorthWindCoreUnitTest
{
[TestClass]
public partial class CustomersTest : TestBase
{
[TestMethod]
[TestTraits(Trait.EfCoreCustomersSelect)]
public void CustomerCount()
{
using var context = new NorthwindContext();
var customers = context.Customers.ToList();
Assert.IsTrue(customers.Count == 91);
}
[TestMethod]
[TestTraits(Trait.EfCoreCustomersSelect)]
public async Task CustomersProject()
{
var customers =
await CustomersOperations.GetCustomersWithProjectionAsync();
string firstName = customers
.FirstOrDefault(cust => cust.FirstName == "Maria").FirstName;
Assert.IsTrue(firstName == "Maria");
}
}
}
Will be done in branches in GitHub