Is it possible to do this in NHibernate without using CreateSQLQuery. Preferably with Linq To Nhibernate. The biggest question is how do I do joins not on a primary key?
SELECT DISTINCT calEvent.* From CalendarEvent as calEvent
LEFT JOIN UserChannelInteraction as channelInteraction on channelInteraction.ChannelToFollow_id = calEvent.Channel_id
LEFT JOIN UserCalendarEventInteraction as eventInteraction on eventInteraction.CalendarEvent_id = calEvent.Id
LEFT JOIN UserChannelInteraction as eventInteractionEvent on eventInteractionEvent.UserToFollow_id = eventInteraction.User_id
WHERE (calEvent.Channel_id = @intMainChannelID
OR channelInteraction.User_id = @intUserID
OR eventInteraction.User_id = @intUserID
OR (eventInteractionEvent.User_id = @intUserID AND eventInteraction.Status = 'Accepted'))
AND calEvent.StartDateTime >= @dtStartDate
AND calEvent.StartDateTime <= @dtEndDate
ORDER BY calEvent.StartDateTime asc