Note that there are some explanatory texts on larger screens.

plurals
  1. POAutomapping SQL Server timestamp columns to byte[] using Fluent nHibernate
    primarykey
    data
    text
    <p>I am starting to use Fluent nHibernate on a project and am trying to get the automapping to work. At the time I am stuck with the mapping of our database's timestamp fields into byte-arrays. We are using SQL Server 2008 as the database, and we are not generating the database from code.</p> <p>What I have:</p> <pre><code>public class Entity { public virtual Guid RowID { get; protected set; } public virtual byte[] ChangeCheck { get; protected set; } public virtual string Data { get; set; } } </code></pre> <p>Our database convention is to name the version field 'ChangeCheck'. I cannot seem to locate where I override the default behaviour of DefaultAutomappingConfiguration to use ChangeCheck as the auto-generated version field.</p> <p>Is it possible to get a DefaultAutomappingConfiguration sub-class to automap all ChangeCheck fields into version fields?</p> <p>Thanks for any pointers and help.</p> <h2><em>Optional solution:</em></h2> <p>Given I create an automap override for all entities using 'ChangeCheck' I could do the following:</p> <pre><code> private class ChangeCheckVersionConvention : IVersionConvention { public void Apply(IVersionInstance instance) { instance.Column("ChangeCheck"); instance.Generated.Always(); instance.UnsavedValue(null); } } public class EntityOverride : IAutoMappingOverride&lt;IssueReport&gt; { public void Override(AutoMapping&lt;IssueReport&gt; mapping) { mapping.Version(m =&gt; m.ChangeCheck); } } //.... var persistenceModel = AutoMap.AssemblyOf&lt;MyConfiguration&gt;(new MyConfiguration()) .UseOverridesFromAssemblyOf&lt;MyConfiguration&gt;() .Conventions.Add&lt;ChangeCheckVersionConvention&gt;(); </code></pre> <p>Which works, however I cannot figure out how to remove the override to get the ChangeCheck column set-up as my Version column without having to override all my entities.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload