title: NHibernate: How to disable virtual for class properties?
body: <p>how exactly I can use public methods (non-virtual) with NHibernate?</p>
  
  <p>I have this code:</p>
  
  <pre><code>public string crewNumber
      {
          get
          {
              return this.crewNumberField;
          }
          set
          {
              this.crewNumberField = value;
          }
      }
  </code></pre>
  
  <p>Note all my classes, properties, methods and interfaces are auto-generated and I do not want to change them manually.</p>
  
  <p>Above code is producing this error:</p>
  
  <blockquote>
    <p>The following types may not be used as
    proxies: ... method get_crewNumber
    should be 'public/protected virtual'</p>
  </blockquote>
  
  <p>I see that it shold be possible to use simple public only properties <a href="https://www.hibernate.org/362.html" rel="nofollow noreferrer">here</a>:</p>
  
  <blockquote>
    <p>In our example above, we've made the
    properties and the constructor public
    - but that's not a requirement for NHibernate - it can use public,
    protected, internal, or even private
    properties to persist your data.</p>
  </blockquote>
  
  <p>How do I turn off this virtual by default?</p>
  
  <p>It's driving me crazy. I am really tempted here to drag one data adapter in visual studio and to end this ridiculous situation once and for all ;-)</p>
  
  <p>Thanks</p>