I have two classes
Public class Foo
{
int Id {get;set;}
Email DefaultEmail {get;set;}
}
Public class Email
{
string main {get;set;}
string backup {get;set;}
string recover {get;set;}
}
Public string GetEmail(EnType)
{
switch(EnType)
{
Case EnType.Type1:
return this.main;
// others condition....
}
}
I map Foo to Email using component map. Each time only one email is required.
when I select
Session.Query.select(x => x.email.getEmail(EnType.Type1))
SQL generated is
select emailType1, emailType2,.... From Foo
while I expect only
select emailType1 From Foo