2017-01-05 5 views
0

에 SQL 쿼리 (UnionAggregate를) 변환하는 방법 나는 그것의 LINQ 엔티티 버전에서 다음 SQL 쿼리를 변환 하시겠습니까 : Collection.Concat에서 제공하는 모든 기능 LINQ 조합에서LINQ는 - LINQ

select 
geometry::UnionAggregate(geometries.GeometryBounds) 
from 
(select 
    GeometryBounds 
    from 
    Province where id in (1, 2) 
    union all 
    select 
    GeometryBounds 
    from 
    Region where id in (1, 2) 
    union all 
    select 
    GeometryBounds 
    from 
    Country where id in (1, 2) 
) as geometries 
+0

http://stackoverflow.com/questions/8394111/how-to-convert-sql-query-with-unions-to-linq – FakeisMe

+0

참조 MSDN : https://code.msdn.microsoft.com/101-LINQ-Samples-3fb9811b – jdweng

+0

@FakeisMe 내가하려는 것은 SqlGeometries의 UnionAggregate가 원시 조합이 아니라 고맙습니다. – antobonfiglio

답변

0

() 메소드를 호출합니다.

var ID = new[] {1, 2}; 

var query = (youContext.Province 
      .Select(x => x.GeometryBounds)) 
      .Concat 
      (youContext.Region 
      .Select(x => x.GeometryBounds)) 
      .Concat 
      (youContext.Country 
      .Select(x => x.GeometryBounds));