Solid .NET in C#
Java and C++ developers usually have little problem learning the syntax of C# or VB.NET. However, developing robust .NET applications requires more than just code. Solid .NET will teach you to think like a .NET developer by showing you how modern applications are assembled and how the various pieces mentioned about work together to form a cohesive environment. The course begins with a thorough exploration of the “managed code” model – from “source code in Notepad” all the way through “CPU instructions executing on a CPU”. We'll then take you through the platform and major libraries. Long the way you’ll learn common idioms like:
- how to handle memory management issues and the “IDisposable” design pattern
- how to use C# functional idioms and LINQ to write compact, powerful, expressive, fluent code
- how to work with designers and tools to manage XAML, Code Behind, and Partial classes
- how to use Configuration Files to tweak application settings after deployment
You’ll take a look at the major class libraries, including the collection classes, LINQ, ADO.NET, Entity Framework, Parallel Framework Extensions, ASP.NET WebAPI and XAML based UI.
Modules in Solid .NET in C#:
.NET Platform Architecture
The .NET runtime environment provides a set of core services to your code in terms of compilation, security and memory management. In this module we will examine the core architecture of .NET and explore the concept of “managed” execution. We will look at how code gets packed and deployed into binaries called assemblies and how this code is loaded and executed at runtime
.NET Type System
One of the most powerful features of .NET is its comprehensive and pervasive type system. However, this type system has a number of aspects that need to be understood to work with .NET effectively. This module discusses the concepts of reference types, value types and the associated concept of boxing. It then proceeds to introduce generics – a technique for building code that can be used efficiently with many different types
Reflection and Attributes
The .NET runtime relies on the availability of full-fidelity type information. The runtime and its associated libraries use this type information to provide powerful services to your code. This idea, however, is not limited to code that Microsoft has written, you can use the same ideas in your own code to build rich frameworks that can dynamically load code and even dynamically invoke it. The technology for working with the type system is known as reflection and has its own API – however, we will see that C#’s dynamic support makes writing reflection style code very simple. As well as being extremely rich, the .NET type information is also extensible via constructs called custom attributes. We will see how to annotate your code with attributes to influence the framework libraries you use and even how you can create your own attributes
Delegates and Events
There are many occasions when you want to be able to pass a method to another piece of code such that they can call it at some point (the most common is to allow a component to fire events that you act upon). .NET has an abstraction to model this idea called delegates – this is the general model for how you pass methods as data. However, because the event concept is so common, .NET also has events as a first class member of the type system and languages have specific keyword support for them. However, sometimes you don’t specifically want to invoke one of your class’s methods but rather an arbitrary block of code. To help with this idea C# introduced first anonymous delegates and then lambda expressions. These useful constructs not only allow you to show the codes intent more clearly but also open up the powerful functional programming concept of closure
Iterators bring features from the world of functional languages into C#. These features simplify boring/boilerplate code and make it possible to streamline code that has traditionally been awkward to write in C#. This talk explains Iterator methods as the basis of the Iterator Pattern in .NET and how they are the underpinning of LINQ
LINQ to Objects
Language Integrated Query is an attempt to merge SQL-like constructs directly into languages like C# and VB.NET. We look at this technology including the from / select / where syntax and talk about how LINQ can be used to query your collections of objects.
However, this module goes a lot deeper than your average talk on LINQ. We will build LINQ lite from scratch highlighting how it works under the covers. With this deeper understanding you will avoid the common gotcha's of LINQ such as repeated execution of query, using Count() rather than Any() etc.
XML processing is incredibly common. Whether you are working in the world of web services, storing user specific state or processing data from other systems, XML is often the vehicle of choice. It is no accident that .NET has had XML processing support since its inception and that idea keeps evolving. In this module we will start by looking at the core XML streaming API and then introduce LINQ to XML as the new API for XML processing. LINQ to XML allows you to locate information with a very concise syntax. However, more that that it allows both the generation of XML and a simple way of transforming XML data to and from objects.
Memory and Resource Management
One of the key services the .NET runtime provides is automated memory management. In this module we will introduce how and when the garbage collector runs and what it does to reclaim your unused memory. However, memory is not the only resource that applications use: database connections, file handles, sockets and more are all expensive resources that need management. .NET has a pattern for how non-memory resources are managed in the form of the interface IDisposable and its accompanying language support in the form of “using” blocks. The IDisposable pattern is often misunderstood so you will leave this module with a clear understanding of how it’s used and when you need to provide an implementation yourself
Using Relational Databases in .NET
Nearly all business applications have at their heart somewhere a relational database. In this module as look at the core data access API in the form of ADO.NET. We then look at Microsoft’s Object Relational Mapper (ORM) technology – Entity Framework (EF). The idea is for framework code to take care of the mechanics of getting the data in and out of the database while application developers concentrate on working with the objects that are mapped on to the database tables behind the scenes. We will look at the core Entity Framework concepts and how LINQ integrates with EF to provide a language based query model that get translated into SQL by the Entity Framework.
When the Parallel Framework Extensions (PFx) were first announced it looked as though it was going to target a narrow set of requirements around parallelizing processor intensive code. Over time the scope of the library has grown significantly such that it has become the main model for building asynchronous code. The pivotal type enabling this transition is the Task class. This is a, functionally, very rich type allowing the creation of both short and long lived asynchronous work. Tasks can have dependencies on one another and support cancellation. In this, the first of the PFx modules we look, specifically, how this class gives us a unified framework for building multi-threaded code.
Asynchronous programming requires careful attention to detail because most objects are not designed with multi-threaded access in mind. This module introduces core primitives provided by .NET such as Interlocked, Monitors and Reader-Writer locks. We will see that writing effective multi-threaded code is a balancing act between ensuring against data corruption while allowing as much concurrency as possible.
Introduction to Windows Communication Foundation (WCF)
The shift from object oriented development to component oriented development made it possible to build more loosely coupled and flexible systems where individual components evolved independently without impacting the overall system. The Windows Communication Foundation continues those practices by providing a model which is based on interfaces and contracts. This talk will introduce you to the WCF model and how to utilize it to build service-oriented and distributed applications.
Introduction to ASP.NET
Probably the most common type of application to build with .NET is a web application. .NET introduces a number of frameworks for building HTTP based applications and all of them sit on top of the same processing engine and deployment model. We will examine the two most popular forms of programming with ASP.NET. MVC and WebAPI, MVC is predominately used for delivering UI based web content, and WebAPI for providing data to other applications over HTTP via JSON and XML. WebAPI allows the development of RESTful APIs.
Building XAML UI
In this module, you will learn about Microsoft’s XAML programming language. This is the foundation for Microsoft’s latest UI technologies: Windows Universal applications and WPF. XAML is a form of XML helping to separate visuals from behavior. XAML is a must for anyone wishing to build UI on the Microsoft platform.