![.NET Core in Action](http://img.images-bn.com/static/redesign/srcs/images/grey-box.png?v11.8.5)
![.NET Core in Action](http://img.images-bn.com/static/redesign/srcs/images/grey-box.png?v11.8.5)
eBook
Available on Compatible NOOK devices, the free NOOK App and in My Digital Library.
Related collections and offers
Overview
.NET Core in Action shows .NET developers how to build professional software applications with .NET Core. Learn how to convert existing .NET code to work on multiple platforms or how to start new projects with knowledge of the tools and capabilities of .NET Core.
Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.
About the Technology
.NET Core is an open source framework that lets you write and run .NET applications on Linux and Mac, without giving up on Windows. Built for everything from lightweight web apps to industrial-strength distributed systems, it's perfect for deploying .NET servers to any cloud platform, including AWS and GCP.
About the Book
.NET Core in Action introduces you to cross-platform development with .NET Core. This hands-on guide concentrates on new Core features as you walk through familiar tasks like testing, logging, data access, and networking. As you go, you'll explore modern architectures like microservices and cloud data storage, along with practical matters like performance profi ling, localization, and signing assemblies.
What's Inside
- Choosing the right tools
- Testing, profiling, and debugging
- Interacting with web services
- Converting existing projects to .NET Core
- Creating and using NuGet packages
About the Reader
All examples are in C#.
About the Author
Dustin Metzgar is a seasoned developer and architect involved in numerous .NET Core projects. Dustin works for Microsoft.
Table of Contents
- Why .NET Core?
- Building your first .NET Core applications
- How to build with .NET Core
- Unit testing with xUnit
- Working with relational databases
- Simplify data access with object-relational mappers
- Creating a microservice
- Debugging
- Performance and profiling
- Building world-ready applications
- Multiple frameworks and runtimes
- Preparing for release
- appendix A - Frameworks and runtimes
- appendix B - xUnit command-line options
- appendix C - What's in the .NET Standard Library?
- appendix D - NuGet cache locations
Product Details
ISBN-13: | 9781638357049 |
---|---|
Publisher: | Manning |
Publication date: | 07/12/2018 |
Sold by: | SIMON & SCHUSTER |
Format: | eBook |
Pages: | 288 |
File size: | 3 MB |
About the Author
Dustin Metzgar is a seasoned developer and architect. When he worked for Microsoft, Dustin contributed to the .NET Framework, .NET Core, and the open sourcing of .NET.
Table of Contents
Foreword ix
Preface x
Acknowledgments xii
About this book xiii
About the author xvi
About the cover illustration xvii
1 Why .NET Core? 1
1.1 Architecting enterprise applications before .NET Core 2
1.2 If you're a .NET Framework developer 3
Your .NET apps can be cross-platform 3
ASP.NET Core outperforms ASP.NET in the .NET Framework 3
NET Core is the focus for innovation 4
Release cycles are faster 4
1.3 If you are new to .NET 4
C# is an amazing language 5
.NET Core is not starting from scratch 5
Focus on performance 5
1.4 What is .NET Core? 5
1.5 Key .NET Core features 6
Expanding the reach of your libraries 6
Simple deployment on any platform 7
Clouds and containers 8
ASP.NET performance 9
Open source 10
Bring your own tools 11
1.6 Applying .NET Core to real-world applications 11
1.7 Differences from the .NET Framework 12
Framework features not ported to Core 12
Subtle changes for .NET Framework developers 12
Changes to .NET reflection 13
2 Building your first .NET Core applications 15
2.1 The trouble with development environments 15
2.2 Installing the .NET Core SDK 16
Installing on Windows operating systems 16
Installing on Linux-based operating systems 16
Installing on macOS 16
Building .NET Core Docker containers 17
2.3 Creating and running the Hello World console application 17
Before you build 18
Running a .NET Core application 18
2.4 Creating an ASP.NET Core web application 18
ASP.NET Core uses the Kestrel web server 19
Using a Startup class to initialize the web server 20
Running the Hello World web application 21
2.5 Creating an ASP.NET Core website from the template 22
2.6 Deploying to a server 22
Publishing an application 23
Deploying to a Docker container 25
Packaging for distribution 26
2.7 Development tools available for .NET Core 27
OmniSharp 27
Visual Studio for Mac 28
Visual Studio 2017 28
3 How to build with .NET Core 32
3.1 Key concepts in .NET Core's build system 32
Introducing MSBuild 33
Creating .NET projects from the command line 33
Clearing up the terminology 33
3.2 CSV parser sample project 36
3.3 Introducing MSBuild 39
PropertyGroups 39
Targets 40
ItemGroups 41
3.4 Dependencies 44
3.5 Targeting multiple frameworks 45
4 Unit testing with xUnit 48
4.1 Why write unit tests? 48
4.2 Business-day calculator example 49
4.3 xUnit-a .NET Core unit-testing framework 51
4.4 Setting up the xUnit test project 52
4.5 Evaluating truth with xUnit facts 52
4.6 Running tests from development environments 54
4.7 When it's impossible to prove all cases, use a theory 55
4.8 Shared context between tests 57
Using the constructor for setup 57
Using Dispose for cleanup 60
Sharing context with class fixtures 62
Sharing context with collection fixtures 63
4.9 Getting output from xUnit tests 65
4.10 Traits 66
5 Working with relational databases 69
5.1 Using SQLite for prototyping 70
5.2 Planning the application and database schema 72
Tracking inventory 72
Creating tables in SQLite 73
5.3 Creating a data-access library 76
Specifying relationships in data and code 80
Updating data 84
Managing inventory 89
Using transactions for consistency 91
5.4 Ordering new parts from suppliers 93
Creating an Order 94
Checking if parts need to be ordered 99
6 Simplify data access with object-relational mappers 104
6.1 Dapper 105
Inserting rows with Dapper 108
Applying transactions to Dapper commands 109
The drawback of a micro-ORM 110
A brief introduction to dependency injection 112
Dependency injection in .NET Core 114
Configuring the application 122
When to build your own data-access layer 126
6.2 Entity Framework Core 127
Using EF migrations to create the database 129
Running the tests using EF 130
7 Creating a microservice 134
7.1 Writing an ASP.NET web service 135
Converting Markdown to HTML 135
Creating an ASP.NET web service 136
Testing the web service with Curl 139
7.2 Making HTTP calls 139
7.3 Making the service asynchronous 141
7.4 Getting data from Azure Blob Storage 142
Getting values from, configuration 142
Creating the GetBlob method 144
Testing the new Azure storage operation 147
7.5 Uploading and receiving uploaded data 148
7.6 Listing containers and BLOBs 150
7.7 Deleting a BLOB 152
8 Debugging 155
8.1 Debugging applications with Visual Studio Code 156
Using the .NET Core debugger 158
8.2 Debugging with Visual Studio 2017 160
8.3 Debugging with Visual Studio for Mac 162
8.4 SOS 163
Easier to get started with a self-contained app 164
WinDBG/CDB 166
LIDB 170
9 Performance and profiling 173
9.1 Creating a test application 174
9.2 xUnit.Performance makes it easy to run performance tests 177
9.3 Using PerfView on .NET Core applications 184
Getting a CPU profile 184
Analyzing a CPU profile 187
Looking at GC information 191
Exposing exceptions 192
Collecting performance data on Linux 194
10 Building world-ready applications 196
10.1 Going international 197
Setting up the sample, application 197
Making the sample application world-ready 198
10.2 Using a logging framework instead of writing to the console 202
Using the Microsoft .Extensions.Logging library 204
Internationalization 207
Globalization 207
Localizahility review 208
10.3 Using the Microsoft localization extensions library 209
Testing right-to-left languages 211
Invariant culture 213
Using EventSource to emit events 214
Using EventListener to listen for events 216
10.4 Other considerations for globalization 219
10.5 Localization 219
11 Multiple frameworks and runtimes 222
11.1 Why does the .NET Core SDK support multiple frameworks and runtimes? 222
11.2 .NET Portability Analyzer 224
Installing and configuring the Visual Studio 2017 plugin 224
Sample .NET Framework project 225
Running the Portability Analyzer in Visual Studio 226
11.3 Supporting multiple frameworks 230
Using EventSource to replace EventProvider 230
Adding another framework to the project 233
Creating a NuGet package and checking the contents 235
Per-framework build options 235
11.4 Runtime-specific code 238
12 Preparing for release 242
12.1 Preparing a NuGet package 242
How to handle project references 244
NuGet feeds 247
Packaging resource assemblies 248
12.2 Signing assemblies 249
Generating a signing key 250
Delay-signing 250
Signing an assembly in .NET Core 251
Appendix A Frameworks and runtimes 253
Appendix B xUnit command-line options 255
Appendix C What's in the .NET Standard Library? 257
Appendix D NuGet cache locations 260
Index 261