Convention for ReadOnly Identity with Backing Field
Hi,
How do I map this class using conventions?
public class Car
{
Guid _id;
public Guid Id { get { return _id; } }
}
I have tried this convention, but the access strategy is always set to "nosetter.camelcase" instead of "nosetter.camelcase-underscore":
public class PrimaryKeyConvention : IIdConvention
{
public void Apply(IIdentityInstance instance)
{
instance.Access.ReadOnlyPropertyThroughCamelCaseField(CamelCasePrefix.Underscore);
instance.GeneratedBy.Assigned();
}
}
Attached is a sample demonstrating the problem.
Thanks,
Brian
- Program.cs 2.5 KB
Support Staff 2 Posted by Paul Batum on 05 Jun, 2010 11:34 AM
Okay, I was able to replicate the issue and introduce a fix, which is now on
my repository:
http://github.com/paulbatum/fluent-nhibernate/commit/8294f2a911f83829e7fd9d78dcb378cd352fdffb
<http://github.com/paulbatum/fluent-nhibernate/commit/8294f2a911f83829e7fd9d78dcb378cd352fdffb>It'll
be in the next batch of changes I send to James.
Thanks for reporting the issue. Sending a modified version of Program.cs
from the automapping example project made it very easy to reproduce.