Convert to .NET Core 3.0 (#20)

Also extracted common project items to Directory.Build.props, and fixed code and execution issues related to EF Core 3.0 changes
This commit is contained in:
Daniel J. Summers 2019-10-19 11:21:48 -05:00
parent bf48c360de
commit e29a21ed6e
9 changed files with 41 additions and 46 deletions

View File

@ -0,0 +1,9 @@
<Project>
<PropertyGroup>
<AssemblyVersion>7.4.0.0</AssemblyVersion>
<FileVersion>7.4.0.0</FileVersion>
<Authors>danieljsummers</Authors>
<Company>Bit Badger Solutions</Company>
<Version>7.4.0</Version>
</PropertyGroup>
</Project>

View File

@ -163,9 +163,8 @@ type AppDbContext with
""" SELECT * FROM pt."PrayerRequest" WHERE "SmallGroupId" = {0} AND "Text" ILIKE {1} """ SELECT * FROM pt."PrayerRequest" WHERE "SmallGroupId" = {0} AND "Text" ILIKE {1}
UNION UNION
SELECT * FROM pt."PrayerRequest" WHERE "SmallGroupId" = {0} AND COALESCE("Requestor", '') ILIKE {1}""" SELECT * FROM pt."PrayerRequest" WHERE "SmallGroupId" = {0} AND COALESCE("Requestor", '') ILIKE {1}"""
|> RawSqlString
let like = sprintf "%%%s%%" let like = sprintf "%%%s%%"
this.PrayerRequests.FromSql(sql, grp.smallGroupId, like searchTerm).AsNoTracking () this.PrayerRequests.FromSqlRaw(sql, grp.smallGroupId, like searchTerm).AsNoTracking ()
|> reqSort grp.preferences.requestSort |> reqSort grp.preferences.requestSort
|> function |> function
| q -> | q ->

View File

@ -1,10 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.1</TargetFramework>
<AssemblyVersion>7.3.2.0</AssemblyVersion>
<FileVersion>7.3.2.0</FileVersion>
<Version>7.3.2</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -17,14 +14,14 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="FSharp.EFCore.OptionConverter" Version="1.0.0" /> <PackageReference Include="FSharp.EFCore.OptionConverter" Version="1.0.0" />
<PackageReference Include="Microsoft.FSharpLu" Version="0.10.31" /> <PackageReference Include="Microsoft.FSharpLu" Version="0.11.5" />
<PackageReference Include="NodaTime" Version="2.4.5" /> <PackageReference Include="NodaTime" Version="2.4.7" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.2.4" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.0.1" />
<PackageReference Include="TaskBuilder.fs" Version="2.1.0" /> <PackageReference Include="TaskBuilder.fs" Version="2.1.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.6.2" /> <PackageReference Update="FSharp.Core" Version="4.7.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -2,10 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyVersion>7.3.2.0</AssemblyVersion>
<FileVersion>7.3.2.0</FileVersion>
<Version>7.3.2</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -18,9 +15,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Expecto" Version="8.10.1" /> <PackageReference Include="Expecto" Version="8.12.0" />
<PackageReference Include="Expecto.VisualStudio.TestAdapter" Version="10.0.2" /> <PackageReference Include="Expecto.VisualStudio.TestAdapter" Version="10.0.2" />
<PackageReference Include="NodaTime.Testing" Version="2.4.5" /> <PackageReference Include="NodaTime.Testing" Version="2.4.7" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -30,7 +27,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.6.2" /> <PackageReference Update="FSharp.Core" Version="4.7.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,10 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.1</TargetFramework>
<AssemblyVersion>7.3.2.0</AssemblyVersion>
<FileVersion>7.3.2.0</FileVersion>
<Version>7.3.2</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -21,8 +18,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Giraffe" Version="3.6.0" /> <PackageReference Include="Giraffe" Version="4.0.1" />
<PackageReference Include="MailKit" Version="2.1.5.1" /> <PackageReference Include="MailKit" Version="2.3.2" />
<PackageReference Include="Microsoft.AspNetCore.Html.Abstractions" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.Html.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" /> <PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Microsoft.AspNetCore.Http.Extensions" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.Http.Extensions" Version="2.2.0" />
@ -65,7 +62,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.6.2" /> <PackageReference Update="FSharp.Core" Version="4.7.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15 # Visual Studio Version 16
VisualStudioVersion = 15.0.26228.4 VisualStudioVersion = 16.0.29411.108
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "PrayerTracker", "PrayerTracker\PrayerTracker.fsproj", "{63780D3F-D811-4BFB-9FB0-C28A83CCE28F}" Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "PrayerTracker", "PrayerTracker\PrayerTracker.fsproj", "{63780D3F-D811-4BFB-9FB0-C28A83CCE28F}"
EndProject EndProject
@ -11,6 +11,11 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "PrayerTracker.Tests", "Pray
EndProject EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "PrayerTracker.Data", "PrayerTracker.Data\PrayerTracker.Data.fsproj", "{2B5BA107-9BDA-4A1D-A9AF-AFEE6BF12270}" Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "PrayerTracker.Data", "PrayerTracker.Data\PrayerTracker.Data.fsproj", "{2B5BA107-9BDA-4A1D-A9AF-AFEE6BF12270}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B290BA27-C8B8-44F3-BF01-D103302D815F}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU

View File

@ -15,6 +15,7 @@ module Configure =
open Microsoft.EntityFrameworkCore open Microsoft.EntityFrameworkCore
open Microsoft.Extensions.Configuration open Microsoft.Extensions.Configuration
open Microsoft.Extensions.DependencyInjection open Microsoft.Extensions.DependencyInjection
open Microsoft.Extensions.Hosting
open Microsoft.Extensions.Localization open Microsoft.Extensions.Localization
open Microsoft.Extensions.Logging open Microsoft.Extensions.Logging
open Microsoft.Extensions.Options open Microsoft.Extensions.Options
@ -150,7 +151,7 @@ module Configure =
/// Configure logging /// Configure logging
let logging (log : ILoggingBuilder) = let logging (log : ILoggingBuilder) =
let env = log.Services.BuildServiceProvider().GetService<IHostingEnvironment> () let env = log.Services.BuildServiceProvider().GetService<IWebHostEnvironment> ()
match env.IsDevelopment () with match env.IsDevelopment () with
| true -> log | true -> log
| false -> log.AddFilter (fun l -> l > LogLevel.Information) | false -> log.AddFilter (fun l -> l > LogLevel.Information)
@ -158,8 +159,7 @@ module Configure =
|> ignore |> ignore
let app (app : IApplicationBuilder) = let app (app : IApplicationBuilder) =
let env = app.ApplicationServices.GetRequiredService<IHostingEnvironment>() let env = app.ApplicationServices.GetRequiredService<IWebHostEnvironment>()
let log = app.ApplicationServices.GetRequiredService<ILoggerFactory>()
(match env.IsDevelopment () with (match env.IsDevelopment () with
| true -> | true ->
app.UseDeveloperExceptionPage () app.UseDeveloperExceptionPage ()

View File

@ -71,17 +71,14 @@ let maintain : HttpHandler =
requireAccess [ Admin ] requireAccess [ Admin ]
>=> fun next ctx -> >=> fun next ctx ->
let startTicks = DateTime.Now.Ticks let startTicks = DateTime.Now.Ticks
let await = Async.AwaitTask >> Async.RunSynchronously
let db = ctx.dbContext () let db = ctx.dbContext ()
task { task {
let! churches = db.AllChurches () let! churches = db.AllChurches ()
let! stats = let stats = churches |> List.map (fun c -> await (findStats db c.churchId))
churches
|> Seq.ofList
|> Seq.map (fun c -> findStats db c.churchId)
|> Task.WhenAll
return! return!
viewInfo ctx startTicks viewInfo ctx startTicks
|> Views.Church.maintain churches (stats |> Map.ofArray) ctx |> Views.Church.maintain churches (stats |> Map.ofList) ctx
|> renderHtml next ctx |> renderHtml next ctx
} }

View File

@ -1,12 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyVersion>7.3.2.0</AssemblyVersion>
<FileVersion>7.3.2.0</FileVersion>
<Authors></Authors>
<Company>Bit Badger Solutions</Company>
<Version>7.3.2</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -28,11 +23,10 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Giraffe" Version="3.6.0" /> <PackageReference Include="Giraffe" Version="4.0.1" />
<PackageReference Include="Giraffe.TokenRouter" Version="1.0.0" /> <PackageReference Include="Giraffe.TokenRouter" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.App" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.0.1" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.2.4" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -41,7 +35,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.6.2" /> <PackageReference Update="FSharp.Core" Version="4.7.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>