Mapping a date to a date range
Hi,
Wonder if this is possible and if can help;
public class ClassA
{
long Id
DateTime FirstDay
DateTime LastDay
...
}
public class ClassB
{
DateTime ADate
ClassA A
...
}
class ClassAMap
{
CompositeId()
.KeyProperty(x => x.Id, "ID")
.KeyProperty(x => x.FirstDay, "FIRST_DAY")
.KeyProperty(x => x.LastDay, "LAST_DAY");
...
}
The key of ClassB includes ADate and A (the reference to ClassA) but I need the resulting mapping to be such that ClassB.ADate between ClassA.FirstDay and ClassB.LastDay both in code and resulting SQL like;
from TableB b
inner join TableA a
on b.TableA_ID = a.ID and b.ADATE between a.FIRST_DAY and a.LAST_DAY
Hope you can help as i am running out of ideas!
Many Thanks