FSharp Entry Types with Entity Framework-First Database

I am doing a proof of concept in a line of a business application where I want to change the current implementation of the C # Code-First Entity Framework using F # one. I am following this article, which seems to work very well, but I was hoping to use FSharp record types instead of the classes that the article uses. When I try to add data annotation to a record type, for example:

type Family = {[<Key>]Id:int; LastName:string; IsRegistered:bool}

I get the following error:

Error   1   The type 'Key' is not defined

Is there a way to use data annotations with record types? EF Code-First seems to require annotation ...

+4
source share
1 answer

Record types support attributes just fine (and with your syntax).

, System.ComponentModel.DataAnnotations, KeyAttribute.

: EF , EF. F # 3.0+, CLIMutable ( , # - ).

, , F # 2.0 - CLIMutable , .

+5

Source: https://habr.com/ru/post/1569127/


All Articles