Sunday 15 March 2015

nhibernate - Private/Protected setters with F# -


I have decided to start a larger project with MVC4 and Nhibernate with F #.

Now, in C #, with my usual behavior in ORM, there are private properties for some properties (for example auto increment / identification properties, timestamps, etc.). Public category guide {public entry ID (get; private set;} created public date time (get; private set;) public guide (i.e.

  

ID is an "identity column" here, and ORM will handle it in setting its value.

F #

But when I met with Problem I, set member vs. public made = DateTime.MinValue

Type

It has to be encountered that the use of gates / sets can not be modifier!

I am new to F #, so I think the best way to do this kind of thing Want to know, however, I just do not want to rewrite the C # code in F #! I would like to know the right (functional) approach to do that use some other construction ?? < P> Edit: For NHibernate, Protector in Sets With personal change :)

"text">

According to the page on Msdian, you access the can on your Getters / Setters are modifier. You can also use different access modifiers for recipient and setter (e.g., a public found and a personal set ).

You can not do the Use the inter access modifier for the automatically implemented properties. Therefore, if you want to use different access modifiers, you will need to manually implement the backing field (with a two ) and gate / setter methods.

No comments:

Post a Comment