ho tszhin
ho tszhin

Reputation: 21

F# multiple one to many relationship

I am trying to learn F# and I came across this question:

let's say I have three tables. A,B,C

How do i create a type if 1A -> ManyB, then 1B -> ManyC

I mean in C# you can create a list of B in A object. then create a list of C in B object. What about in F#? I can't really find any example regarding this on the internet. Any advises are welcome and Thanks in advance for your help!

Upvotes: 1

Views: 156

Answers (1)

Tomas Petricek
Tomas Petricek

Reputation: 243106

It is not possible to give a good answer, because your question is way too general. The answer will depend on what you actually want to do with those objects.

However, if you just want a value to keep a list of other values, you can define those types as F# records containing lists:

type C = { Whatever : string }
type B = { CThings : C list }
type A = { BThings : B list }

Upvotes: 3

Related Questions