Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/336.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.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# 为什么要写这么多显式连接? var query = (from v in _entities.vehicles join o in _entities.owners _C#_Linq_Entity Framework_Left Join - Fatal编程技术网

C# 为什么要写这么多显式连接? var query = (from v in _entities.vehicles join o in _entities.owners

C# 为什么要写这么多显式连接? var query = (from v in _entities.vehicles join o in _entities.owners ,c#,linq,entity-framework,left-join,C#,Linq,Entity Framework,Left Join,为什么要写这么多显式连接? var query = (from v in _entities.vehicles join o in _entities.owners on v.OwnerID equals o.OwnerID // Some more inner joins select new

为什么要写这么多显式连接?
var query = (from v in _entities.vehicles

                 join o
                    in _entities.owners
                    on v.OwnerID equals o.OwnerID

                 // Some more inner joins

                 select new
                 {
                     // <code snipped >
                     // o. fields and v. fields
                     // </ code snipped>

                     feature1 = (from feature1
                                     in _entities.vehiclefeatures
                                     .Where ( f_1 => f_1.VehicleID == v.VehicleID)
                                 join feature1_fo
                                     in _entities.featureoptions
                                 on feature1.FeatureOptionID equals feature1_fo.FeatureOptionID
                                 join feature1_f
                                     in _entities.features
                                     .Where (bt_f => bt_f.CodeEnum==1)
                                 on feature1_fo.FeatureID equals feature1_f.FeatureID
                                 select new featureoptionsDTO () { Option = feature1_fo.Option }
                               ),
                      feature2 = (from feature2
                                         in _entities.vehiclefeatures
                                         .Where(f_2 => f_2.VehicleID == v.VehicleID)
                                      join feature2_fo
                                         in _entities.featureoptions
                                      on feature2.FeatureOptionID equals feature2_fo.FeatureOptionID
                                      join feature2_f
                                          in _entities.features
                                         .Where(feature2_f => feature2_f.CodeEnum == 2)
                                      on feature2_fo.FeatureID equals feature2_f.FeatureID
                                      select new featureoptionsDTO() { Option = feature2_fo.Option }
                                 )
                 }
);

foreach (var vehicle in query)  // Exception here
{
}
feature1 = (from ..
feature2 = (from ..