Automapping

16 views
Skip to first unread message

Peter Forstmeier

unread,
Apr 19, 2013, 11:28:14 AM4/19/13
to Fluent NHibernate
Hi List,
i play around with automapping and
a) can't get Version's to work:

The Version Column is defiend in a baseclass:
public abstract class AuditableGuidDomain<T> : BaseDomain<T>,
IAuditable where T : BaseDomain<T>
{
................
public virtual int Version { get; set; }


public class MyVersionConvention : IVersionConvention
{
public void Apply
(FluentNHibernate.Conventions.Instances.IVersionInstance instance)
{
instance.Column("Version");
instance.Not.Nullable();
instance.UnsavedValue("0");
}
}

The configuration is as follows:

.Mappings(m => m.AutoMappings.Add(AutoMap.AssemblyOf<Employee>()
.Conventions.AddFromAssemblyOf<ProjectTracker.Repositorys.Conventions.CascadeConvention>()
.Override<Employee>(map =>{
map.Version(x => x.Version);
map.HasMany(x => x.Addresses).Fetch.Join();
}

b) is there a way to define Invers() as a Comvention?

Thanks in advance
Peter

Reply all
Reply to author
Forward
0 new messages