Learn .NET Core by example (or micro example) – Part II
November 3, 2016 · 3 minute read
You want to learn .NET Core and so you tackle the basic tutorials, get some controllers and views set up, maybe a spot of routing and Web API.
But now what? Where can you go from here.
Personally I find it really useful to look at other people’s work. It’s never been easier to virtually stand over another developer’s shoulder and see what they’ve created.
Once you’ve done a few tutorials and got your head around the basic elements of ASP.NET Core, you’re going to want to ramp up your knowledge and build something more substantial, that’s when it’s really useful to explore other people’s web apps, you’ll see ideas and concepts that you can bring back to your own work.
We previously looked at three examples of ASP.NET Core projects. Since then a few people have got in touch with suggestions for other projects that really showcase what ASP.NET Core can do (and how it interacts with other frameworks like Angular).
Here’s the pick of the bunch.
Album Viewer VNext
If you’re looking for an example of a site which uses both Angular 2.0 and ASP.NET Core then Rick Strahl’s sample application fits the bill.
This one’s been in development for a while (as Core went through various Release Candidates) so it’s pretty mature for a sample app. Rick uses Entity Framework Core for data access and exposes data via Web API and is nice example of Angular 2.0’s components approach.
Contoso University Core
If you’ve ever wondered “what would Jimmy Bogard do with ContosoUniversity and .NET Core?” then you can stop waiting for the answer.
If you don’t know Jimmy, he’s founded a couple of open source projects you may have heard of, namely AutoMapper and MediatR.
Here Jimmy offers his own take on Microsoft’s Contoso University sample application (for the Microsoft version check out the official MS Docs).
It’s a really nice example of a loosely couple web application with “thin” controllers and concerns firmly separated. Jimmy uses CQRS to keep commands and queries separate. He also employs feature folders whereby everything needed for a feature is bundled together in one folder (controllers, commands, queries, html) so you don’t need to jump around the app looking for all the pieces of the puzzle.
It’s also worth noting Jimmy sticks to Entity Framework 6 rather than EF Core (which many feel is not yet feature-complete enough to use in production, depending on your requirements).
Practical ASP.NET Core
A slightly different take on your standard sample app. Instead of one sample, Dody Gunawinata has written 40+ samples for ASP.NET Core fundamentals (and this number is growing all the time).
There are multiple examples of routing, middleware, dependency injection amongst others and each sample has a description in the repository’s Readme file.
If you’re looking for a quick reference for key ASP.NET Core concepts, you can’t really go wrong by consulting these examples.