File tree Expand file tree Collapse file tree 9 files changed +333
-77
lines changed
1_CS/LINQ/EnumerableSample
3_Web/ASPNETCore/WebSampleApp Expand file tree Collapse file tree 9 files changed +333
-77
lines changed Original file line number Diff line number Diff line change 22
33 <PropertyGroup >
44 <OutputType >Exe</OutputType >
5- <TargetFramework >net6 .0</TargetFramework >
5+ <TargetFramework >net7 .0</TargetFramework >
66 <Nullable >enable</Nullable >
77 <ImplicitUsings >enable</ImplicitUsings >
88 </PropertyGroup >
99
1010 <ItemGroup >
11- <PackageReference Include =" System.CommandLine" Version =" 2.0.0-beta3.22114 .1" />
11+ <PackageReference Include =" System.CommandLine" Version =" 2.0.0-beta4.22272 .1" />
1212 </ItemGroup >
1313
1414 <ItemGroup >
Original file line number Diff line number Diff line change 22
33class SortingSamples
44{
5+ // .NET 7 update
6+ public static void SortDefault ( )
7+ {
8+ Console . WriteLine ( "Sort all the racers by the default sort as implemented in the Racer type" ) ;
9+ Console . WriteLine ( ) ;
10+
11+ var racers = Formula1 . GetChampions ( ) . Order ( ) . Take ( 10 ) ;
12+
13+ foreach ( var racer in racers )
14+ {
15+ Console . WriteLine ( $ "{ racer . LastName } , { racer . FirstName } ") ;
16+ }
17+ }
18+
519 public static void SortMultiple ( )
620 {
721 Console . WriteLine ( "Show the first 10 champions ordered by country, lastname, firstname" ) ;
Original file line number Diff line number Diff line change 1+ # Diagrams
2+
3+ ## Models
4+
5+
6+ ### Owned Entities
7+
8+ ``` mermaid
9+ classDiagram
10+ Address *-- Location : Location
11+ Person *-- Address : BusinessAddress
12+ Person o-- Address : PrivateAddress
13+
14+ class Location {
15+ +Country: string
16+ +City: string
17+ }
18+ class Address {
19+ +LineOne: string
20+ +LineTwo: string
21+ }
22+ class Person {
23+ +PersonId: int
24+ +FirstName: string
25+ +LastName: string
26+ }
27+ ```
28+
29+ ``` mermaid
30+ erDiagram
31+ People {
32+ int PersonId
33+ string FirstName
34+ string LastName
35+ string BusinessAdressLineOne
36+ string BusinessAddressLineTwo
37+ string BusinessCity
38+ string BusinessCountry
39+ int PrivateAddressId
40+ }
41+ PrivateAddresses {
42+ string LineOne
43+ string LineTwo
44+ string City
45+ string Country
46+ }
47+ ```
48+
49+ ### Table Splitting
50+
51+ ``` mermaid
52+ classDiagram
53+
54+ MenuItem "1" o--> "1" MenuDetails : Details
55+
56+ class MenuDetails {
57+ +MenuItemId: int
58+ +KitchenInfo: string
59+ +MenusSold: int
60+ }
61+ class MenuItem {
62+ +MenuItemId: int
63+ +Title: string
64+ +Subtitle: string
65+ +Price: decimal
66+ }
67+ ```
68+
69+ ``` mermaid
70+ erDiagram
71+ MenuItem {
72+ int MenuItemId
73+ string Title
74+ string Subtitle
75+ money Price
76+ string KitchenInfo
77+ int MenusSold
78+ }
79+ ```
80+
81+
82+ ##
83+
84+ ``` mermaid
85+ classDiagram
86+
87+ MenuItem "1" o--> "1" MenuDetails : Details
88+
89+ class MenuDetails {
90+ +MenuDetailsId: int
91+ +KitchenInfo: string
92+ +MenusSold: string
93+ +Price: decimal
94+ }
95+ class MenuItem {
96+ +MenuItemId: int
97+ +Title: string
98+ +Subtitle: string
99+ +Price: decimal
100+ }
101+ class MenuCard {
102+ +MenuCardId: int
103+ +Title: string
104+ }
105+ class Restaurant {
106+ +Name: string
107+ }
108+ ```
109+
110+ ## Inheritance
111+
112+ ## Table per Hierarchy (TPH)
113+
114+ TPH is a pattern where you have a base class and multiple derived classes. Each derived class has its own table. The base class table contains a discriminator column that identifies the type of the derived class. The derived class tables contain all the columns of the base class table plus their own columns.
115+
116+ ``` mermaid
117+ classDiagram
118+
119+ Payment <|-- CashPayment
120+ Payment <|-- CreditcardPayment
121+ class Payment {
122+ +PaymentId: int
123+ +Name: string
124+ +Amount: decimal
125+ }
126+
127+ class CashPayment {
128+ }
129+
130+ class CreditcardPayment {
131+ +CreditcardNumber: string
132+ }
133+ ```
134+
135+ ``` mermaid
136+ erDiagram
137+ Payments {
138+ int PaymentId
139+ string PaymentType
140+ string Name
141+ money Amount
142+ string CreditcardNumber
143+ }
144+ ```
145+
146+ ## Table per Type (TpT)
147+
148+ Table per type
149+
150+ ``` mermaid
151+ erDiagram
152+ Payments {
153+ int PaymentId
154+ string PaymentType
155+ string Name
156+ money Amount
157+
158+ }
159+
160+ CashPayments {
161+ int PaymentId
162+ }
163+
164+ CreditcardPayments {
165+ int PaymentId
166+ string CreditcardNumber
167+ }
168+ ```
169+
170+ ## Table per concrete Type (TcT)
171+
172+ ``` mermaid
173+ classDiagram
174+
175+ Payment <|-- CashPayment
176+ Payment <|-- CreditcardPayment
177+
178+ class Payment {
179+ <<abstract>>
180+ +PaymentId: int
181+ +Name: string
182+ +Amount: decimal
183+ }
184+
185+ class CashPayment {
186+ }
187+
188+ class CreditcardPayment {
189+ +CreditcardNumber: string
190+ }
191+ ```
192+
193+
194+ ``` mermaid
195+ erDiagram
196+ CashPayments {
197+ int PaymentId
198+ string Name
199+ money Amount
200+ }
201+
202+ CreditcardPayments {
203+ int PaymentId
204+ string Name
205+ money Amount
206+ string CreditcardNumber
207+ }
208+ ```
209+
210+ ## Many-to-many Relationships
211+
212+ ``` mermaid
213+ classDiagram
214+ Book "*" <--> "*" Person
215+
216+ class Book {
217+ +BookId: int
218+ +Title: string
219+ +Publisher: string
220+ }
221+
222+ class Person {
223+ +PersonId: int
224+ +FirstName: string
225+ +LastName: string
226+ }
227+ ```
228+
229+ ``` mermaid
230+ erDiagram
231+ Books {
232+ int BookId
233+ string Title
234+ string Publisher
235+ }
236+
237+ People {
238+ int PersonId
239+ string FirstName
240+ string LastName
241+ }
242+
243+ BookPeople {
244+ int BookId
245+ int PersonId
246+ }
247+ ```
Original file line number Diff line number Diff line change 1- using System . Text ;
2-
3- namespace WebSampleApp . Extensions ;
1+ namespace WebSampleApp . Extensions ;
42
53public static class HtmlExtensions
64{
@@ -25,14 +23,12 @@ public static string Ul(this string value) =>
2523 public static string HeadingX ( this string value , int x ) =>
2624 $ "<h{ x } >{ value } </h{ x } >";
2725
28- public static string HtmlDocument ( this string content , string title )
29- {
30- StringBuilder sb = new ( ) ;
31- sb . Append ( "<!DOCTYPE HTML>" ) ;
32- sb . Append ( $ "<head><meta charset=\" utf-8\" ><title>{ title } </title></head>") ;
33- sb . Append ( "<body>" ) ;
34- sb . Append ( content ) ;
35- sb . Append ( "</body>" ) ;
36- return sb . ToString ( ) ;
37- }
26+ public static string HtmlDocument ( this string content , string title ) =>
27+ $ """
28+ <!DOCTYPE HTML>
29+ <head><meta charset="utf-8"><title>{ title } </title></head>
30+ <body>
31+ { content }
32+ </body>
33+ """ ;
3834}
Original file line number Diff line number Diff line change 11namespace WebSampleApp . Middleware ;
22
3- // You may need to install the Microsoft.AspNetCore.Http.Abstractions package into your project
43public class HeaderMiddleware
54{
65 private readonly RequestDelegate _next ;
You can’t perform that action at this time.
0 commit comments