Question

What should drive design consideration for the following case ?

Let's say you have Quotes.

A Quote relates to a specific Contract.

I can define my classes in the following way

Contract =
  someproperty  : int

Quote:
  contract : Contract

Yet when i navigate I would like, even if it does not exists in my model, to be able to do

myContract.quotes

Typically, those properties are generated when using the Entity framework or some other ORM.

But the question of separating the definition from the navigation exists in full generality, even when using pure memory only classes.

(I guess one could frame in into generating the transitive closure of the navigation graph, from the subset of links specified at the definition)

My question is : what are the possible practical approach to inherit automatically those navigational properties in FSharp ? I am just a user, and not an framework developper, abnd this is very low level stuff.

[Obviously you can generalize to more complex class hierarchies can be

  • A Quote comes from a broker, is of bid or ask nature, has a level, and is valide for a specific contract.
  • Contract can be for a certain maturity, say 2013, and refer to a specific company.
  • Company has a ticker, etc, etc... ]
Was it helpful?

Solution

Maybe I've misunderstood; but could you not use an extension method to add the ability to navigate this way? You'd still need to call a function to get the quotes for the particular contract, but the helper would exist, which can just call your data provider for a filtered list of quotes for that contact?

OTHER TIPS

Hum, interesting question.

According to this blog post, you can just use the entity framework to do that in a non-database-backed way. You'll have to handle the persistence yourself.

Or your could try spending a week-end solving this problem yourself with a generic F# solution, but I'd say that EF is good enough here ?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top