Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fluent mapping support #70

Open
RicoSaupeBosch opened this issue May 6, 2023 · 0 comments
Open

fluent mapping support #70

RicoSaupeBosch opened this issue May 6, 2023 · 0 comments

Comments

@RicoSaupeBosch
Copy link

Hi

How do I use the fluent mapping support. I cannot seem to get it to work properly.
I define the mapping below since the object dont have an ID property but that doesnt work when inserting the document to the database.
I I used BSonmapper then the fluent mapping works but it doesnt support the fsharp types.

let createDatabaseUsing (store:Store) (config:AppSettings) =
        let mapper = FSharpBsonMapper()
        mapper.Entity<ServiceRequestAssignment>().Id(fun a -> a.RequestId) |> ignore
        mapper.Entity<SpSite>().Id(fun a -> a.SiteUrl) |> ignore
        
        let db =
            match store with
            | Store.InMemory -> 
                let memoryStream = new MemoryStream()
                new LiteDatabase(memoryStream, mapper)
            | Store.LocalDatabase -> 
                let dbFile = config.Database.File
                new LiteDatabase(dbFile, mapper)
        db

Exception

image

Could you suggest what I am doing wrong here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant