Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.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
Entity framework core 如果复合键中的一个字段可为空,如何使Linq Join工作?_Entity Framework Core_Left Join_Linq To Entities - Fatal编程技术网

Entity framework core 如果复合键中的一个字段可为空,如何使Linq Join工作?

Entity framework core 如果复合键中的一个字段可为空,如何使Linq Join工作?,entity-framework-core,left-join,linq-to-entities,Entity Framework Core,Left Join,Linq To Entities,LicenceTypeId是一个可为空的字段-这就是为什么如果使用复合键,则无法编译以下代码-仅对简单键可以: 如果我使用这样的东西-x1=license.licenseTypeId??:0-它被转换为在SQL中合并,这是我希望避免的。我需要一个由3个字段直接左连接 var licences = from licence in DbSet join licenceType in DbContext.LicenceTypes

LicenceTypeId是一个可为空的字段-这就是为什么如果使用复合键,则无法编译以下代码-仅对简单键可以:

如果我使用这样的东西-
x1=license.licenseTypeId??:0
-它被转换为在SQL中合并,这是我希望避免的。我需要一个由3个字段直接左连接

        var licences =
            from licence in DbSet
            join licenceType in DbContext.LicenceTypes
                on new { x1 = licence.LicenceTypeId, x2 = currentLanguageCode, x3 = CentralToolsFieldTypes.LICENCE }
                equals new { x1 = licenceType.NumberValue, x2 = licenceType.LanguageCode, x3 = licenceType.CodeName } into licenceTypes
            from licenceType in licenceTypes.DefaultIfEmpty()
            select new { licence, licenceType };