-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathQueryExtensions.cs
More file actions
31 lines (29 loc) · 1.14 KB
/
QueryExtensions.cs
File metadata and controls
31 lines (29 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright (C) 2003-2010 Xtensive LLC.
// All rights reserved.
// For conditions of distribution and use, see license.
// Created by: Dmitri Maximov
// Created: 2009.12.16
using Xtensive.Orm;
namespace Xtensive.Orm.Localization
{
/// <summary>
/// Query root for localizable and localization entities.
/// </summary>
public static class QueryExtensions
{
/// <summary>
/// Starting point for every query for localizable entities.
/// </summary>
/// <typeparam name="TTarget">The type of the target.</typeparam>
/// <typeparam name="TLocalization">The type of the localization.</typeparam>
/// <returns></returns>
public static IQueryable<LocalizationPair<TTarget, TLocalization>> All<TTarget, TLocalization>(this QueryEndpoint query) where TTarget: Entity where TLocalization: Localization<TTarget>
{
return from target in query.All<TTarget>()
join localization in query.All<TLocalization>()
on target equals localization.Target
where localization.CultureName==LocalizationContext.Current.CultureName
select new LocalizationPair<TTarget, TLocalization>(target, localization);
}
}
}