Access=readonly in FNH

fluxmunki's Avatar

fluxmunki

19 Feb, 2010 09:12 AM via web

Hi, I've asked a question on the nhusers list and they suggested using a mapping with a property of access=readonly as this doesn't require that a setter be available. I've tried using the ReadOnly() method and have also tried Access.

Am I doing something wrong? Is there a way to specify this access strategy in FNH?

  1. Support Staff 2 Posted by James Gregory on 19 Feb, 2010 09:26 AM

    James Gregory's Avatar

    You should be able to use the ReadOnlyXXX methods from Access, there are several available.

    Map(x => x.ReadOnlyProperty)
      .Access.ReadOnlyPropertyThroughCamelCaseField();
    

    That specifies that the ReadOnlyProperty property doesn't have a setter, and it exposes a field that has the same name as the property, just in camel case.

    The options are:

    Access.ReadOnlyPropertyThroughCamelCaseField()
    Access.ReadOnlyPropertyThroughCamelCaseField(prefix)
    Access.ReadOnlyPropertyThroughLowerCaseField()
    Access.ReadOnlyPropertyThroughLowerCaseField(prefix)
    Access.ReadOnlyPropertyThroughPascalCaseField(prefix)
    

    The prefix overload is used when your field name matches your property name, but with some prefix.

    The available prefix options are:

    Underscore
    m
    mUnderscore
    
  2. James Gregory closed this discussion on 19 Feb, 2010 12:06 PM.

Comments are currently closed for this discussion. You can start a new one.