Hi guys,
I am using Nhibernate's mapping-by-code and I am stuck. The problem is that
I am using composite keys such as:
public class PersonAccountKey : IKey
{
public virtual string PersonId { get; set; }
public virtual string AccountNo{ get; set; }
public override bool Equals(object obj) { if (obj == null) return false; var
t = obj as PersonKey; if (t == null) return false; if (PersonId == t.PersonId
&& AccountNo == t.AccountNo) return true; return false; } public override
int GetHashCode() { return (PersonId).GetHashCode() + "|" +
(AccountNo).GetHashCode(); } }
If I have list of PersonKey objects, how can I get NHibernate to send a single
query down to database? I had a look at Criteria but could not successfully
achieve it. I am trying now Linq 2 NHibernate but am not really getting
anywhere.
Maybe something like: "Select PersonId, AccountNo, AccountNickName From
PersonAccount Where (PersonId = '11' and AccountNo = '10001111') or (PersonId =
'22' and AccountNo = '10001150')
Cheers.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/nhusers/-/ERtWolNz594J.
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/nhusers?hl=en.