File tree 4 files changed +9
-6
lines changed
tests/EFCore.FSharp.Tests/Translations
4 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -102,17 +102,18 @@ module Extensions =
102
102
let useValueConverterForType ( ``type`` : Type ) ( converter : ValueConverter ) ( modelBuilder : ModelBuilder ) =
103
103
modelBuilder.UseValueConverterForType( `` type `` , converter)
104
104
105
+ let fSharpTypeOptionsExtensionInstance = FSharpTypeOptionsExtension()
105
106
106
107
type DbContextOptionsBuilder with
107
108
member this.UseFSharpTypes () =
108
109
let extension =
109
- let finded =
110
+ let found =
110
111
this.Options.FindExtension< FSharpTypeOptionsExtension>()
111
112
112
- if ( box finded ) <> null then
113
- finded
113
+ if notNull found then
114
+ found
114
115
else
115
- FSharpTypeOptionsExtension ()
116
+ fSharpTypeOptionsExtensionInstance
116
117
117
118
118
119
( this :> IDbContextOptionsBuilderInfrastructure)
Original file line number Diff line number Diff line change @@ -30,8 +30,9 @@ type ExtensionInfo(extension) =
30
30
31
31
override _.LogFragment = " using FSharp types"
32
32
33
- override _.ShouldUseSameServiceProvider other = other.IsDatabaseProvider
33
+ override _.ShouldUseSameServiceProvider other = true
34
34
35
+ [<AllowNullLiteral>]
35
36
type FSharpTypeOptionsExtension () =
36
37
interface IDbContextOptionsExtension with
37
38
member this.ApplyServices ( services ) =
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ type MyContext() =
27
27
28
28
override _.OnConfiguring ( options : DbContextOptionsBuilder ) : unit =
29
29
options
30
- // .EnableServiceProviderCaching(false)
30
+ .EnableServiceProviderCaching( false )
31
31
.UseInMemoryDatabase( " MyContext" )
32
32
.UseFSharpTypes()
33
33
|> ignore
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ type MyContext() =
29
29
30
30
override _.OnConfiguring ( options : DbContextOptionsBuilder ) : unit =
31
31
options
32
+ .EnableServiceProviderCaching( false )
32
33
.UseInMemoryDatabase( " MyContext" )
33
34
.UseFSharpTypes()
34
35
|> ignore
You can’t perform that action at this time.
0 commit comments