Download Complete (Ebook) Beginning gRPC with ASP.NET Core 6: Build Applications using ASP.NET Core Razor Pages, Angular, and Best Practices in .NET 6 by Anthony Giretti ISBN 9781484280072, 1484280075 PDF for All Chapters
Download Complete (Ebook) Beginning gRPC with ASP.NET Core 6: Build Applications using ASP.NET Core Razor Pages, Angular, and Best Practices in .NET 6 by Anthony Giretti ISBN 9781484280072, 1484280075 PDF for All Chapters
com
OR CLICK HERE
DOWLOAD EBOOK
ebooknice.com
ebooknice.com
(Ebook) C# 10 and .NET 6 – Modern Cross-Platform
Development: Build apps, websites, and services with
ASP.NET Core 6, Blazor, and EF Core 6 using Visual Studio
2022 and Visual Studio Code, 6th Edition by Mark J. Price
https://ebooknice.com/product/c-10-and-net-6-modern-cross-platform-
ISBN B09JV37DM6
development-build-apps-websites-and-services-with-asp-net-
core-6-blazor-and-ef-core-6-using-visual-studio-2022-and-visual-
studio-code-6th-edition-51500340
ebooknice.com
https://ebooknice.com/product/asp-net-core-razor-pages-in-
action-47517782
ebooknice.com
ebooknice.com
ebooknice.com
Beginning gRPC
with ASP.NET Core 6
Build Applications using ASP.NET
Core Razor Pages, Angular,
and Best Practices in .NET 6
—
Anthony Giretti
Beginning gRPC with
ASP.NET Core 6
Build Applications using ASP.NET
Core Razor Pages, Angular, and Best
Practices in .NET 6
Anthony Giretti
Beginning gRPC with ASP.NET Core 6: Build Applications using ASP.NET Core Razor
Pages, Angular, and Best Practices in .NET 6
Anthony Giretti
La Salle, QC, Canada
iii
Table of Contents
iv
Table of Contents
v
Table of Contents
Chapter 9: Import and Display Data with ASP.NET Core Razor Pages, Hosted
Services, and gRPC����������������������������������������������������������������������������� 299
Scenario Explanation���������������������������������������������������������������������������������������������������������������� 300
Create and Layer the ASP.NET Core gRPC Application�������������������������������������������������������������� 301
Set Up a SQL Server Database and Use Entity Framework Core to Access Data���������������������� 310
Set Up a SQL Server Database�������������������������������������������������������������������������������������������� 310
Using Entity Framework Core to Access Data��������������������������������������������������������������������� 311
Write the Business Logic and Expose the Country gRPC Microservice������������������������������������ 330
Write the Business Logic into the CountryService.BLL Layer���������������������������������������������� 330
Write the Country gRPC Service������������������������������������������������������������������������������������������ 332
Create and Layer the ASP.NET Core Razor Application�������������������������������������������������������������� 341
Create the Application Skeleton������������������������������������������������������������������������������������������ 342
Define Contracts and Domain Objects��������������������������������������������������������������������������������� 343
Implement the Data Access Layer with the gRPC Client����������������������������������������������������� 348
vi
Table of Contents
Chapter 12: Import and Display Data with Angular 12 and gRPC-web���������������� 419
Introduction to SPAs������������������������������������������������������������������������������������������������������������������ 419
Generate TypeScript Stubs with Protoc������������������������������������������������������������������������������������� 421
Download the Correct Version of Protoc and Protobuf Well-Known Types�������������������������� 422
Download the ts-protoc-gen Plug-in����������������������������������������������������������������������������������� 426
Download Improbable’s gRPC-web Library and Google Protobufs Library�������������������������� 426
Executing the Protoc Command������������������������������������������������������������������������������������������ 426
vii
Table of Contents
Index��������������������������������������������������������������������������������������������������������������������� 481
viii
About the Author
Anthony Giretti is a senior lead software developer at OneOcean in Montreal, Canada.
He is a technical leader and four-time Microsoft MVP award recipient. Anthony
specializes in web technologies (17 years’ experience) and .NET. His expertise in
technology and IT, and a heartfelt desire to share his knowledge, motivates him to dive
into and embrace any web project, complex or otherwise, in order to help developers
achieve their project goals. He invites challenges such as performance constraints, high
availability, and optimization with open arms. He is a certified MCSD who is passionate
about his craft and always game for learning new technologies.
ix
About the Technical Reviewer
Fiodar Sazanavets is an experienced full-stack lead software
engineer who mainly works with the Microsoft software
development stack. The main areas of his expertise include
ASP.NET (Framework and Core), SQL Server, Azure, Docker,
Internet of Things (IoT), microservices architecture, and
various front-end technologies.
Fiodar has built his software engineering experience
while working in a variety of industries, including water
engineering, financial, retail, railway, and defense. He has
played a leading role in various projects and, as well as
building software, his duties have included performing architectural and design tasks.
He has also performed a variety of technical duties on clients’ sites, such as in-house
software development and deployment of both software and IoT hardware.
Fiodar is passionate about teaching other people programming skills. He has
published a number of programming courses on various online platforms.
Fiodar regularly writes about software development on his personal website,
https://scientificprogrammer.net. He has also published a number of articles on
other websites.
xi
Acknowledgments
The completion of this book could not have been possible without the participation and
assistance of many people and I would like to express my special thanks to them.
First, thanks to Camille Viot, my boss, for accommodating me so that I could
overcome this immense challenge.
Next, I would like to thank my friend Dave Brock (Madison, Wisconsin) for both
his moral but technical support; he was a great help when I felt overwhelmed by the
magnitude of the task. I also thank him for reviewing my chapters one by one—many
thanks for his contribution! Thanks also to Damien Vande Kerckhove for his technical
support, which allowed me to adjust the shot when I was not going in the right direction.
He was also an essential asset for ensuring this book was able to see the light of day.
I also thank all my family for their unwavering support. Finally, I would like to thank
a special member of my family that I unfortunately lost recently; he was there every night
next to me when I was writing my lines. Thank you, Ulysse, you helped me so much and
kept me company.
xiii
Introduction
Take a new technological turn with gRPC and ASP.NET Core while discovering .NET 6,
the latest release of the Microsoft .NET platform, and C# 10.
gRPC has become more and more famous because of its performance compared to
JSON/XML APIs. In this book, you’ll discover how to develop ASP.NET Core APIs with
the gRPC specification, and gRPC will no longer be mysterious to you.
After you discover how gRPC works, you’ll learn how to use it to build high-
performance web applications with the best development standards. You’ll use gRPC
with various ASP.NET Core 6 project types such as Razor Pages and minimal APIs. You’ll
also discover gRPC-web and the great mix it does with Angular 12.
For Windows Communication Foundation (WCF) developers, you will learn how to
migrate from WCF to gRPC by comparing the similarities and differences between the
two frameworks.
We’ll also explore using gRPC and gRPC-web with OpenId Connect authentication
and authorization to secure your applications.
Let’s go!
xv
PART I
3
© Anthony Giretti 2022
A. Giretti, Beginning gRPC with ASP.NET Core 6, https://doi.org/10.1007/978-1-4842-8008-9_1
Chapter 1 Welcome to Modern .NET
. NET Framework
Since Microsoft’s release of .NET 1, there have been nine releases of the .NET
Framework, with seven of them released with a new version of Visual Studio. Two
of these releases, .NET Framework 2.0 and .NET Framework 4.0, have upgraded the
Common Language Runtime (CLR), which runs .NET applications. When the CLR
version is the same, new versions of the .NET Framework replace older versions. .NET
Framework 4.8 is the latest version of the .NET Framework. Table 1-1 shows .NET
Framework releases from .NET 1 to .NET 4.8.
4
Chapter 1 Welcome to Modern .NET
. NET Core
In June 2016, Microsoft announced the .NET Core project, an open source, cross-
platform successor with compatibility for Windows, macOS, and Linux. Since then,
Microsoft has released two significant versions, .NET Core 2.0 and .NET Core 3.0, both
of which have minor releases associated with them. .NET Core 3.1 is the latest version of
.NET Core and will be supported until December 2022. Table 1-2 shows the .NET Core
releases since 2016.
In addition to .NET Core and .NET Framework, Microsoft also maintains the Mono
project, an open source implementation of Microsoft’s .NET Framework. Launched in
2004 to allow developers to create cross-platform applications easily, it’s based on the
European Computer Manufacturers Association (ECMA) standards for C# and the CLR.
5
Chapter 1 Welcome to Modern .NET
When it comes to API surface area, .NET Core 3 is not as robust as .NET Framework
4.8, a mature platform with a 15-year head start. However, Microsoft has added about
50,000 .NET APIs to the .NET Core platform to date. To continue closing this gap, Microsoft
has built on the efforts made with .NET Core and taken the best of Mono to create a unique
platform that you can use for all your .NET programs: .NET 5 and so on with .NET 6.
Microsoft has named this new version simply .NET 5 (and then .NET 6) so as not to
confuse developers, because it’s not the successor to .NET Framework 4.8.
. NET Standard
In 2011, Microsoft released the Portable Class Libraries (PCL), which are binaries that are
compatible with many frameworks. PCLs were a significant improvement because they
were supported by several runtimes such as Mono, Universal Windows Platform (UWP),
and .NET. In the meantime, it was hard to find information on what APIs were available
or not. To help with this confusion, .NET Standard was born.
.NET Standard is a bunch of APIs implemented by the Base Class Library (BCL).
It’s a specification of .NET APIs that proposes a unified set of contracts that you can
compile in your compatible projects. These contracts are implemented in several
.NET implementations. Various .NET implementations target specific versions of .NET
Standard. Table 1-3 shows the minimum implementation versions that support each
.NET Standard version.
.NET Core 1.0 1.0 1.0 1.0 1.0 1.0 1.0 3.0 3.1
.NET Framework 4.5 4.5 4.5.1 4.6 4.6.1 4.6.1 4.6.1 4.6.1 N/A
Mono 4.6 4.6 4.6 4.6 4.6 4.6 4.6 5.4 6.4
Xamarin.iOS 10.0 10.0 10.0 10.0 10.0 10.0 10.0 10.14 12.16
Xamarin.Mac 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.8 5.16
Xamarin.Android 7.0 7.0 7.0 7.0 7.0 7.0 7.0 8.0 10.0
UWP 10.0 10.0 10.0 10.0 10.0 10.0.x 10.0.x 10.0.x N/A
Unity 2018.1 2018.1 2018.1 2018.1 2018.1 2018.1 2018.1 2018.1 N/A
6
Chapter 1 Welcome to Modern .NET
.NET 6 implements .NET Standard 2.1 (and earlier), which is not deprecated, but
.NET 6 (unified across platforms) is the new Microsoft implementation of .NET to share
code between .NET projects.
Note .NET 5 was released after this diagram was released. Since then, Microsoft
pushed the launch of Xamarin in the .NET unified platform to .NET 6.
7
Chapter 1 Welcome to Modern .NET
M
ono and CoreCLR
We’ll discuss two different development experiences with .NET: .NET with Mono and
.NET with CoreCLR.
D
ifferences and Commonalities
Mono is the cross-platform implementation of .NET. It started as an open source
alternative to the .NET Framework and made the transition to targeting mobile devices
like iOS and Android much easier. Mono is the runtime used to run Xamarin. Mono
allows developers to run .NET applications cross-platform (even older game consoles
such as PlayStation 3 and Xbox 360) and provides powerful development tools for Linux.
Core Common Language Runtime (CoreCLR) is the runtime used as part of .NET Core.
.NET Core and Mono have a lot of similarities but also many differences. As a
developer, you have the capability to select the desired development experience you
want while making the switch from one to the other as straightforward as possible.
JIT
Since the beginning of .NET, .NET was based on a just-in-time (JIT) compiler to translate
Intermediate Language (IL) code into optimized code. Microsoft built an efficient,
high-performance runtime that made programming easy and efficient.
The default experience for most .NET 6 applications will use the JIT-based CoreCLR
runtime, but there are exceptions: Xamarin and Blazor WebAssembly. Microsoft delivers
AOT compilation for both projects in .NET 6.
Note AOT support has been planned for .NET 5 but finally postponed to .NET 6.
AOT
The Mono compiler is an AOT compiler that allows you to compile native code that can
be executed everywhere. The Blazor project uses Mono AOT compilation since .NET 6.
However, AOT compilation is required for Xamarin (Android/iOS) and gaming consoles
(Unity). AOT compilation is mostly intended for applications that need a quick start and
a small footprint.
8
Chapter 1 Welcome to Modern .NET
To stay informed about upcoming releases, support information, and .NET release
schedules, visit the Microsoft page “.NET and .NET Core Support Policy”: https://
dotnet.microsoft.com/platform/support/policy/dotnet-core.
9
Chapter 1 Welcome to Modern .NET
since .NET Core 3.1 and explain why they are so good, then show you how to install .NET
6 so you can take full advantage. Because .NET 5 is a lightweight version of .NET 6, I will
recap what .NET 5 introduced so that you understand why .NET 6 and its improvements
make it a modern .NET platform.
In terms of performance, .NET 5 has several huge improvements, which makes .NET
6 (and 5) significantly faster:
10
Chapter 1 Welcome to Modern .NET
The list of other improvements is too extensive to include here. However, you can
check out the interesting links on Microsoft’s blog detailing their announcements as the
previews were released: https://devblogs.microsoft.com/dotnet/.
Regarding .NET 6 specifically, here is what it offers:
• Hot reload, which allows you to modify your code without restarting
your app, making the development experience faster
11
Chapter 1 Welcome to Modern .NET
Visual Studio 2022 introduced a great context menu to choose the language,
the project type, and the platform you want to use for your new project, as shown in
Figure 1-4.
12
Chapter 1 Welcome to Modern .NET
If you prefer, you can also use the .NET CLI to get the same information by opening a
terminal window and entering the following:
13
Chapter 1 Welcome to Modern .NET
Figure 1-5. All available project types and languages from the command line
Personally, I like both ways to create a project. Both are simple. Let’s now create a
new project named MyMVCApp, where -o allows to specify the project name (and its
folder name), which uses an ASP.NET MVC template with the command as seen here:
14
Chapter 1 Welcome to Modern .NET
Figure 1-6. The output generated after creating a new project with the .NET CLI
To confirm your project is set up to use .NET 6, you can build it by running the
following command:
dotnet build
Or, if you want to build and run your project, you can use the following command:
dotnet run
You can integrate the new Windows Terminal with Visual Studio. To enable it in
Visual Studio 2022, click the View menu and choose Terminal, as shown in Figure 1-7.
15
Chapter 1 Welcome to Modern .NET
Figure 1-7. Enabling the new Windows Terminal in Visual Studio 2022
Once completed, the terminal window appears in the bottom panel. Then, you’ll be
able to run any command you want—such as PowerShell, Git, and CLI commands, as
shown in Figure 1-8.
16
Chapter 1 Welcome to Modern .NET
Recap of C# 9
Here are the most important improvements introduced in C# 9:
• Init-only properties
• Records
• Covariant returns
I nit-Only Properties
C# 9 introduced an init accessor, a variant of the set accessor. This accessor allows
properties to be assigned once during object initialization. If you apply this accessor to
all the properties of your object, it makes the object immutable. If you try to reassign a
property initialized with this accessor, the compiler will warn you of an error. Listing 1-1
shows an example of a Product class with its immutable CategoryId property; this code
could be created in any C# project.
Listing 1-1. Product Class with CategoryId Property and Its init Accessor
using System;
namespace CSharp9Demo.Models
{
public class Product
{
public string Name { get; set; }
public int CategoryId { get; init; }
}
}
R
ecords
C# 9 added a new record keyword. A record makes it possible to create an immutable
reference type object (either with the init accessor or a primary constructor) and give it
a value type object for comparison. Listing 1-2 shows an immutable record with init-
only properties, and Listing 1-3 shows an immutable record with a primary constructor.
18
Chapter 1 Welcome to Modern .NET
using System;
namespace CSharp9Demo.Models
{
public record Product
{
string Name { get; init; }
int CategoryId { get; init; }
}
}
using System;
namespace CSharp9Demo.Models
{
public record Product(string Name, int CategoryId);
}
Suppose you want to create a new object from another object because the new object
requires all but one of the same property values. Unfortunately, your existing object is
immutable. The with keyword fixes that. It allows you to create an object from another
object and specify which properties to change; Listing 1-4 shows an example of the usage
of the with keyword.
19
Chapter 1 Welcome to Modern .NET
Interestingly, the record keyword makes the virtual Equals method overridden
and allows value-based comparison between records. On that point, it behaves as a
struct, but it’s not. Records may be appreciated for that possibility. Listing 1-5 shows an
example of a comparison between two records.
I love that feature, and I try to use the record keyword as much as I can. I often use
it on Data Transfert Object (DTO) to carry data between layers because they must not
mutate, and I can enforce immutability easily
20
Chapter 1 Welcome to Modern .NET
using System;
namespace CSharp9Demo
{
class Program
{
static void Main(string[] args)
{
var product = new Product { Name = "Food", CategoryId = 4 };
GetTax(product); // Returns 5
}
The not pattern is also making an appearance—you’ll see the not logical
operator can also be used in an if statement (it also works with a ternary statement).
Listing 1-7 shows a discount selector based on an object type, ElectronicProduct,
which is a Product child object.
21
Chapter 1 Welcome to Modern .NET
using System;
namespace CSharp9Demo
{
class Program
{
static void Main(string[] args)
{
var product = new Product { Name = "Food", CategoryId = 4 };
GetDiscount(product); // Returns 25
GetDiscountTernary(product); // Returns 25
}
return 0;
}
22
Chapter 1 Welcome to Modern .NET
Listing 1-8. Omitted Type and Conditional Operator Usage on Book and
Headset Objects
namespace CSharp9Demo
{
class Program
{
static void Main(string[] args)
{
Book aBook = new ("gRPC", 1);
Headset headset = new ("Logitech", 2);
Product anotherProduct = aBook ?? headset;
}
}
23
Chapter 1 Welcome to Modern .NET
_categoryId = categoryId;
}
}
C
ovariant Returns
One of the most underrated features of C# 9 is covariant returns. Usually, in C#, when
you inherit from a class, you can override a method if it is declared abstract or virtual,
but you can’t change the return type of this method. C# 9 allows you to do this. In
addition to overriding a virtual or abstract method, you can now return a covariant type
of the initial type declared in the parent class.
Listing 1-9 shows a covariant return usage on the Book class, inheriting from the
Product abstract class. The abstract Order method that returns a ProductOrder object
can be overridden within the Book class by returning a BookOrder object that inherits
from the ProductOrder class.
Listing 1-9. Covariant Return Usage on Order Method of the Book Class
24
Chapter 1 Welcome to Modern .NET
public Book(string name, int categoryId, string Isbn) : base(name,
categoryId)
{
ISBN = Isbn;
}
public override BookOrder Order(int quantity) => new BookOrder {
Quantity = quantity, Product = this };
}
25
Chapter 1 Welcome to Modern .NET
“If you ever work on a performance critical application, then you know that
anonymous methods are not cheap:
Listing 1-10 shows the contextual private property _text captured by the anonymous
function, which can cause unintended allocation consequences.
namespace CSharp9Demo
{
class Program
{
private string _text = "{0} is a beautiful product !";
static void Main()
{
PromoteProduct(product => string.Format(this._text, "Surface
book 3"));
}
26
Chapter 1 Welcome to Modern .NET
C# 9 fixed that. Listing 1-11 shows the fix achieved by applying the const keyword on
the _text variable and by adding the static keyword to the lambda expression.
namespace CSharp9Demo
{
class Program
{
private const string _text = "{0} is a beautiful product !";
static void Main()
{
PromoteProduct(static product => string.Format(this._text,
"Surface book 3"));
}
T op-Level Programs
C# 9 introduced a fun and practical feature: top-level programs. A top-level program
is the simplest way to write a program on its top level. Concretely in your .NET 5+
applications, you’ll be able to write a lighter Program.cs file. This feature allows you to
remove all enclosing declarations (namespace declaration, Program class declaration,
Main method declaration).
Everything works the same (accessing arguments, making async calls, declaring local
functions, etc.). Listing 1-12 shows a lighter Program.cs file in ASP.NET Core 5 where the
application namespace is named CountryService.Web.
27
Chapter 1 Welcome to Modern .NET
using CountryService.Web;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
CreateHostBuilder(args).Build().Run();
Before ASP.NET Core 5, you would have written your Program.cs file as shown in
Listing 1-13.
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
namespace CountryService.Web
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
In C# 10, this feature has been improved so that the Startup.cs file is no longer
helpful for the Program.cs file is sufficient on its own, and I’ll show you that in the next
section.
Introduction to C# 10
C# 10 is the major new version of C # shipped with .NET 6, and following on from C# 9, it
brings remarkable changes, not to say a real breakthrough in coding .NET applications.
C# 10 includes the following most important features:
• Global usings
• File-scoped namespaces
• Record struct
G
lobal Usings
C# 10 brings an attractive feature that will simplify and lighten your C# files: global
usings. What is a global using? It’s simply a manner to declare once a using statement
in a single C# project. In this way, you can create a single file and declare globally all the
needed using statements for your project. This simplifies your code greatly, and you no
longer need to repeat the using statement across files. To declare a using statement as
global, you have to write it like this:
For example, it could give the following as shown on Listing 1-14 if you decide
to declare all usings in a single file. I prefer to name it GlobalUsings.cs, which is
meaningful, and you’ll find this convention in several chapters in this book.
29
Chapter 1 Welcome to Modern .NET
F ile-Scoped Namespaces
Still, to continue with the simplification of the code, I suggest you discover another
feature of C# 10 that you will often review in this book: file-scoped namespaces.
Namespaces declared in a file (without braces, but whose instruction ends with a
semicolon) will apply to all elements declared in the same file. It’s practical, and it
lightens the code. However, there is a limitation: only one namespace can be declared in
the file. I love this new feature of C# 10, and I’m sure you’ll love it too. Listing 1-15 shows
a sample of a file-scoped namespace. The CountryModel class is defined in another file.
namespace CountryService.gRPC.Mappers;
30
Chapter 1 Welcome to Modern .NET
Anthem = country.Anthem,
CapitalCity = country.CapitalCity,
FlagUri = country.FlagUri
};
countryReply.Languages.AddRange(country.Languages);
return countryReply;
}
}
Combined with the global usings feature, file-scoped namespaces results in much
more readable C# files.
Record struct
In .NET 5 and C# 9, the record keyword is applied only to classes. Starting with .NET 6
and C# 10, the record keyword can be applied to a struct. To avoid confusing the two,
declare a record applied to a class as public record class MyClass and declare a
record applied to a struct as public record struct MyStruct. If you omit the class or
the struct keyword, it will behave as a record class by default. Record struct works like a
record class (with-expressions, equality comparison), except it’s a struct and not a class,
and positional records work differently: positional records on a struct don’t make the
record immutable as a record class. Because it’s a struct, you have to set the readonly
keyword to make the record struct immutable. The major fact with record struct is that
reading/writing performance is higher than a regular struct. Interesting too!
Summary
In this chapter, you were given a primer on modern .NET. You learned about its origins
and why Microsoft made some of the developer choices that it did. You were also given
a quick primer on C# 10 and even a recap of C# 9, whose features often appear in this
book. The next chapter briefly introduces ASP.NET Core 6, which runs on .NET 6.
31
CHAPTER 2
Introducing
ASP.NET Core 6
Microsoft released its first ASP.NET framework in 2002 with ASP.NET Webform. The
years that followed were rich in developments such as ASP.NET MVC, ASP.NET WebAPI,
and SignalR. The framework evolved a little too quickly with new functionalities without
changing its core, more precisely the assembly named System.Web. Very quickly, new
challenges appeared, such as performance, the possibility of running ASP.NET on servers
other than IIS, increasing the framework’s affinity with the cloud to significantly facilitate its
deployment, and greatly improving its configuration by making it more flexible. ASP.NET
Core is born! ASP.NET Core is even designed to support containerization such as Docker.
ASP.NET Core is a complete overhaul of the trendy ASP.NET framework and allows
you to develop four types of applications:
• Web apps
• Web APIs
At the time of writing, ASP.NET Core 6 (delivered with .NET 6) is the latest version.
This chapter introduces you to ASP.NET Core 6, as we’ll use it throughout this book.
Note that ASP.NET Core 6 no longer supports ASP.NET WebForms and Windows
Communication Foundation (WCF).
In this chapter, I’ll teach you ASP.NET Core fundamentals and the following
application types:
33
© Anthony Giretti 2022
A. Giretti, Beginning gRPC with ASP.NET Core 6, https://doi.org/10.1007/978-1-4842-8008-9_2
Chapter 2 Introducing ASP.NET Core 6
app.Run();
Note This is the default Program.cs file generated from the ASP.NET Core 6
template. It implements the C# 9 top-level programs feature (introduced in Chapter 1).
The same remark applies to using statements, and the default ASP.NET Core 6
template uses the C# 10 global usings feature (also introduced in Chapter 1).
34
Another Random Document on
Scribd Without Any Related Topics
omnium oppidulorum consilio, quum in unam omnes urbem coirent,
dedicatum est eo in loco, qui nunc Acropolis (arx), tum vero Polis
(urbs) nominabatur. Delapsum quidem de cœlo fama vulgavit: sed
mihi id neque affirmare, neque refellere in præsentia in animo est.
Lucernam ex auro deæ Callimachus fecit: (7) in quam oleum
infusum (id quod semel quotannis faciunt) non consumitur, nisi
exacto demum anno, quum tamen lucerna dies noctesque ardeat. Id
ideo evenit, quod lucernæ inest e lino Carpasio funiculus, quod linum
unum ex omnibus igni non conficitur. Eminet supra lucernam palma
ænea: quæ quum ad lacunar consurgat, exceptum vaporem facile
dissipat. Callimachus vero ipse, qui lucernam fecit, etsi multo est
infra summos artifices, sollertia tamen ceteris longe præstitit: primus
enim lapides terebravit: nomen vero Cacizotechnos (quasi dicas, sui
in arte calumniator) aut sibi ipse imposuit, aut ab aliis impositum
usurpavit.
CAPUT XXVII.
CAPUT XXVIII.
CAPUT XXIX.
CAPUT XXX.
De dæmonis ᾿Aντέρως dicti ara in urbe — cursu cum facibus ad aram Promethei
— aliis aris in Academia — Platonis monumento — Cycno — turri Timonis —
aliis memorandis in hac urbis regione.
In primo Academiæ aditu Amoris est ara cum inscriptione: Charmum
Atheniensium primum Amori dedicasse. Eam vero aram, quæ intra
urbem est, quam appellant Anterotis, inquilinorum donum fuisse
dicunt, ac dedicationis hujusmodi causam exstitisse: Meles
Atheniensis amatorem suum Timagoram inquilinum hominem
fastidiens, ut de summo saxo se præcipitem abjiceret, jussit.
Timagoras, qui semper omnia, quæ puer imperaret, facienda
putasset, animam etiam ipsam facile profudit: unde enim jussus
erat, se præcipitem dedit. Meletem vero re cognita adeo pœnituit, ut
ex eodem se ipsum etiam de saxo dejiceret atque ita periret. Ex eo
ab inquilinis, ut Anteros genius, Timagoræ Amoris vindex, coleretur,
institutum. (2) In Academia Promethei ara est; a qua homines in
urbem accensas lampades præferentes currunt. In eo autem
certamen est, ut in cursu accensæ conserventur. Cujus enim fax
exstincta fuerit, is victoria successori cedit: eademque ratione ille
tertio. Quod si nulli ardentem perferre licitum fuerit, palma in medio
relinquitur. Est etiam Musarum ara, Mercurii alia; interius Minervæ;
etiam Herculis aram fecerunt. Olea inter hæc spectatur, quæ
secunda fertur prodiisse. (3) Non longe ab Academia Platonis est
monumentum, cui futuram in philosophiæ studio præstantiam
divinitus significatam tradunt, hoc modo: Socratem enim ea nocte,
quam dies ille est consecutus, quo se Plato in ejus disciplinam
tradidit, vidisse per quietem, cygnum sibi in sinum advolasse.
Cygnum autem canoram maxime avem esse, vulgo creditur. Cygnum
enim Ligurum, qui in Gallia Transpadana sunt, regem musicæ laude
clarum fuisse memorant, eumque, quum decessisset, ab Apolline in
sui nominis avem mutatum. Ego vero, apud Ligures regnasse in
musicis sollertem hominem, ut credam, facile adduci possum: sed
hominem in avem mutatum, minime fide dignum videri potest. (4) In
hac agri parte Timonis eminet turris, illius nempe, qui solus dixit,
felicitatis compotem esse non posse qui hominum aliorum
consuetudinem non defugiat. Ostenditur etiam locus, quem Colonum
Equestrem appellant: in quam Atticæ partem Œdipum primum
venisse ferunt, qui de eo diversa ab Homeri carminibus memoriæ
prodiderunt: sed produnt ita. Ibi et Equestris Neptuni et Equestris
Minervæ aras, ac Pirithoi, Thesei Œdipi, Adrasti, videas sacella.
Lucum autem Neptuni ac templum Antigonus, quum incursionem
faceret, incendit, alias quoque Atticam exercitu depopulatus.
CAPUT XXXI.
CAPUT XXXV.
CAPUT XXXVI.
CAPUT XXXVII.
CAPUT XXXVIII.
CAPUT XXXIX.
CAPUT XL.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebooknice.com