Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/karenpayneoregon/ef-core-lessons-csharp
Lesson on working with EF Core 5 showing both beginner and advance operations with unit testing.
https://github.com/karenpayneoregon/ef-core-lessons-csharp
base-classes configuration csharp csharp9 efcore5 findall inmemory-db interceptors mocking-framework unit-testing
Last synced: 23 days ago
JSON representation
Lesson on working with EF Core 5 showing both beginner and advance operations with unit testing.
- Host: GitHub
- URL: https://github.com/karenpayneoregon/ef-core-lessons-csharp
- Owner: karenpayneoregon
- Created: 2021-07-08T14:47:51.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-10-08T19:51:50.000Z (over 3 years ago)
- Last Synced: 2024-11-30T19:25:29.489Z (3 months ago)
- Topics: base-classes, configuration, csharp, csharp9, efcore5, findall, inmemory-db, interceptors, mocking-framework, unit-testing
- Language: C#
- Homepage:
- Size: 2.44 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# About

This repository is for teaching using Microsoft Entity Framework Core with a modified version of Microsoft [NorthWind database](https://gist.github.com/karenpayneoregon/40a6e1158ff29819286a39b7f1ed1ae8).
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](https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext?view=efcore-5.0) configurations
- Including [ProxiesExtensions](https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.proxiesextensions?view=efcore-5.0)
- Reverse Engineering a database using [EF Power Tools](https://marketplace.visualstudio.com/items?itemName=ErikEJ.EFCorePowerTools)
- Source control, [GitHub](https://github.com/) in Visual Studio# Sample test methods
```csharp
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");
}
}
}
```# Future lessons
Will be done in branches in GitHub