I decided to run a relatively large project with F # along with MVC4 and Nhibernate.
Now, in C #, my usual practice with ORM is private settings for certain properties (e.g. auto-increment / identification properties, timestamps, etc.). I.e
public class Guide { public int Id { get; private set; } public DateTime Created { get; private set; } public Guide() { Created = DateTime.Now; } }
Here id is the "identity column", and ORM will handle the setting of its value.
In F # this is what I still have
type public Guide() = member val public Id = 0 with get, set member val public Created = DateTime.MinValue with get, set
But the problem I ran into is that getters / setters cannot have access modifiers!
I am new to F #, so I would like to know how best to accomplish such things. However, I do not just want to rewrite C # code in F #! I would like to know the correct (functional) approach to this. Maybe use some other design?
Edit: for NHibernate, replace private with secure in setters :)
Umair source share