How to access the backing field of an inherited class using fluent nhibernate
Posted
by Akk
on Stack Overflow
See other posts from Stack Overflow
or by Akk
Published on 2010-05-24T16:11:43Z
Indexed on
2010/05/24
16:41 UTC
Read the original article
Hit count: 246
How do i set the Access Strategy in the mapping class to point to the inherited _photos field?
public class Content
{
private IList<Photo> _photos;
public Content()
{
_photos = new List<Photo>();
}
public virtual IEnumerable<Photo> Photos
{
get
{
return _photos;
}
}
public virtual void AddPhoto() {...}
}
public class Article : Content
{
public string Body {get; set;}
}
I am currently using thw following to try and locate the backing field but an exception is thrown as it cannot be found.
public class ArticleMap : ClassMap<Article>
{
HasManyToMany(x => x.Photos)
.Access.CamelCaseField(Prefix.Underscore) //_photos
//...
}
i tried moving the backing field _photos directly into the class and the access works. So how can i access the backing field of an inherited class?
© Stack Overflow or respective owner