2

I have already written Hbn & code to fetch the users from db.

with following info

userid, name,email,phone

now we have new requirement in which new table has been created with following fields

Table 1

  • userid -- foreign key to above user table
  • workinglocation
  • WorkingStatusId

table 2

  • WorkingStatusId
  • workingstatus

filter criteria is workinglocation and workingstatus

i can not change my existing code.

either i have to write new hbn file and write the code

or should i fetch the data using earlier created hbn and filter it

Please suggest me with the code using linq etc (if possible)

Techmaster
  • 1,032
  • 2
  • 12
  • 26

1 Answers1

2

either add a collection of Workplaces or whatever to the user and map it then it would be easy to query

from u in session.Query<User>()
from w in u.Workplaces
where ...
select u;

or filter with a correlated subquery after mapping Workplaces

Firo
  • 30,626
  • 4
  • 55
  • 94