Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/340.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在LINQ-SQL中进行此查询?_C#_Asp.net_Sql_Linq - Fatal编程技术网

C# 在LINQ-SQL中进行此查询?

C# 在LINQ-SQL中进行此查询?,c#,asp.net,sql,linq,C#,Asp.net,Sql,Linq,我有员工,组,以及员工组过滤器 Employee具有具有外键关系的GroupID EmployeeGroupFilter具有员工和组ID。每个员工都可以筛选他们不希望在日历中看到的组 因此,如果存在EmployeeGroupFilter,该员工将看不到该组 我需要一个查询,该查询将返回组的IEnumerable,该组将是员工可见的组 例如:从组中选择所有,其中组不在currentEmployee的组筛选器中 现在,我可以像这样获取所有员工筛选器: public static IEnumerabl

我有
员工
,以及
员工组过滤器

Employee
具有具有外键关系的
GroupID

EmployeeGroupFilter
具有员工和组ID。每个员工都可以筛选他们不希望在日历中看到的组

因此,如果存在
EmployeeGroupFilter
,该员工将看不到该组

我需要一个查询,该查询将返回组的
IEnumerable
,该组将是员工可见的组

例如:从组中选择所有,其中组不在currentEmployee的组筛选器中

现在,我可以像这样获取所有员工筛选器:

public static IEnumerable<EmployeGroupFilter> GetAllByEmployee(
int employeeID)
{
    KezberPMDBDataContext db = new KezberPMDBDataContext();

    return from p in db.EmployeGroupFilters
           where p.EmployeID == employeeID
           select p;
}
公共静态IEnumerable GetAllByEmployee(
国际雇员ID)
{
KezberPMDBDataContext db=新的KezberPMDBDataContext();
从db.EmployeGroupFilters中的p返回
其中p.employeeID==employeeID
选择p;
}
我需要像这样的东西:

public static IEnumerable<Group> GetAllVisibleEmployeeGroups(
int employeeID)
{
    KezberPMDBDataContext db = new KezberPMDBDataContext();

    return from p in db.Groups
           .......
           select p;
}
公共静态IEnumerable GetAllVisibleMemployeeGroups(
国际雇员ID)
{
KezberPMDBDataContext db=新的KezberPMDBDataContext();
从数据库组中的p返回
.......
选择p;
}
return from p in db.Groups
where !p.EmployeGroupFilters.Any(fil=>fil.EmployeeId == employeeID)
           select p;