Skip to content

Commit 0f7e7cb

Browse files
committed
Updated to 6.0.0 (Npgsql.EntityFrameworkCore.PostgreSQL still rc.2)
1 parent 01f3d86 commit 0f7e7cb

File tree

7 files changed

+63
-19
lines changed

7 files changed

+63
-19
lines changed

DataLayer/BookApp/EfCode/BookContext.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,26 @@ protected override void
2424
modelBuilder.ApplyConfiguration(new PriceOfferConfig());
2525
}
2626
}
27+
28+
/******************************************************************************
29+
* NOTES ON MIGRATION:
30+
*
31+
* see https://docs.microsoft.com/en-us/aspnet/core/data/ef-rp/migrations?tabs=visual-studio
32+
*
33+
* The following NuGet libraries must be loaded
34+
* 1. Add to DataLayer: "Microsoft.EntityFrameworkCore.Tools"
35+
* 2. Add to DataLayer: "Microsoft.EntityFrameworkCore.SqlServer" (or another database provider)
36+
*
37+
* 2. Using Package Manager Console commands
38+
* The steps are:
39+
* a) Make sure the default project is DataLayer
40+
* b) Use the PMC command
41+
* Add-Migration Initial -Context BookContext -OutputDir BookApp
42+
*
43+
* If you want to start afresh then:
44+
* a) Delete the current database
45+
* b) Delete all the class in the Migration directory
46+
* c) follow the steps to add a migration
47+
******************************************************************************/
2748
}
2849

DataLayer/BookApp/EfCode/Class1.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright (c) 2020 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/
2+
// Licensed under MIT license. See License.txt in the project root for license information.
3+
4+
using Microsoft.EntityFrameworkCore;
5+
using Microsoft.EntityFrameworkCore.Design;
6+
7+
namespace DataLayer.BookApp.EfCode
8+
{
9+
public class DesignTimeContextFactory : IDesignTimeDbContextFactory<BookContext>
10+
{
11+
private const string connectionString =
12+
"Server=(localdb)\\mssqllocaldb;Database=TestSupport;Trusted_Connection=True;MultipleActiveResultSets=true";
13+
14+
public BookContext CreateDbContext(string[] args)
15+
{
16+
var optionsBuilder =
17+
new DbContextOptionsBuilder<BookContext>();
18+
optionsBuilder.UseSqlServer(connectionString);
19+
20+
return new BookContext(optionsBuilder.Options);
21+
}
22+
}
23+
}

DataLayer/DataLayer.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0'">
1414
<PackageReference Include="GenericServices.StatusGeneric" Version="1.1.0" />
15-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0-rc.2.21480.5" />
15+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0" />
1616
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
1717
</ItemGroup>
1818

ReleaseNotes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Release notes
22

3-
## 5.1.0-preview002
3+
## 5.1.0
44

55
- BREAKING CHANGE: Renamed DeleteAllUnitTestDatabases to DeleteAllSqlServerTestDatabases
66
- REMOVED obsolete methods: ...OptionsWithLogging (use ...OptionsWithLogTo), CreateEmptyViaWipe (use EnsureClean)
7-
- NET6 Support: Updated to support both EF Core 5 and EF Core 6-rc.2 preview
7+
- NET6 Support: Updated to support both EF Core 5 and EF Core
88
- New Feature: Added PostgreSQL database helpers, including EnsureClean (see docs)
99
- Feature: Reinstated the Seed Database feature to this version due to requests from users
1010

Test/Test.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
</ItemGroup>
1919

2020
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0'">
21-
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.0-rc.2.21480.5" />
22-
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.0-rc.2.21480.5" />
23-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0-rc.2.21480.5" />
21+
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.0" />
22+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.0" />
23+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0" />
2424
<PackageReference Include="RandomNameGeneratorLibrary" Version="1.2.2" />
2525
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
2626
<PackageReference Include="xunit" Version="2.4.1" />

TestSupport/EfHelpers/PostgreSqlHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public static DbContextOptions<T> CreatePostgreSqlUniqueMethodOptions<T>(this ob
7979
}
8080

8181
//------------------------------------------------------------
82-
//methods to provide empty PostgreSql databases and how to delete all the PostgreSql databases used for unit testing
82+
//methods to provide empty PostgreSql databases
8383

8484

8585
/// <summary>

TestSupport/TestSupport.csproj

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,26 @@
2424
</ItemGroup>
2525

2626
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0'">
27-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.0-rc.2.21480.5" />
28-
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0-rc.2.21480.5" />
29-
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.0-rc.2.21480.5" />
30-
<PackageReference Include="Microsoft.EntityFrameworkCore.Cosmos" Version="6.0.0-rc.2.21480.5">
27+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.0" />
28+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0" />
29+
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.0" />
30+
<PackageReference Include="Microsoft.EntityFrameworkCore.Cosmos" Version="6.0.0">
3131
<PrivateAssets>all</PrivateAssets>
3232
</PackageReference>
33-
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.0-rc.2.21480.5" />
34-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0-rc.2.21480.5" />
35-
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.0-rc.2.21480.5" />
36-
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0-rc.2.21480.5" />
33+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.0" />
34+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0" />
35+
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.0" />
36+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
3737
<PackageReference Include="Microsoft.Data.SqlClient" Version="3.0.1" />
38-
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.0-rc.2" />
38+
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.0-rc.2 " />
3939
<PackageReference Include="Respawn" Version="4.0.0" />
4040
<PackageReference Include="xunit.assert" Version="2.4.1" />
4141
<PackageReference Include="xunit.core" Version="2.4.1" />
4242
</ItemGroup>
4343

4444
<PropertyGroup>
4545
<PackageId>EfCore.TestSupport</PackageId>
46-
<PackageVersion>5.1.0-preview002</PackageVersion>
46+
<PackageVersion>5.1.0</PackageVersion>
4747
<Version>5.1.0</Version>
4848
<AssemblyVersion>5.1.0.0</AssemblyVersion>
4949
<FileVersion>5.1.0.0</FileVersion>
@@ -53,8 +53,8 @@
5353
<PackageReleaseNotes>
5454
- BREAKING CHANGE: Renamed DeleteAllUnitTestDatabases to DeleteAllSqlServerTestDatabases
5555
- REMOVED obsolete methods: ...OptionsWithLogging (use ...OptionsWithLogTo), CreateEmptyViaWipe (use EnsureClean)
56-
- NET6 Support: Updated to support both EF Core 5 and EF Core 6-rc.2 preview (see docs)
57-
- New Feature: Added PostgreSQL database helpers, including EnsureClean
56+
- NET6 Support: Updated to support both EF Core 5 and EF Core
57+
- New Feature: Added PostgreSQL database helpers, including EnsureClean (see docs)
5858
- Feature: Reinstated the Seed Database feature to this version due to requests from users
5959
</PackageReleaseNotes>
6060
<Copyright>Copyright (c) 2020 Jon P Smith. Licenced under MIT licence</Copyright>

0 commit comments

Comments
 (0)