Skip to content

Commit c7049b3

Browse files
authored
Merge pull request #33959 from dotnet/main
2 parents 34b4c10 + 3130b69 commit c7049b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+75504
-4
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Blank issue
3+
about: Create an issue to help us improve
4+
---
5+
6+
# Before you open an issue
7+
8+
If the issue is with an ASP.NET Core document:
9+
10+
* Do **not** open a new issue using this form.
11+
* Open the issue using the **Open a documentation issue** link and feedback form at the bottom of the article.
12+
13+
Using the **Open a documentation issue** link and form to open an issue adds article metadata for tracking, which indicates the article that you're commenting on and pings the author for a faster response.
14+
15+
If the issue is:
16+
17+
* A simple typo or similar correction, you can submit a PR. See the Contributor Guide for instructions: https://docs.microsoft.com/contribute/#quick-edits-to-existing-documents
18+
* A general support question, consider asking on a support forum:
19+
* Stack Overflow: https://stackoverflow.com/questions/tagged/asp.net-core
20+
* ASP.NET Core Slack: https://aspnetcore.slack.com/join/shared_invite/zt-1mv5487zb-EOZxJ1iqb0A0ajowEbxByQ#/shared-invite/email
21+
* ASP.NET Gitter: https://gitter.im/aspnet/Home
22+
* A site design concern, create an issue at MicrosoftDocs/Feedback: https://github.com/MicrosoftDocs/Feedback/issues/new/choose
23+
* A problem completing a tutorial, compare your code with the completed sample.
24+
* A duplicate of an open or closed issue, leave a comment on that issue.

.github/ISSUE_TEMPLATE/doc-issue.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ Using the **Open a documentation issue** link and form to open an issue adds art
1414

1515
If the issue is:
1616

17-
* A simple typo or similar correction, you can submit a PR. See [the contributor guide](https://docs.microsoft.com/contribute/#quick-edits-to-existing-documents) for instructions.
18-
* A general support question, consider asking on a support forum site.
19-
* A site design concern, create an issue at [MicrosoftDocs/Feedback](https://github.com/MicrosoftDocs/Feedback/issues/new/choose).
17+
* A simple typo or similar correction, you can submit a PR. See the Contributor Guide for instructions: https://docs.microsoft.com/contribute/#quick-edits-to-existing-documents
18+
* A general support question, consider asking on a support forum:
19+
* Stack Overflow: https://stackoverflow.com/questions/tagged/asp.net-core
20+
* ASP.NET Core Slack: https://aspnetcore.slack.com/join/shared_invite/zt-1mv5487zb-EOZxJ1iqb0A0ajowEbxByQ#/shared-invite/email
21+
* ASP.NET Gitter: https://gitter.im/aspnet/Home
22+
* A site design concern, create an issue at MicrosoftDocs/Feedback: https://github.com/MicrosoftDocs/Feedback/issues/new/choose
2023
* A problem completing a tutorial, compare your code with the completed sample.
2124
* A duplicate of an open or closed issue, leave a comment on that issue.
2225

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,23 @@ This repository contains the [ASP.NET Core documentation](https://learn.microsof
55
To provide comments and suggestions on [learn.microsoft.com](https://learn.microsoft.com) site functionality, open an issue in the [`MicrosoftDocs/feedback` GitHub repository](https://github.com/MicrosoftDocs/feedback).
66

77
ASP.NET 4.x documentation changes are made in the [`dotnet/AspNetDocs` GitHub repository](https://github.com/dotnet/AspNetDocs).
8+
9+
## How to open an issue
10+
11+
If the issue is with an ASP.NET Core document:
12+
13+
* Do **not** open a blank issue.
14+
* Open the issue using the **Open a documentation issue** link and feedback form at the bottom of the article.
15+
16+
Using the **Open a documentation issue** link and form to open an issue adds article metadata for tracking, which indicates the article that you're commenting on and automatically pings the author for a faster response.
17+
18+
If the issue is:
19+
20+
* A simple typo or similar correction, you can submit a PR. See [the contributor guide](https://docs.microsoft.com/contribute/#quick-edits-to-existing-documents) for instructions.
21+
* A general support question, consider asking on a support forum site:
22+
* [Stack Overflow](https://stackoverflow.com/questions/tagged/asp.net-core)
23+
* [ASP.NET Core Slack](https://aspnetcore.slack.com/join/shared_invite/zt-1mv5487zb-EOZxJ1iqb0A0ajowEbxByQ#/shared-invite/email)
24+
* [ASP.NET Gitter](https://gitter.im/aspnet/Home)
25+
* A site design concern, create an issue at [MicrosoftDocs/Feedback](https://github.com/MicrosoftDocs/Feedback/issues/new/choose).
26+
* A problem completing a tutorial, compare your code with the completed sample.
27+
* A duplicate of an open or closed issue, leave a comment on that issue.
4 KB
Binary file not shown.
32 KB
Binary file not shown.
56.4 KB
Binary file not shown.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
</PropertyGroup>
7+
8+
<!-- -->
9+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
10+
<DefineConstants>$(DefineConstants)TRACE;SQLiteVersion</DefineConstants>
11+
</PropertyGroup>
12+
13+
<ItemGroup>
14+
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.0" />
15+
<PackageReference Include="Microsoft.EntityFrameworkCore.SQLite" Version="6.0.0" />
16+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0" />
17+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.0">
18+
<PrivateAssets>all</PrivateAssets>
19+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
20+
</PackageReference>
21+
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.0" />
22+
</ItemGroup>
23+
24+
</Project>
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#define FIRST
2+
#if FIRST // First DbInitializer used
3+
// <snippet>
4+
using ContosoUniversity.Models;
5+
6+
namespace ContosoUniversity.Data
7+
{
8+
public static class DbInitializer
9+
{
10+
public static void Initialize(SchoolContext context)
11+
{
12+
// Look for any students.
13+
if (context.Students.Any())
14+
{
15+
return; // DB has been seeded
16+
}
17+
18+
var students = new Student[]
19+
{
20+
new Student{FirstMidName="Carson",LastName="Alexander",EnrollmentDate=DateTime.Parse("2019-09-01")},
21+
new Student{FirstMidName="Meredith",LastName="Alonso",EnrollmentDate=DateTime.Parse("2017-09-01")},
22+
new Student{FirstMidName="Arturo",LastName="Anand",EnrollmentDate=DateTime.Parse("2018-09-01")},
23+
new Student{FirstMidName="Gytis",LastName="Barzdukas",EnrollmentDate=DateTime.Parse("2017-09-01")},
24+
new Student{FirstMidName="Yan",LastName="Li",EnrollmentDate=DateTime.Parse("2017-09-01")},
25+
new Student{FirstMidName="Peggy",LastName="Justice",EnrollmentDate=DateTime.Parse("2016-09-01")},
26+
new Student{FirstMidName="Laura",LastName="Norman",EnrollmentDate=DateTime.Parse("2018-09-01")},
27+
new Student{FirstMidName="Nino",LastName="Olivetto",EnrollmentDate=DateTime.Parse("2019-09-01")}
28+
};
29+
30+
context.Students.AddRange(students);
31+
context.SaveChanges();
32+
33+
var courses = new Course[]
34+
{
35+
new Course{CourseID=1050,Title="Chemistry",Credits=3},
36+
new Course{CourseID=4022,Title="Microeconomics",Credits=3},
37+
new Course{CourseID=4041,Title="Macroeconomics",Credits=3},
38+
new Course{CourseID=1045,Title="Calculus",Credits=4},
39+
new Course{CourseID=3141,Title="Trigonometry",Credits=4},
40+
new Course{CourseID=2021,Title="Composition",Credits=3},
41+
new Course{CourseID=2042,Title="Literature",Credits=4}
42+
};
43+
44+
context.Courses.AddRange(courses);
45+
context.SaveChanges();
46+
47+
var enrollments = new Enrollment[]
48+
{
49+
new Enrollment{StudentID=1,CourseID=1050,Grade=Grade.A},
50+
new Enrollment{StudentID=1,CourseID=4022,Grade=Grade.C},
51+
new Enrollment{StudentID=1,CourseID=4041,Grade=Grade.B},
52+
new Enrollment{StudentID=2,CourseID=1045,Grade=Grade.B},
53+
new Enrollment{StudentID=2,CourseID=3141,Grade=Grade.F},
54+
new Enrollment{StudentID=2,CourseID=2021,Grade=Grade.F},
55+
new Enrollment{StudentID=3,CourseID=1050},
56+
new Enrollment{StudentID=4,CourseID=1050},
57+
new Enrollment{StudentID=4,CourseID=4022,Grade=Grade.F},
58+
new Enrollment{StudentID=5,CourseID=4041,Grade=Grade.C},
59+
new Enrollment{StudentID=6,CourseID=1045},
60+
new Enrollment{StudentID=7,CourseID=3141,Grade=Grade.A},
61+
};
62+
63+
context.Enrollments.AddRange(enrollments);
64+
context.SaveChanges();
65+
}
66+
}
67+
}
68+
// </snippet>
69+
#endif
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#define First // LAST First
2+
#if First
3+
// <snippet_first>
4+
using ContosoUniversity.Models;
5+
using Microsoft.EntityFrameworkCore;
6+
7+
namespace ContosoUniversity.Data
8+
{
9+
public class SchoolContext : DbContext
10+
{
11+
public SchoolContext (DbContextOptions<SchoolContext> options)
12+
: base(options)
13+
{
14+
}
15+
16+
public DbSet<Student> Students { get; set; }
17+
public DbSet<Enrollment> Enrollments { get; set; }
18+
public DbSet<Course> Courses { get; set; }
19+
20+
protected override void OnModelCreating(ModelBuilder modelBuilder)
21+
{
22+
modelBuilder.Entity<Course>().ToTable("Course");
23+
modelBuilder.Entity<Enrollment>().ToTable("Enrollment");
24+
modelBuilder.Entity<Student>().ToTable("Student");
25+
}
26+
}
27+
}
28+
// </snippet_first>
29+
#elif LAST
30+
#endif
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#define FIRST
2+
#if FIRST
3+
// <snippet_first>
4+
using System.ComponentModel.DataAnnotations.Schema;
5+
6+
namespace ContosoUniversity.Models
7+
{
8+
public class Course
9+
{
10+
[DatabaseGenerated(DatabaseGeneratedOption.None)]
11+
public int CourseID { get; set; }
12+
public string Title { get; set; }
13+
public int Credits { get; set; }
14+
15+
public ICollection<Enrollment> Enrollments { get; set; }
16+
}
17+
}
18+
// </snippet_first>
19+
#elif LAST
20+
using System.ComponentModel.DataAnnotations;
21+
using System.ComponentModel.DataAnnotations.Schema;
22+
23+
namespace ContosoUniversity.Models
24+
{
25+
// <snippet_last>
26+
public class Course
27+
{
28+
[DatabaseGenerated(DatabaseGeneratedOption.None)]
29+
[Display(Name = "Number")]
30+
public int CourseID { get; set; }
31+
32+
[StringLength(50, MinimumLength = 3)]
33+
public string Title { get; set; }
34+
35+
[Range(0, 5)]
36+
public int Credits { get; set; }
37+
38+
public int DepartmentID { get; set; }
39+
40+
public Department Department { get; set; }
41+
public ICollection<Enrollment> Enrollments { get; set; }
42+
public ICollection<Instructor> Instructors { get; set; }
43+
}
44+
}
45+
// </snippet_last>
46+
#endif

0 commit comments

Comments
 (0)