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}
UNION
SELECT * FROM pt."PrayerRequest" WHERE "SmallGroupId" = {0} AND COALESCE("Requestor", '') ILIKE {1}"""
|> RawSqlString
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
|> function
| q ->

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26228.4
# Visual Studio Version 16
VisualStudioVersion = 16.0.29411.108
MinimumVisualStudioVersion = 10.0.40219.1
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "PrayerTracker", "PrayerTracker\PrayerTracker.fsproj", "{63780D3F-D811-4BFB-9FB0-C28A83CCE28F}"
EndProject
@ -11,6 +11,11 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "PrayerTracker.Tests", "Pray
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "PrayerTracker.Data", "PrayerTracker.Data\PrayerTracker.Data.fsproj", "{2B5BA107-9BDA-4A1D-A9AF-AFEE6BF12270}"
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
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU

View File

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

View File

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

View File

@ -1,12 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</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>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
@ -28,11 +23,10 @@
</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="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.2.4" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.0.1" />
</ItemGroup>
<ItemGroup>
@ -41,7 +35,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.6.2" />
<PackageReference Update="FSharp.Core" Version="4.7.0" />
</ItemGroup>
</Project>