Key Takeaways
- The content in the book is a great resource to learn about .NET Core.
- If you don't know about Dependency Injection the book has great demonstrations on how to use this built-in feature of ASP.NET Core in your web apps.
- The book will cover the MVC pattern and how ASP.NET Core MVC uses the pattern.
- You will learn about Entity Framework Core that will allow you bring your web application to access data in your databases.
- Finally, you will learn what you need to know about security and auditing for your ASP.NET Core application before you release it.
With the release of .NET Core 2.0, Microsoft has the next major version of the general purpose, modular, cross-platform and open source platform that was initially released in 2016. .NET Core has been created to have many of the APIs that are available in the current release of .NET Framework. It was initially created to allow for the next generation of ASP.NET solutions but now drives and is the basis for many other scenarios including IoT, cloud and next generation mobile solutions. In this second series covering .NET Core, we will explore some more the benefits of .NET Core and how it can benefit not only traditional .NET developers but all technologists that need to bring robust, performant and economical solutions to market.
This InfoQ article is part of the series ".NET Core". You can subscribe to receive notifications via RSS.
ASP.NET Core in Action, by Andrew Lock, covers ASP.NET Core from the beginners start to an ending where you will have the fundamental knowledge to build web applications using this modern, highly available, highly scalable and cross-platform framework.
If you are new to ASP.NET MVC programming, the book gives a good overview of the Model-View-Controller (MVC) pattern as well as the legacy from the .NET Framework. As the author stated, he wanted to bring a lot of the information which exists from around the Internet into one book with good examples. The code examples are small independent samples that explain the concept covered and not part of a larger extended project other books cover for web development. Also covered in the book are good examples for using ASP.NET Core on cloud platforms and with container technologies like Docker. The book is organized into three parts.
To start, the book does not assume the reader has any knowledge of ASP.NET Core MVC. I found that to be good and I could see the readers with past experience could use this as a refresher. Covering the architecture of ASP.NET Core, the book covers one of the improvements in ASP.NET Core in the Middleware Pipeline. We are then taken through the implementations of the MVC pattern with routing, model binding and HTML rendering with Razor views. Finally, there is a good chapter on developing Web APIs with ASP.NET Core.
Part Two of the book covers the topics from Part 1. Explaining and demonstrating Dependency Injection (DI) is a great part of the second half of the book. DI is a new fundamental part of .NET Core, and there are many examples showing how to leverage it in your web projects. Another improvement in ASP.NET Core is the filter middleware that is explained. The book then covers data access using Entity Framework Core as well as authenticating and authorizing user identities. Finally, Part 2 ends with publishing your applications for users to access and enjoy.
The final and third part of the book covers concepts that every ASP.NET Core developer should know. These include logging details of your application for inquiries and analysis, security concerns and considerations every web application needs to cover, and also, testing your web applications using unit and integration testing.
The book is not only one of the first to be published covering ASP.NET Core, but also brings a practical, comprehensive overview and then deep dives to create web applications that can scale, perform and be deployed to multiple server and cloud platforms. The author brings this all together in small learning sections that fit together to offer the reader the knowledge of this new and exciting web framework.
Infoq has spoken to the author, Andrew Lock.
InfoQ: Tell us a bit about your book
Andrew Lock: ASP.NET Core in action takes you from the basics of how the web works to building applications using authentication, custom components, and MVC. It provides an in-depth look at all the key features of ASP.NET Core and shows how you can use the configuration system, dependency injection, and middleware pipelines to build better server-side rendered applications or Web APIs.
InfoQ: There are a lot of more books covering .NET Core and especially ASP.NET Core. What makes your different?
Lock: ASP.NET Core in Action covers ASP.NET Core 2.0, while many of the existing books cover ASP.NET Core 1.0. There were some significant changes that occurred during the transition from 1 to 2, so it's important to bear in mind when choosing a book. Also, many other books try to cover EF Core or .NET Core as well as ASP.NET Core in the same book. ASP.NET Core in Action provides the background on those topics (including a chapter on EF Core) but stays focused on the web aspect. If you're interested in those topics, I suggest also looking at the complementing books, EF Core in Action and .NET Core in Action.
InfoQ: Who is the book for?
Lock: The book is written assuming you are a C# developer with little to no web experience. It provides the background and description around many of the fundamental concepts in ASP.NET Core and web development in general. If you are already an ASP.NET or web developer, then you will be able to skip through the background to see how ASP.NET Core implements familiar concepts, as well as the new paradigms it introduces.
InfoQ: What prompted you to write this book?
Lock: I started blogging about ASP.NET Core over two years ago. I had been vaguely aware of its development up to that point, but I really started to pay attention around the RC1 timeframe. Blogging was a way for me to really dig into the framework, explore the source code, and figure out how the framework worked. When I was approached about writing the book I jumped at the chance to create something more permanent from everything I had learned. It also gave me an excuse to explore further under the covers!
InfoQ: Why are you particularly suited to writing this book?
Lock: ASP.NET Core has been through quite a few changes in its short life. As someone "on the outside" of Microsoft who's been using the framework for two years and has apps running in production, I feel like I have a good grasp of the key features you need to learn and the speed bumps you'll hit along the way!
InfoQ: What do you see as the key challenges facing organizations thinking of adopting ASP.NET Core?
Lock: For organizations thinking of adopting ASP.NET Core for green-field applications, the main challenges are getting up to speed with the new concepts in ASP.NET Core. There are certain patterns and practices, such as dependency injection, and the concept of middleware, which you'll need to get to grips with to use ASP.NET Core effectively.
Organizations with "legacy" applications running on .NET Framework ASP.NET that are thinking about moving to ASP.NET Core need to understand that they are two different beasts. While possible, how easy a time you have will depend very much on how your applications are structured. .NET Core 2.0 and .NET Standard 2.0 make the process of porting business logic relatively straight forward, but the ASP.NET web application itself may be much more tricky.
InfoQ: Can you give any advice to those setting out on the adoption path for ASP.NET Core based on your experience?
Lock: Try and build small, green-field ASP.NET Core applications initially. It may be tempting to port existing ASP.NET apps to ASP.NET Core, but that's not as simple as you might think. Additionally, try and target .NET Core rather than .NET Framework. That will give you the greatest portability of your code later if you decide to run your applications in Docker for example. Embrace the patterns and conventions the framework nudges you towards.
InfoQ: Where do you see the biggest changes and challenges for ASP.NET Core in the next few years?
Lock: I think one of the biggest challenges for ASP.NET Core is also one of its strengths - the speed at which the framework is moving. Moving fast, by adding new features and fixing bugs, has been a characteristic of ASP.NET Core so far. On the plus side, that lets the team the innovate, and keep up with trends on the web. However, in many ways that fly in the face of the "traditional" Microsoft way. They'll need to be careful that ASP.NET Core isn't seen as too much of a moving target by "classic" .NET customers such as enterprises.
InfoQ: I see no mention of cloud platforms like Azure or AWS in the book. Is that deliberate? What are your thoughts on using ASP.NET Core on cloud platforms about the content of your book?
Lock: Yes, I deliberately chose not to focus on the cloud platforms themselves, for a number of reasons. First, I wanted the book to focus on the ASP.NET Core framework itself. Although related, deploying to the cloud comes with an additional set of requirements and considerations that are somewhat tangential. Secondly, the book is already relatively long - including chapters on cloud platforms would have delayed the publishing date. Finally, the cloud platforms these days change very quickly - any instructions I included in the book was likely to become out of date very quickly!
In terms of deploying to cloud platforms in general, ASP.NET Core is a very good fit. With all the major players directly supporting .NET Core, it's well worth considering. Everything discussed in the book can be applied to apps running in the cloud, you just need to follow the cloud platform's documentation to see how to achieve that. The Microsoft documentation is especially good these days.
InfoQ: Finally, tell us a little about yourself?
Lock: I'm a full-time developer, working predominantly in ASP.NET in Devon, UK. I graduated with a MEng in Engineering from Cambridge University in 2008 and completed my Ph.D. in Medical Image Processing in 2014. At the moment I'm focused on building ASP.NET Core applications to run in Docker and Kubernetes. In my spare time, I enjoy traveling and trail running with my girlfriend.
About the Author
Andrew Lock has been developing professionally with ASP.NET for the last seven years. His focus is currently on the ASP.NET Core framework.
With the release of .NET Core 2.0, Microsoft has the next major version of the general purpose, modular, cross-platform and open source platform that was initially released in 2016. .NET Core has been created to have many of the APIs that are available in the current release of .NET Framework. It was initially created to allow for the next generation of ASP.NET solutions but now drives and is the basis for many other scenarios including IoT, cloud and next generation mobile solutions. In this second series covering .NET Core, we will explore some more the benefits of .NET Core and how it can benefit not only traditional .NET developers but all technologists that need to bring robust, performant and economical solutions to market.
This InfoQ article is part of the series ".NET Core". You can subscribe to receive notifications via RSS.