Open ctaggart opened 6 years ago
This appears to be working for me:
// F# explicit fields append an `@` symbol to the backing fields
// https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/members/explicit-fields-the-val-keyword
override this.OnModelCreating builder =
base.OnModelCreating builder
for entity in builder.Model.GetEntityTypes() do
for foreignKey in entity.GetForeignKeys() do
foreignKey.DependentToPrincipal.Name |> sprintf "%s@" |> foreignKey.DependentToPrincipal.SetField
for property in entity.GetProperties() do
property.Name |> sprintf "%s@" |> property.SetField
for navigation in entity.GetNavigations() do
navigation.Name |> sprintf "%s@" |> navigation.SetField
Re-opening to consider adding this pattern to the field-matching convention.
I'm trying to use EF Core 2.1 from F# with lazy loading proxies, but keep running into:
When we follow the recommended workaround to add abstract fields, they end up with an appended
@
symbol.In this case, I have:
If view it in JustDecompile to C# or similar app, the field is:
This is the behavior of F# explicit fields.
All the fields I have are this way. Is there a way to map F# explicit fields so that EF 2.1 lazy loaded proxies work? This doesn't work, but this was the direction I was going: