How to set update="false" now that SetAttribute has been removed?

Original Post tim_acheson's Avatar

tim_acheson

13 Apr, 2010 11:41 AM via web

I understand that SetAttribute has now been removed:
http://wiki.fluentnhibernate.org/Release_notes_1.0

I hope this doesn't mean that essential functionality has been taken away.

In our projects, we need to do this:-

.SetAttribute("update", "false");

How can I set the "update" attribute, without using SetAttribute?

  1. 2 Posted by Stuart Childs on 13 Apr, 2010 07:22 PM

    Stuart Childs's Avatar

    Use the .Update() (similarly, .Insert() for insert="") method. Since .Update() is setting a bool, you can use the .Not property to set the next bool to false. So, putting it all together:

    Map(x => x.MyProperty).Not.Update();

    The above will create a mapping like:

    <property name="MyProperty" update="false" ...

    Also note that there is a .ReadOnly() method which will set both update="false" and insert="false"

  2. 3 Posted by tim_acheson on 14 Apr, 2010 08:23 AM

    tim_acheson's Avatar

    Thanks for confirming. :)

  3. James Gregory resolved this discussion on 16 May, 2010 05:37 PM.

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