-
Notifications
You must be signed in to change notification settings - Fork 683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to ASP.NET Core 3.0 #444
Changes from all commits
509cb96
6e2f939
fd25803
58a7050
2ef87b5
e006f70
5ccdcad
489f12a
e327370
aedba2e
b23e285
434417d
a31c600
15e2b1a
95ad4a6
bb1b290
7d90d03
f6eeb03
dc51b37
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<packageSources> | ||
<clear /> | ||
<add key="nuget" value="https://api.nuget.org/v3/index.json" /> | ||
</packageSources> | ||
</configuration> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks> | ||
<TargetFrameworks>netcoreapp3.0</TargetFrameworks> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
<PackageTags>NuGet;Azure;Cloud</PackageTags> | ||
<Description>The libraries to host BaGet on Azure.</Description> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using BaGet.Core; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
using Microsoft.Extensions.Options; | ||
|
||
namespace BaGet.Extensions | ||
{ | ||
public static class IHostExtensions | ||
{ | ||
public static async Task RunMigrationsAsync(this IHost host, CancellationToken cancellationToken) | ||
{ | ||
// Run migrations if necessary. | ||
var options = host.Services.GetRequiredService<IOptions<BaGetOptions>>(); | ||
|
||
if (options.Value.RunMigrationsAtStartup && options.Value.Database.Type != DatabaseType.AzureTable) | ||
{ | ||
using (var scope = host.Services.CreateScope()) | ||
{ | ||
var ctx = scope.ServiceProvider.GetRequiredService<IContext>(); | ||
|
||
// TODO: An "InvalidOperationException" is thrown and caught due to a bug | ||
// in EF Core 3.0. This is fixed in 3.1. | ||
// See: https://github.com/dotnet/efcore/issues/18307 | ||
await ctx.Database.MigrateAsync(cancellationToken); | ||
} | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks> | ||
<TargetFrameworks>netcoreapp3.0</TargetFrameworks> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
<Description>The core libraries that power BaGet.</Description> | ||
</PropertyGroup> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -214,8 +214,8 @@ IQueryable<Package> AddSearchFilters(IQueryable<Package> packageQuery) | |
} | ||
|
||
var packageIds = search.Select(p => p.Id) | ||
.OrderBy(id => id) | ||
.Distinct() | ||
.OrderBy(id => id) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a works around an EF Core 3 bug. See npgsql/efcore.pg#1195 (comment) |
||
.Skip(skip) | ||
.Take(take); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks> | ||
<TargetFrameworks>netcoreapp3.0</TargetFrameworks> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.2.0" /> | ||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.0.1" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.