Hi Guys,
I've hit across a problem and keep getting the error
Code:
could not resolve property: User.Email of: Core.Domain.NewsletterSubscription
Whilst i know this usualy revolves around an incorrect mapping, the weird thing is a different query that queries agains "User.Id" works.
The code for the 2 functions are:
Code:
public NewsletterSubscription GetByEmail(string email)
{
ICriteria criteria = NHibernateSession.CreateCriteria(typeof(NewsletterSubscription));
criteria.Add(Expression.Eq("User.Email", email));
return criteria.UniqueResult<NewsletterSubscription>();
}
public NewsletterSubscription GetByUser(User user)
{
ICriteria criteria = NHibernateSession.CreateCriteria(typeof(NewsletterSubscription));
criteria.Add(Expression.Eq("User.Id", user.Id));
return criteria.UniqueResult<NewsletterSubscription>();
}
With the mapping file for the NewsletterSubscription class being:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Core.Domain.NewsletterSubscription, Core" table="`NewsletterSubscription`" lazy="false">
<id name="Id" column="`NewsletterSubscriptionId`" unsaved-value="00000000-0000-0000-0000-000000000000">
<generator class="guid" />
</id>
<property name="Email" access="nosetter.camelcase-underscore" />
<property name="IsVerified" />
<property name="IsActive" />
<property name="CreatedDate" />
<property name="ModifiedDate" />
<many-to-one name="User" class="Core.Domain.User, Core" column="`UserId`" not-null="false" />
</class>
</hibernate-mapping>
Anybody got any ideas why one would work, but the other throws the said error?