Skip to content

Commit 4e593bd

Browse files
committed
2 parents 9f857e6 + 8446927 commit 4e593bd

File tree

130 files changed

+26200
-11612
lines changed

Some content is hidden

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

130 files changed

+26200
-11612
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
/Example/obj
1010
obj
1111
bin
12+

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: csharp
22
mono: none
3-
dotnet: 2.0.0
3+
dotnet: 3.0
44

55
script:
66
- cd FileContextCore

ASPNETDemo/ASPNETDemo.csproj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp3.0</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0" />
9+
</ItemGroup>
10+
11+
<ItemGroup>
12+
<ProjectReference Include="..\FileContextCore\FileContextCore.csproj" />
13+
</ItemGroup>
14+
15+
</Project>

ASPNETDemo/Data/Db.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Microsoft.EntityFrameworkCore;
6+
7+
namespace ASPNETDemo.Data
8+
{
9+
public class Db : DbContext
10+
{
11+
12+
public Db(DbContextOptions<Db> options) : base(options)
13+
{
14+
15+
}
16+
public DbSet<User> Users { get; set; }
17+
}
18+
}

ASPNETDemo/Data/User.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel.DataAnnotations;
4+
using System.Linq;
5+
using System.Threading.Tasks;
6+
7+
namespace ASPNETDemo.Data
8+
{
9+
public class User
10+
{
11+
[Key]
12+
public int Id { get; set; }
13+
14+
public string Username { get; set; }
15+
16+
public string Email { get; set; }
17+
}
18+
}

ASPNETDemo/Pages/Error.cshtml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@page
2+
@model ErrorModel
3+
@{
4+
ViewData["Title"] = "Error";
5+
}
6+
7+
<h1 class="text-danger">Error.</h1>
8+
<h2 class="text-danger">An error occurred while processing your request.</h2>
9+
10+
@if (Model.ShowRequestId)
11+
{
12+
<p>
13+
<strong>Request ID:</strong> <code>@Model.RequestId</code>
14+
</p>
15+
}
16+
17+
<h3>Development Mode</h3>
18+
<p>
19+
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
20+
</p>
21+
<p>
22+
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
23+
It can result in displaying sensitive information from exceptions to end users.
24+
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
25+
and restarting the app.
26+
</p>
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,24 @@
55
using System.Threading.Tasks;
66
using Microsoft.AspNetCore.Mvc;
77
using Microsoft.AspNetCore.Mvc.RazorPages;
8+
using Microsoft.Extensions.Logging;
89

9-
namespace AspNetOAuth.Pages
10+
namespace ASPNETDemo.Pages
1011
{
12+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
1113
public class ErrorModel : PageModel
1214
{
1315
public string RequestId { get; set; }
1416

1517
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
1618

17-
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
19+
private readonly ILogger<ErrorModel> _logger;
20+
21+
public ErrorModel(ILogger<ErrorModel> logger)
22+
{
23+
_logger = logger;
24+
}
25+
1826
public void OnGet()
1927
{
2028
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;

ASPNETDemo/Pages/Index.cshtml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@page
2+
@model IndexModel
3+
@{
4+
ViewData["Title"] = "Home page";
5+
}
6+
7+
<div class="text-center">
8+
<h1 class="display-4">Welcome</h1>
9+
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
10+
</div>
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,19 @@
44
using System.Threading.Tasks;
55
using Microsoft.AspNetCore.Mvc;
66
using Microsoft.AspNetCore.Mvc.RazorPages;
7+
using Microsoft.Extensions.Logging;
78

8-
namespace AspNetOAuth.Pages
9+
namespace ASPNETDemo.Pages
910
{
1011
public class IndexModel : PageModel
1112
{
13+
private readonly ILogger<IndexModel> _logger;
14+
15+
public IndexModel(ILogger<IndexModel> logger)
16+
{
17+
_logger = logger;
18+
}
19+
1220
public void OnGet()
1321
{
1422

ASPNETDemo/Pages/Privacy.cshtml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@page
2+
@model PrivacyModel
3+
@{
4+
ViewData["Title"] = "Privacy Policy";
5+
}
6+
<h1>@ViewData["Title"]</h1>
7+
8+
<p>Use this page to detail your site's privacy policy.</p>

0 commit comments

Comments
 (0)