sql - filter data with entity framework -
i'm trying right data
rooms table
id | name 1 room1 2 room2
resources table
id | name 1 resource1 2 resource2 3 resource3
roomresources table
id | roomid | resourceid 1 1 1 2 1 2 3 1 3 4 2 2 5 2 3
i want select room resource1 , resource2 i'm using code
int[] ids = sresources.split(',').select(s => int.parse(s)).toarray(); rooms = r in context.rooms r.area.office.id == officeid && r.maximumpeople >= numberofpeople && r.roomresources.any(s => ids.contains(s.resourceid)) select r;
but homecoming room1 , room2 , result should room1
i appreciate help, thanks
maybe this?
int[] ids = sresources.split(',').select(s => int.parse(s)).toarray(); rooms = r in context.rooms r.area.office.id == officeid && r.maximumpeople >= numberofpeople && ids.all(i => r.roomresources.any(s => s.resourceid == i)) // seek here select r;
sql linq entity-framework model-view-controller entity-framework-6
No comments:
Post a Comment