Use an interface rather than object?
On 21 Feb 2014 17:39, "Cristian Eriomenco" <cristian.eriome...@gmail.com>
wrote:

> have an UserAccount class, which may belong to an Employee or a Client
>
> I don't know how to QueryOver a object OwnerRefObject field, with a
> filter.
>
> For Example:
>
> public class UserAccount{
>    public virtual int Id {get;set;}
>    public virtual string UserName {get;set;}
>    public virtual string Password {get;set;}
>    public virtual object OwnerRefObject {get;set;}}
> public class UserMap:<User>{
>    public UserMap()
>    {
>       Id(x => x.Id).GeneratedBy.Indentity();
>       Map(x => x.UserName);
>       Map(x => x.Password);
>       ReferencesAny(x => x.OwnerRefObject)
>         .IdentityType<int>()
>         .EntityTypeColumn("OwnerObject_Type")
>         .EntityIdentifierColumn("OwnerObject_Id")
>         .AddMetaValue<Client>(typeof(Client).Name)
>         .AddMetaValue<Employee>(typeof(Employee).Name);
>    }}
>
> Inside service:
>
> public UserAccount GetClientUserAccountByClientId(int clientId){
>    var result = _userAccountRepository
>        .QueryOver()
>        .Where(x => x.OwnerRefObject is Client)
>         // Here I want something like (x => x.OwnerRefObject.Id==clientId)
>        .Future()
>        .FirstOrDefault();
>
>    return result;}
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Fluent NHibernate" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to fluent-nhibernate+unsubscr...@googlegroups.com.
> To post to this group, send email to fluent-nhibernate@googlegroups.com.
> Visit this group at http://groups.google.com/group/fluent-nhibernate.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fluent-nhibernate+unsubscr...@googlegroups.com.
To post to this group, send email to fluent-nhibernate@googlegroups.com.
Visit this group at http://groups.google.com/group/fluent-nhibernate.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to