zoukankan      html  css  js  c++  java
  • C# 9.0 and .NET 5 – Modern Cross-Platform Development

    C# 9.0 and .NET 5 – Modern Cross-Platform Development

    Table of Contents

    Chapter 1: Hello, C#! Welcome, .NET! 1

    Setting up your development environment 2
    Using Visual Studio Code for cross-platform development 2
    Using GitHub Codespaces for development in the cloud 3
    Using Visual Studio 2019 for Windows app development 4
    Using Visual Studio for Mac for mobile development 4
    Recommended tools for chapters 4
    Deploying cross-platform 5
    Understanding Microsoft Visual Studio Code versions 5
    Downloading and installing Visual Studio Code 7
    Installing other extensions 8
    Understanding .NET 8
    Understanding .NET Framework 8
    Understanding the Mono and Xamarin projects 9
    Understanding .NET Core 9
    Understanding .NET 5 and the journey to one .NET 10
    Understanding .NET support 11
    Understanding .NET Runtime and .NET SDK versions 12
    Removing old versions of .NET 13
    What is different about .NET Core and .NET 5? 14
    Understanding .NET Standard 15
    .NET platforms and tools used by the book editions 16
    Understanding intermediate language 17
    Comparing .NET technologies 17
    Building console apps using Visual Studio Code 17
    Writing code using Visual Studio Code 18
    Compiling and running code using the dotnet CLI 20
    Writing top-level programs 20
    Downloading solution code from the GitHub repository 21
    Using Git with Visual Studio Code 21
    Cloning the book solution code repository 22
    Looking for help 22
    Reading Microsoft documentation 22
    Getting help for the dotnet tool 22
    Getting definitions of types and their members 23
    Looking for answers on Stack Overflow 25
    Searching for answers using Google 26
    Subscribing to the official .NET blog 26
    Scott Hanselman's videos 26
    Practicing and exploring 27
    Exercise 1.1 – Test your knowledge 27
    Exercise 1.2 – Practice C# anywhere 27
    Exercise 1.3 – Explore topics 27
    Summary 28

    Chapter 2: Speaking C# 29

    Introducing C# 29
    Understanding language versions and features 30
    C# 1.0 30
    C# 2.0 30
    C# 3.0 30
    C# 4.0 31
    C# 5.0 31
    C# 6.0 31
    C# 7.0 31
    C# 7.1 32
    C# 7.2 32
    C# 7.3 32
    C# 8.0 32
    C# 9.0 33
    Discovering your C# compiler versions 33
    Enabling a specific language version compiler 35
    Understanding C# basics 36
    Understanding C# grammar 37
    Statements 37
    Comments 37
    Blocks 38
    Understanding C# vocabulary 38
    Changing the color scheme for syntax 38
    Comparing programming languages to human languages 39
    Help for writing correct code 39
    Verbs are methods 40
    Nouns are types, fields, and variables 40
    Revealing the extent of the C# vocabulary 41
    Working with variables 43
    Naming things and assigning values 44
    Literal values 44
    Storing text 44
    Understanding verbatim strings 45
    Storing numbers 46
    Storing whole numbers 46
    Storing real numbers 48
    Writing code to explore number sizes 48
    Comparing double and decimal types 49
    Storing Booleans 51
    Using Visual Studio Code workspaces 51
    Storing any type of object 52
    Storing dynamic types 53
    Declaring local variables 54
    Specifying and inferring the type of a local variable 54
    Using target-typed new to instantiate objects 55
    Getting default values for types 55
    Storing multiple values 56
    Working with null values 57
    Making a value type nullable 57
    Understanding nullable reference types 58
    Enabling nullable and non-nullable reference types 59
    Declaring non-nullable variables and parameters 59
    Checking for null 61
    Exploring console applications further 62
    Displaying output to the user 62
    Formatting using numbered positional arguments 62
    Formatting using interpolated strings 63
    Understanding format strings 63
    Getting text input from the user 65
    Importing a namespace 65
    Simplifying the usage of the console 66
    Getting key input from the user 66
    Getting arguments 67
    Setting options with arguments 69
    Handling platforms that do not support an API 70
    Practicing and exploring 71
    Exercise 2.1 – Test your knowledge 71
    Exercise 2.2 – Practice number sizes and ranges 71
    Exercise 2.3 – Explore topics 72
    Summary 72

    Chapter 3: Controlling Flow and Converting Types 73

    Operating on variables 73
    Unary operators 74
    Binary arithmetic operators 75
    Assignment operators 76
    Logical operators 76
    Conditional logical operators 78
    Bitwise and binary shift operators 79
    Miscellaneous operators 80
    Understanding selection statements 81
    Branching with the if statement 81
    Why you should always use braces with if statements 82
    Pattern matching with the if statement 83
    Branching with the switch statement 83
    Pattern matching with the switch statement 85
    Simplifying switch statements with switch expressions 87
    Understanding iteration statements 88
    Looping with the while statement 88
    Looping with the do statement 88
    Looping with the for statement 89
    Looping with the foreach statement 90
    Understanding how foreach works internally 90
    Casting and converting between types 91
    Casting numbers implicitly and explicitly 91
    Converting with the System.Convert type 93
    Rounding numbers 94
    Understanding the default rounding rules 94
    Taking control of rounding rules 95
    Converting from any type to a string 95
    Converting from a binary object to a string 96
    Parsing from strings to numbers or dates and times 97
    Avoiding exceptions using the TryParse method 98
    Handling exceptions when converting types 99
    Wrapping error-prone code in a try block 99
    Catching all exceptions 100
    Catching specific exceptions 101
    Checking for overflow 102
    Throwing overflow exceptions with the checked statement 103
    Disabling compiler overflow checks with the unchecked statement 104
    Practicing and exploring 105
    Exercise 3.1 – Test your knowledge 106
    Exercise 3.2 – Explore loops and overflow 106
    Exercise 3.3 – Practice loops and operators 106
    Exercise 3.4 – Practice exception handling 107
    Exercise 3.5 – Test your knowledge of operators 108
    Exercise 3.6 – Explore topics 108
    Summary 108

    Chapter 4: Writing, Debugging, and Testing Functions 109

    Writing functions 109
    Writing a times table function 110
    Writing a function that returns a value 112
    Writing mathematical functions 114
    Converting numbers from cardinal to ordinal 114
    Calculating factorials with recursion 116
    Documenting functions with XML comments 119
    Using lambdas in function implementations 120
    Debugging during development 123
    Creating code with a deliberate bug 123
    Setting a breakpoint 124
    Navigating with the debugging toolbar 125
    Debugging windows 126
    Stepping through code 126
    Customizing breakpoints 127
    Logging during development and runtime 128
    Instrumenting with Debug and Trace 129
    Writing to the default trace listener 130
    Configuring trace listeners 131
    Switching trace levels 132
    Unit testing functions 135
    Creating a class library that needs testing 135
    Writing unit tests 137
    Running unit tests 138
    Practicing and exploring 139
    Exercise 4.1 – Test your knowledge 139
    Exercise 4.2 – Practice writing functions with debugging and unit testing 140
    Exercise 4.3 – Explore topics 140
    Summary 140

    Chapter 5: Building Your Own Types with Object-Oriented Programming 141

    Talking about object-oriented programming 141
    Building class libraries 142
    Creating a class library 142
    Defining a class 143
    Understanding members 144
    Instantiating a class 145
    Referencing an assembly 145
    Importing a namespace to use a type 146
    Managing multiple files 146
    Understanding objects 147
    Inheriting from System.Object 147
    Storing data within fields 148
    Defining fields 148
    Understanding access modifiers 149
    Setting and outputting field values 149
    Storing a value using an enum type 150
    Storing multiple values using an enum type 152
    Storing multiple values using collections 153
    Making a field static 154
    Making a field constant 155
    Making a field read-only 156
    Initializing fields with constructors 157
    Setting fields with default literals 158
    Writing and calling methods 160
    Returning values from methods 160
    Combining multiple returned values using tuples 161
    Naming the fields of a tuple 162
    Inferring tuple names 163
    Deconstructing tuples 163
    Defining and passing parameters to methods 164
    Overloading methods 164
    Passing optional parameters and naming arguments 165
    Controlling how parameters are passed 167
    Understanding ref returns 168
    Splitting classes using partial 168
    Controlling access with properties and indexers 169
    Defining read-only properties 169
    Defining settable properties 171
    Defining indexers 172
    Pattern matching with objects 173
    Creating and referencing a .NET 5 class library 173
    Defining flight passengers 174
    Enhancements to pattern matching in C# 9 176
    Working with records 177
    Init-only properties 177
    Understanding records 178
    Simplifying data members 179
    Positional records 179
    Practicing and exploring 180
    Exercise 5.1 – Test your knowledge 180
    Exercise 5.2 – Explore topics 181
    Summary 181

    Chapter 6: Implementing Interfaces and Inheriting Classes 183

    Setting up a class library and console application 184
    Simplifying methods 186
    Implementing functionality using methods 186
    Implementing functionality using operators 188
    Implementing functionality using local functions 189
    Raising and handling events 190
    Calling methods using delegates 190
    Defining and handling delegates 191
    Defining and handling events 193
    Implementing interfaces 194
    Common interfaces 194
    Comparing objects when sorting 195
    Comparing objects using a separate class 197
    Defining interfaces with default implementations 198
    Making types safely reusable with generics 200
    Working with generic types 202
    Working with generic methods 203
    Managing memory with reference and value types 204
    Working with struct types 205
    Releasing unmanaged resources 207
    Ensuring that Dispose is called 209
    Inheriting from classes 210
    Extending classes to add functionality 210
    Hiding members 211
    Overriding members 212
    Preventing inheritance and overriding 213
    Understanding polymorphism 214
    Casting within inheritance hierarchies 215
    Implicit casting 215
    Explicit casting 215
    Avoiding casting exceptions 216
    Inheriting and extending .NET types 217
    Inheriting exceptions 217
    Extending types when you can't inherit 219
    Using static methods to reuse functionality 219
    Using extension methods to reuse functionality 220
    Practicing and exploring 221
    Exercise 6.1 – Test your knowledge 221
    Exercise 6.2 – Practice creating an inheritance hierarchy 222
    Exercise 6.3 – Explore topics 222
    Summary 223

    Chapter 7: Understanding and Packaging .NET Types 225

    Introducing .NET 5 225
    .NET Core 1.0 226
    .NET Core 1.1 227
    .NET Core 2.0 227
    .NET Core 2.1 227
    .NET Core 2.2 228
    .NET Core 3.0 228
    .NET 5.0 228
    Improving performance from .NET Core 2.0 to .NET 5 229
    Understanding .NET components 229
    Understanding assemblies, packages, and namespaces 230
    Understanding dependent assemblies 230
    Understanding the Microsoft .NET project SDKs 231
    Understanding NuGet packages 232
    Understanding frameworks 232
    Importing a namespace to use a type 233
    Relating C# keywords to .NET types 234
    Sharing code with legacy platforms using .NET Standard 235
    Creating a .NET Standard 2.0 class library 236
    Publishing your applications for deployment 237
    Creating a console application to publish 237
    Understanding dotnet commands 238
    Creating new projects 238
    Managing projects 239
    Publishing a self-contained app 239
    Publishing a single-file app 240
    Reducing the size of apps using app trimming 242
    Decompiling assemblies 243
    Packaging your libraries for NuGet distribution 246
    Referencing a NuGet package 246
    Fixing dependencies 247
    Packaging a library for NuGet 247
    Testing your package 250
    Porting from .NET Framework to .NET 5 252
    Could you port? 252
    Should you port? 252
    Differences between .NET Framework and .NET 5 253
    Understanding the .NET Portability Analyzer 253
    Using non-.NET Standard libraries 253
    Practicing and exploring 255
    Exercise 7.1 – Test your knowledge 255
    Exercise 7.2 – Explore topics 256
    Summary 256

    Chapter 8: Working with Common .NET Types 257

    Working with numbers 258
    Working with big integers 258
    Working with complex numbers 259
    Working with text 260
    Getting the length of a string 260
    Getting the characters of a string 260
    Splitting a string 261
    Getting part of a string 261
    Checking a string for content 262
    Joining, formatting, and other string members 262
    Building strings efficiently 264
    Pattern matching with regular expressions 264
    Checking for digits entered as text 264
    Understanding the syntax of a regular expression 266
    Examples of regular expressions 266
    Splitting a complex comma-separated string 267
    Regular expression performance improvements 268
    Storing multiple objects in collections 269
    Common features of all collections 270
    Understanding collection choices 271
    Lists 272
    Dictionaries 272
    Stacks 273
    Queues 273
    Sets 273
    Working with lists 273
    Working with dictionaries 275
    Sorting collections 275
    Using specialized collections 276
    Using immutable collections 276
    Working with spans, indexes, and ranges 277
    Using memory efficiently using spans 277
    Identifying positions with the Index type 278
    Identifying ranges with the Range type 278
    Using indexes and ranges 279
    Working with network resources 280
    Working with URIs, DNS, and IP addresses 280
    Pinging a server 281
    Working with types and attributes 282
    Versioning of assemblies 283
    Reading assembly metadata 284
    Creating custom attributes 286
    Doing more with reflection 288
    Working with images 289
    Internationalizing your code 290
    Detecting and changing the current culture 291
    Handling time zones 293
    Practicing and exploring 293
    Exercise 8.1 – Test your knowledge 293
    Exercise 8.2 – Practice regular expressions 294
    Exercise 8.3 – Practice writing extension methods 294
    Exercise 8.4 – Explore topics 294
    Summary 295

    Chapter 9: Working with Files, Streams, and Serialization 297

    Managing the filesystem 297
    Handling cross-platform environments and filesystems 297
    Managing drives 299
    Managing directories 300
    Managing files 303
    Managing paths 304
    Getting file information 305
    Controlling how you work with files 307
    Reading and writing with streams 307
    Writing to text streams 309
    Writing to XML streams 310
    Disposing of file resources 312
    Compressing streams 314
    Compressing with the Brotli algorithm 316
    High-performance streams using pipelines 318
    Asynchronous streams 318
    Encoding and decoding text 319
    Encoding strings as byte arrays 319
    Encoding and decoding text in files 322
    Serializing object graphs 322
    Serializing as XML 322
    Generating compact XML 325
    Deserializing XML files 326
    Serializing with JSON 327
    High-performance JSON processing 328
    Practicing and exploring 330
    Exercise 9.1 – Test your knowledge 330
    Exercise 9.2 – Practice serializing as XML 331
    Exercise 9.3 – Explore topics 332
    Summary 332

    Chapter 10: Protecting Your Data and Applications 333

    Understanding the vocabulary of protection 334
    Keys and key sizes 334
    IVs and block sizes 335
    Salts 335
    Generating keys and IVs 336
    Encrypting and decrypting data 336
    Encrypting symmetrically with AES 337
    Hashing data 341
    Hashing with the commonly used SHA256 342
    Signing data 345
    Signing with SHA256 and RSA 346
    Generating random numbers 349
    Generating random numbers for games 349
    Generating random numbers for cryptography 350
    What's new in cryptography? 351
    Authenticating and authorizing users 352
    Implementing authentication and authorization 354
    Protecting application functionality 357
    Practicing and exploring 358
    Exercise 10.1 – Test your knowledge 358
    Exercise 10.2 – Practice protecting data with encryption and hashing 358
    Exercise 10.3 – Practice protecting data with decryption 359
    Exercise 10.4 – Explore topics 359
    Summary 359

    Chapter 11: Working with Databases Using Entity Framework Core 361

    Understanding modern databases 361
    Understanding legacy Entity Framework 362
    Understanding Entity Framework Core 363
    Using a sample relational database 363
    Setting up SQLite for macOS 364
    Setting up SQLite for Windows 365
    Creating the Northwind sample database for SQLite 365
    Managing the Northwind sample database with SQLiteStudio 366
    Setting up EF Core 367
    Choosing an EF Core database provider 367
    Setting up the dotnet-ef tool 368
    Connecting to the database 369
    Defining EF Core models 369
    EF Core conventions 370
    EF Core annotation attributes 370
    EF Core Fluent API 371
    Understanding data seeding 372
    Building an EF Core model 372
    Defining the Category and Product entity classes 373
    Defining the Northwind database context class 375
    Scaffolding models using an existing database 377
    Querying EF Core models 381
    Filtering included entities 383
    Filtering and sorting products 384
    Getting the generated SQL 386
    Logging EF Core 387
    Logging with query tags 391
    Pattern matching with Like 391
    Defining global filters 392
    Loading patterns with EF Core 393
    Eager loading entities 393
    Enabling lazy loading 394
    Explicit loading entities 395
    Manipulating data with EF Core 397
    Inserting entities 397
    Updating entities 399
    Deleting entities 400
    Pooling database contexts 401
    Transactions 401
    Defining an explicit transaction 402
    Practicing and exploring 403
    Exercise 11.1 – Test your knowledge 403
    Exercise 11.2 – Practice exporting data using different serialization formats 403
    Exercise 11.3 – Explore the EF Core documentation 404
    Summary 404

    Chapter 12: Querying and Manipulating Data Using LINQ 405

    Writing LINQ queries 405
    Extending sequences with the Enumerable class 406
    Filtering entities with Where 407
    Targeting a named method 409
    Simplifying the code by removing the explicit delegate instantiation 410
    Targeting a lambda expression 410
    Sorting entities 410
    Sorting by a single property using OrderBy 411
    Sorting by a subsequent property using ThenBy 411
    Filtering by type 412
    Working with sets and bags using LINQ 413
    Using LINQ with EF Core 415
    Building an EF Core model 415
    Filtering and sorting sequences 418
    Projecting sequences into new types 419
    Joining and grouping sequences 420
    Aggregating sequences 424
    Sweetening LINQ syntax with syntactic sugar 425
    Using multiple threads with parallel LINQ 426
    Creating an app that benefits from multiple threads 426
    Using Windows 10 427
    Using macOS 427
    For all operating systems 428
    Creating your own LINQ extension methods 429
    Working with LINQ to XML 433
    Generating XML using LINQ to XML 433
    Reading XML using LINQ to XML 433
    Practicing and exploring 434
    Exercise 12.1 – Test your knowledge 435
    Exercise 12.2 – Practice querying with LINQ 435
    Exercise 12.3 – Explore topics 436
    Summary 436

    Chapter 13: Improving Performance and Scalability Using Multitasking 437

    Understanding processes, threads, and tasks 437
    Monitoring performance and resource usage 439
    Evaluating the efficiency of types 439
    Monitoring performance and memory use 440
    Implementing the Recorder class 441
    Measuring the efficiency of processing strings 443
    Running tasks asynchronously 445
    Running multiple actions synchronously 445
    Running multiple actions asynchronously using tasks 446
    Waiting for tasks 448
    Continuing with another task 449
    Nested and child tasks 450
    Synchronizing access to shared resources 452
    Accessing a resource from multiple threads 452
    Applying a mutually exclusive lock to a resource 454
    Understanding the lock statement and avoiding deadlocks 454
    Synchronizing events 456
    Making CPU operations atomic 457
    Applying other types of synchronization 458
    Understanding async and await 458
    Improving responsiveness for console apps 459
    Improving responsiveness for GUI apps 460
    Improving scalability for web applications and web services 460
    Common types that support multitasking 461
    Using await in catch blocks 461
    Working with async streams 461
    Practicing and exploring 462
    Exercise 13.1 – Test your knowledge 462
    Exercise 13.2 – Explore topics 463
    Summary 463

    Chapter 14: Introducing Practical Applications of C# and .NET 465

    Understanding app models for C# and .NET 465
    Building websites using ASP.NET Core 466
    Building websites using a web content management system 466
    Understanding web applications 467
    Building and consuming web services 468
    Building intelligent apps 468
    New features in ASP.NET Core 468
    ASP.NET Core 1.0 468
    ASP.NET Core 1.1 469
    ASP.NET Core 2.0 469
    ASP.NET Core 2.1 469
    ASP.NET Core 2.2 470
    ASP.NET Core 3.0 470
    ASP.NET Core 3.1 471
    Blazor WebAssembly 3.2 471
    ASP.NET Core 5.0 471
    Understanding SignalR 472
    Understanding Blazor 474
    JavaScript and friends 474
    Silverlight – C# and .NET using a plugin 474
    WebAssembly – a target for Blazor 474
    Blazor on the server side or client side 475
    Understanding the bonus chapters 475
    Building cross-platform mobile and desktop apps 476
    Building Windows desktop apps using legacy technologies 477
    Building an entity data model for Northwind 478
    Creating a class library for Northwind entity models 478
    Generating entity models using dotnet-ef 478
    Manually improving the class-to-table mapping 480
    Creating a class library for a Northwind database context 482
    Summary 484

    Chapter 15: Building Websites Using ASP.NET Core Razor Pages 485

    Understanding web development 485
    Understanding HTTP 485
    Client-side web development 489
    Understanding ASP.NET Core 489
    Classic ASP.NET versus modern ASP.NET Core 490
    Creating an ASP.NET Core project 491
    Testing and securing the website 493
    Controlling the hosting environment 496
    Enabling static and default files 497
    Exploring Razor Pages 500
    Enabling Razor Pages 500
    Defining a Razor Page 501
    Using shared layouts with Razor Pages 502
    Using code-behind files with Razor Pages 505
    Using Entity Framework Core with ASP.NET Core 507
    Configure Entity Framework Core as a service 507
    Manipulating data using Razor Pages 508
    Enabling a model to insert entities 508
    Defining a form to insert new suppliers 509
    Using Razor class libraries 510
    Creating a Razor class library 511
    Disabling compact folders 511
    Implementing the employees feature using EF Core 512
    Implementing a partial view to show a single employee 514
    Using and testing a Razor class library 515
    Configuring services and the HTTP request pipeline 516
    Registering services 518
    Configuring the HTTP request pipeline 519
    Simplest possible ASP.NET Core website project 523
    Practicing and exploring 524
    Exercise 15.1 – Test your knowledge 524
    Exercise 15.2 – Practice building a data-driven web page 525
    Exercise 15.3 – Practice building web pages for console apps 525
    Exercise 15.4 – Explore topics 525
    Summary 526

    Chapter 16: Building Websites Using the Model-View-Controller Pattern 527

    Setting up an ASP.NET Core MVC website 527
    Creating and exploring an ASP.NET Core MVC website 528
    Reviewing the ASP.NET Core MVC website 531
    Reviewing the ASP.NET Core Identity database 532
    Exploring an ASP.NET Core MVC website 533
    Understanding ASP.NET Core MVC startup 533
    Understanding the default MVC route 535
    Understanding controllers and actions 536
    Understanding the view search path convention 538
    Unit testing MVC 539
    Understanding filters 539
    Using a filter to secure an action method 539
    Using a filter to cache a response 540
    Using a filter to define a custom route 540
    Understanding entity and view models 541
    Understanding views 543
    Customizing an ASP.NET Core MVC website 546
    Defining a custom style 546
    Setting up the category images 546
    Understanding Razor syntax 547
    Defining a typed view 547
    Reviewing the customized home page 550
    Passing parameters using a route value 551
    Understanding model binders 554
    Validating the model 558
    Understanding view helper methods 560
    Querying a database and using display templates 561
    Improving scalability using asynchronous tasks 564
    Making controller action methods asynchronous 565
    Using other project templates 566
    Installing additional template packs 566
    Practicing and exploring 567
    Exercise 16.1 – Test your knowledge 567
    Exercise 16.2 – Practice implementing MVC by implementing a category
    detail page 568
    Exercise 16.3 – Practice improving scalability by understanding and
    implementing async action methods 568
    Exercise 16.4 – Explore topics 568
    Summary 569

    Chapter 17: Building Websites Using a Content Management System 571

    Understanding the benefits of a CMS 571
    Understanding basic CMS features 572

    Understanding enterprise CMS features 572
    Understanding CMS platforms 573
    Understanding Piranha CMS 573
    Open source libraries and licensing 574
    Creating a Piranha CMS website 574
    Exploring a Piranha CMS website 576
    Editing site and page content 577
    Creating a new top-level page 580
    Creating a new child page 582
    Reviewing the blog archive 583
    Commenting on posts and pages 585
    Exploring authentication and authorization 586
    Exploring configuration 588
    Testing the new content 589
    Understanding routing 589
    Understanding media 591
    Understanding the application service 592
    Understanding content types 593
    Understanding component types 593
    Understanding standard fields 594
    Customizing the rich text editor 594
    Reviewing the Standard page type 595
    Reviewing the Standard archive and post types 598
    Understanding standard blocks 599
    Reviewing component types and standard blocks 599
    Defining components, content types, and templates 601
    Creating custom regions 601
    Creating an entity data model 603
    Creating custom page types 604
    Creating custom view models 605
    Defining custom content templates for content types 606
    Configuring startup and importing from a database 609
    Learning how to create content using the project template 612
    Testing the Northwind CMS website 613
    Uploading images and creating the catalog root 613
    Importing category and product content 614
    Managing catalog content 616
    Reviewing how Piranha stores content 617
    Practicing and exploring 619
    Exercise 17.1 – Test your knowledge 619
    Exercise 17.2 – Practice defining a block type for rendering YouTube videos 619
    Exercise 17.3 – Explore topics 620
    Summary 620

    Chapter 18: Building and Consuming Web Services 621

    Building web services using the ASP.NET Core Web API 621
    Understanding web service acronyms 622
    Creating an ASP.NET Core Web API project 623
    Reviewing the web service's functionality 626
    Creating a web service for the Northwind database 627
    Creating data repositories for entities 629
    Implementing a Web API controller 632
    Configuring the customers repository and Web API controller 634
    Specifying problem details 638
    Controlling XML serialization 639
    Documenting and testing web services 640
    Testing GET requests using a browser 640
    Testing HTTP requests with the REST Client extension 641
    Understanding Swagger 646
    Testing requests with Swagger UI 647
    Consuming services using HTTP clients 652
    Understanding HttpClient 652
    Configuring HTTP clients using HttpClientFactory 653
    Getting customers as JSON in the controller 654
    Enabling Cross-Origin Resource Sharing 656
    Implementing advanced features 658
    Implementing a Health Check API 658
    Implementing Open API analyzers and conventions 659
    Implementing transient fault handling 660
    Understanding endpoint routing 660
    Configuring endpoint routing 661
    Adding security HTTP headers 663
    Securing web services 664
    Understanding other communication technologies 664
    Understanding Windows Communication Foundation (WCF) 665
    Understanding gRPC 665
    Practicing and exploring 666
    Exercise 18.1 – Test your knowledge 666
    Exercise 18.2 – Practice creating and deleting customers with HttpClient 666
    Exercise 18.3 – Explore topics 667
    Summary 667

    Chapter 19: Building Intelligent Apps Using Machine Learning 669

    Understanding machine learning 669
    Understanding the machine learning lifecycle 670
    Understanding datasets for training and testing 671
    Understanding machine learning tasks 672
    Understanding Microsoft Azure Machine Learning 672
    Understanding ML.NET 673
    Understanding Infer.NET 673
    Understanding ML.NET learning pipelines 674
    Understanding model training concepts 675
    Understanding missing values and key types 676
    Understanding features and labels 676
    Making product recommendations 676
    Problem analysis 677
    Data gathering and processing 678
    Creating the NorthwindML website project 679
    Creating the data and view models 680
    Implementing the controller 682
    Training the recommendation models 685
    Implementing a shopping cart with recommendations 687
    Testing the product recommendations website 692
    Practicing and exploring 695
    Exercise 19.1 – Test your knowledge 695
    Exercise 19.2 – Practice with samples 695
    Exercise 19.3 – Explore topics 696
    Summary 697

    Chapter 20: Building Web User Interfaces Using Blazor 699

    Understanding Blazor 699
    Understanding Blazor hosting models 700
    Understanding Blazor components 700
    What is the deal with Blazor and Razor? 701
    Comparing Blazor project templates 701
    Reviewing the Blazor Server project template 701
    Understanding CSS isolation 706
    Running the Blazor Server project template 707
    Reviewing the Blazor WebAssembly project template 708
    Building components using Blazor Server 711
    Defining and testing a simple component 711
    Getting entities into a component 712
    Abstracting a service for a Blazor component 715
    Using Blazor forms 717
    Defining forms using the EditForm component 718
    Navigating Blazor routes 718
    Building and using a customer form component 719
    Building components using Blazor WebAssembly 724
    Configuring the server for Blazor WebAssembly 725
    Configuring the client for Blazor WebAssembly 728
    Exploring Progressive Web App support 732
    Practicing and exploring 734
    Exercise 20.1 – Test your knowledge 734
    Exercise 20.2 – Practice creating a component 734
    Exercise 20.3 – Explore topics 735
    Summary 735

    Chapter 21: Building Cross-Platform Mobile Apps 737

    Understanding XAML 738
    Simplifying code using XAML 738
    Choosing common controls 739
    Understanding markup extensions 739
    Understanding Xamarin and Xamarin.Forms 740
    How Xamarin.Forms extends Xamarin 740
    Development tools for mobile first, cloud first 740
    Mobile platform market share 741
    Understanding additional functionality 741
    Understanding the INotificationPropertyChanged interface 742
    Understanding dependency services 742
    Understanding Xamarin.Forms user interface components 743
    Understanding the ContentPage view 743
    Understanding the Entry and Editor controls 744
    Understanding the ListView control 744
    Building mobile apps using Xamarin.Forms 745
    Adding Android SDKs 745
    Creating a Xamarin.Forms solution 745
    Creating an entity model with two-way data binding 747
    Creating a component for dialing phone numbers 751
    Creating views for the customers list and customer details 754
    Implementing the customer list view 755
    Implementing the customer detail view 758
    Setting the main page for the mobile app 760
    Testing the mobile app 761
    Consuming a web service from a mobile app 763
    Configuring the web service to allow insecure requests 763
    Configuring the iOS app to allow insecure connections 764
    Configuring the Android app to allow insecure connections 765
    Adding NuGet packages for consuming a web service 766
    Getting customers from the web service 766
    Practicing and exploring 768
    Exercise 21.1 – Test your knowledge 768
    Exercise 21.2 – Explore topics 769
    Summary 769
    Epilogue 770
    Index 771

  • 相关阅读:
    Maven学习总结(12)——eclipse中构建多模块maven项目
    Maven学习总结(11)——Maven Tomcat7自动部署
    Maven学习总结(11)——Maven Tomcat7自动部署
    Json学习总结(1)——Java和JavaScript中使用Json方法大全
    Json学习总结(1)——Java和JavaScript中使用Json方法大全
    Tomcat学习总结(2)——Tomcat使用详解
    Tomcat学习总结(2)——Tomcat使用详解
    Tomcat学习总结(1)——Tomcat入门教程
    Tomcat学习总结(1)——Tomcat入门教程
    【我的物联网成长记6】由浅入深了解NB-IoT
  • 原文地址:https://www.cnblogs.com/itfanr/p/14380599.html
Copyright © 2011-2022 走看看