I am using Fluent NHibernate v1.3.0.717 and vNHibernate 3.2.0.4000
pulled down from NuGet
I have a model
public class Gift
{
private readonly IList<Asset> _assets = new List<Asset>();
public virtual long Id { get; set; }
public virtual string Name { get; set; }
public virtual string ShortDescription { get; set; }
public virtual IEnumerable<Asset> GetAssets()
{
return _assets;
}
public virtual void Add(Asset asset)
{
_assets.Add(asset);
}
public virtual void Remove(Asset asset)
{
_assets.Remove(asset);
}
public virtual decimal Price { get; set; }
}
Which is mapped as follows:
public class GiftMap : ClassMap<Gift>
{
public GiftMap()
{
Id(x => x.Id).GeneratedBy.Identity();
Map(x => x.Name).Length(255).Not.Nullable();
Map(x => x.Price).Not.Nullable();
Map(x => x.ShortDescription).Length(140).Not.Nullable();
HasMany(x =>
x.GetAssets()).Access.CamelCaseField(Prefix.Underscore).ReadOnly().AsList();
}
}
when I try to run the code I get the following error
----> NHibernate.MappingException : Could not compile the mapping
document: (XmlDocument)
----> NHibernate.PropertyNotFoundException : Could not find the
property '_assets', associated to the field '__assets', in class
'BlogSamples.Core.Domain.Gift'
I can't workout why it's occurring?
--
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fluent-nhibernate?hl=en.