Hi guys,
this is the SQL query structurally which I need to implement with
nhibernate.
select u.UserAccountState, u.LogOnName, tc.Name from UserAccount u
right join TechnicalContributor tc on tc.UserAccountId = u.id
left join Contributor c on c.Id = tc.Id where (u.UserAccountState IS NULL
OR u.UserAccountState = 'Active');
The relation between TechnicalContributor and Contributor is 1:1.
So my code inside C# looks like the following:
UserAccount u = null;
Contributor c = null;
// ----- Prepare joined tables.
var query = conversation.QueryOver(() => u)
.JoinAlias(() => u.Contributor, () => c, JoinType.
RightOuterJoin);
if (filter.IsActive.HasValue && filter.IsActive.Value)
{
query.And(a => u.UserAccountState == UserAccountState.Active
|| u.UserAccountState == null);
}
So, compiling it : works.
Running it comes up with an ADO exception!
This should normally generate valid code...
Exception messages:
A first chance exception of type 'System.ArgumentNullException' occurred in
NHibernate.dll
A first chance exception of type 'System.ArgumentNullException' occurred in
NHibernate.dll
A first chance exception of type 'NHibernate.Exceptions.GenericADOException'
occurred in NHibernate.dll
A first chance exception of type 'NHibernate.Exceptions.GenericADOException'
occurred in NHibernate.dll
A first chance exception of type 'NHibernate.Exceptions.GenericADOException'
occurred in Consultinform.Pacc4Web.WebClient.dll
A first chance exception of type
'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
A first chance exception of type
'System.Configuration.ConfigurationErrorsException' occurred in
Consultinform.Pacc4Web.UIFramework.dll
A first chance exception of type 'NHibernate.QueryException' occurred in
NHibernate.dll
Did anyone spot such an issue?
Or better: Is there a solution for this already present?
Many thanks for helping!
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.