Marten.FSharp icon indicating copy to clipboard operation
Marten.FSharp copied to clipboard

Marten.Fsharp should support Foreign Key expressions

Open ImaginaryDevelopment opened this issue 5 years ago • 0 comments

In the Marten docs

var store = DocumentStore.For(_ =>
{
    _.Connection("some database connection");

    // In the following line of code, I'm setting
    // up a foreign key relationship to the User document
    _.Schema.For<Issue>().ForeignKey<User>(x => x.AssigneeId);
});

The x => x.AssigneeId is of type System.Linq.Expressions.Expression<Func<Alarm,obj>> which can be translated from a Microsoft.Fsharp.Quotations.Expr<'a -> obj>

The ForeignKey method currently lives at https://github.com/JasperFx/marten/blob/6fc1c4e84fb19f2cef0144664ecd5f73d030117b/src/Marten/MartenRegistry.cs#L269-L277

ImaginaryDevelopment avatar Mar 06 '19 15:03 ImaginaryDevelopment