我试图用F#设置EF Core。 我的DbContext看起来像这样
type MainContext(options : DbContextOptions<MainContext>) =
inherit DbContext(options)
[<DefaultValue()>] val mutable dokumenter : DbSet<Dokument>
member x.Dokumenter with get() = x.dokumenter and set v = x.dokumenter <- v
并在Startup.fs中:
member this.ConfigureServices(services: IServiceCollection) =
services.AddDbContext<MainContext>(fun options -> options.UseInMemoryDatabase()) |> ignore
,它给出了以下编译错误:
No overloads match for method 'AddDbContext'. The available overloads are shown below (or in the Error List window).
我做错了什么?
答案 0 :(得分:1)
在|>
之后添加UseInMemoryDatabase()
忽略诀窍:
services.AddDbContext<MainContext>(fun options -> options.UseInMemoryDatabase() |> ignore) |> ignore