What to Expect from This Book

This book is targeted at—but not limited to—.NET developers with any level of experience. Starting with a basic “Hello World” console application, it moves along through ASP.NET, MVC, and Entity Framework applications, eventually arriving at a full-featured application running in a Linux container. Because the code in this book is limited to C#, your existing knowledge of .NET and C# will largely determine the speed at which you progress through this volume. More experienced developers will be interested in the few key differences when developing for Linux (and there are quite a few), whereas beginning developers can use this book to learn more advanced programming techniques—the fact that those techniques are related to .NET Core is just icing on the cake.

If you’ve spent most of your time writing code in a language other than C#, with Linux as your native operating system, don’t fret. Though knowledge of C# is highly recommended, even a novice developer with a desire to learn can use this volume, perhaps in concert with another manual that guides the reader in C# development.

Some Assumptions

This book assumes some previous experience with the .NET Framework. Again, while it’s technically not necessary to have prior knowledge when you begin reading, you will need to be familiar with .NET (either by experience or education) to understand what’s happening. Again, not to worry—the knowledge needed isn’t as deep as you might fear. Grasp a few key concepts and you’ll be good to go.

For the purposes of simplicity, the Linux distribution used in the examples will be Red Hat Enterprise Linux (RHEL). Any adjustments necessary for other Linux distributions will be pointed out as we go.

Your Environment

To follow along with the narrative and code, you need to install the Red Hat Container Development Kit (CDK) and clone or download a repository from GitHub. Step-by-step instructions are provided in Chapter 1.

Formatting

The following typographical conventions are used in this book:

Text will be in the typeface you are reading now.

// Code is formatted like this:
using System;

namespace ConsoleApplication
{
    public class Program
    {
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
       }
    }
}  
Command-line commands will be shown like this
Italic

Indicates new terms, URLs, email addresses, filenames, and file extensions.

Constant width

Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.

Constant width bold

Shows commands or other text that should be typed literally by the user.

Constant width italic

Shows text that should be replaced with user-supplied values or by values determined by context.

Tip

This element signifies a tip or suggestion.

Note

This element signifies a general note.

Warning

This element indicates a warning or caution.

.NET Core Is the Future

In November 2014, Microsoft announced that the .NET Framework would be transitioned to an open source development model. This announcement was met with surprise and open arms by the .NET community. Although Microsoft had, up to that moment, done an admirable job of soliciting input from developers about .NET features and bugs, making the source available meant a much higher level of engagement. The standard open source model of using a GitHub repo—with issues, milestones, pull requests, and the related discussions—meant that anyone, anywhere could have instant and transparent access to the development team. Developers could participate in discussions and research defects and workarounds. Schedules and roadmaps would now be available to everyone, leading to more realistic expectations. Surprise announcements would give way to planned milestones.

Meanwhile, developers outside the .NET world saw this as an opportunity to bring their open source experience and knowledge to one of the more pervasive software development platforms. The free exchange of ideas, code reviews, and sense of community found its place inside the Microsoft-centric developer’s world. The infusion of non-.NET developers meant that “dot netters” could gain a broader view of development in general. This is a very good thing.

This is the new model. This is the future.

.NET Core is not just another .NET Framework. Rather, it is the future of .NET. Microsoft has stated that the previous framework, 4.6.1, will still be supported, and bug fixes will be applied, but any new .NET features will be reserved for .NET Core. Using .NET Core as your basis for future work is in line with Microsoft’s stated intentions. While migrating existing code to .NET Core may or may not be a good idea, future development should be based on .NET Core if possible. In short, this is the .NET Framework. Period. Full stop.

What’s Missing

Because some parts of .NET are either specific to Windows or outdated, not everything made the journey from proprietary software to the open source model and .NET Core 1.0.

Here’s a list of some of the things that didn’t make the transition:

  • MWF (Windows Forms)
  • Web forms
  • WCF (SOAP)

In addition, some things haven’t been ported yet—perhaps the biggest being SignalR. Microsoft has publicly stated that SignalR will be ported to .NET Core.

Note

From this point on, unless the difference is worth noting, references to .NET CoreCLR, CoreFX, and the like, will be simplified to “.NET”.

What’s New

.NET is more modular now, which is a definite benefit from starting over when designing the framework. Parts that were previously included by default are now excluded by default. Even what may seem to be the most basic items, such as the ability to render static files in an ASP.NET page, are now optional. This means that you need to be more expressive in your coding, but it also results in performance improvements. The trade-off is worth the cost: writing code is easier than optimizing code.

Get Transitioning to .NET Core on Red Hat Enterprise Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.