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# 使用Linq查询和EntityFrameworkCore 2.2返回动态字段_C#_Linq_Entity Framework Core - Fatal编程技术网

C# 使用Linq查询和EntityFrameworkCore 2.2返回动态字段

C# 使用Linq查询和EntityFrameworkCore 2.2返回动态字段,c#,linq,entity-framework-core,C#,Linq,Entity Framework Core,我有以下POCO public class Trader : AuditableEntity { public string Name { get; set; } public string Telephone { get; set; } public string Email { get; set; } public string Website { get; set; } public List<Addre

我有以下POCO

public class Trader : AuditableEntity
{
        public string Name { get; set; }
        public string Telephone { get; set; }
        public string Email { get; set; }
        public string Website { get; set; }
        public List<Address> Addresses { get; set; }
}

public class Address : AuditableEntity
{
    public Trader Trader { get; set; }
    /* reduce for brevity*/

    public decimal Latitude { get; set; }
    public decimal Longitude { get; set; }
    public IPoint Location { get; set; }
}
在迁移到
EntityFrameworkCore
2.2之前,将使用存储过程。在存储过程中,我可以动态返回交易者lat long与传入lat long的距离以及返回数据

Distance = (@GEO1.STDistance(geography::Point(ISNULL(Latitude,0.000000),ISNULL(Longitude,0.000000), 4326)))
我是否可以使用linq动态地定位和选择距离,方法与存储过程相同,并有效地将其添加到返回中

Distance = (@GEO1.STDistance(geography::Point(ISNULL(Latitude,0.000000),ISNULL(Longitude,0.000000), 4326)))