Models.cs

namespace Project2
{
    using System.Linq.Expressions;

    using Xtensive.Core;
    using Xtensive.Linq;

    [Serializable]
    [HierarchyRoot]
    public abstract class FundBase : Entity
    {
        [Field, Key]
        public int Id { get; private set; }

        private static readonly Expression<Func<FundBase, JuridicalPerson>> VirtualJuridicalPersonExpression =
            obj =>
            (obj is MutualFund)
                ? (obj as MutualFund).ManagementCompany
                : (obj is MilitaryIpoteka)
                      ? (obj as MilitaryIpoteka).JuridicalPerson
                      : (obj is SelfRegulatoryOrganization)
                            ? (obj as SelfRegulatoryOrganization).Organization
                            : (obj is PrivatePensionFund)
                                  ? (obj as PrivatePensionFund).JuridicalPerson
                                  : (obj is ShareholderInvestmentFund)
                                        ? (obj as ShareholderInvestmentFund).JuridicalPerson
                                        : null;

        private static readonly Func<FundBase, JuridicalPerson> VirtualJuridicalPersoCompiled =
            VirtualJuridicalPersonExpression.Compile();

        public JuridicalPerson VirtualJuridicalPerson
        {
            get { return VirtualJuridicalPersoCompiled(this); }
        }

        [CompilerContainer(typeof(Expression))]
        public static class CustomLinqCompilerContainer
        {
            /// <summary>Необходим для использования виртуального поля</summary>
            /// <param name="assignmentExpression"> The assignment expression. </param>
            /// <returns>Выражение с привязанными параметрами</returns>
            [Compiler(typeof(FundBase), "VirtualJuridicalPerson", TargetKind.PropertyGet)]
            public static Expression Depositary(Expression assignmentExpression)
            {
                return VirtualJuridicalPersonExpression.BindParameters(assignmentExpression);
            }
        }
    }

    [Serializable]
    public class MutualFund : FundBase
    {
        /// <summary>
        /// Управляющая компания
        /// Управляющая компания фонда
        /// </summary>
        [Field(Nullable = false)]
        public JuridicalPerson ManagementCompany { get; set; }
    }

    [Serializable]
    public class MilitaryIpoteka : FundBase
    {
        [Field(Nullable = false)]
        public JuridicalPerson JuridicalPerson { get; set; }
    }

    [Serializable]
    public class SelfRegulatoryOrganization : FundBase
    {
        [Field(Nullable = false)]
        public JuridicalPerson Organization { get; set; }
    }
    [Serializable]
    public class PrivatePensionFund : FundBase
    {
        [Field(Nullable = false)]
        public JuridicalPerson JuridicalPerson { get; set; }
    }

    [Serializable]
    public class ShareholderInvestmentFund : FundBase
    {
        [Field(Nullable = false)]
        public JuridicalPerson JuridicalPerson { get; set; }
    }

    [Serializable]
    [HierarchyRoot]
    public partial class JuridicalPerson : Entity
    {
        [Field, Key]
        public int Id { get; private set; }

        [Field(Nullable = false, Length = 400)]
        public string FullName { get; set; }
    }
}

Test.cs

var config = DomainConfiguration.Load("Default");
var domain = Domain.Build(config);
using (var session = domain.OpenSession())
{
using (var transactionScope = session.OpenTransaction())
{
session.Query.All<FundBase>()
.Where(q => q.VirtualJuridicalPerson != null && q.VirtualJuridicalPerson.FullName != null && q.VirtualJuridicalPerson.FullName.StartsWith("qweqwe")).ToArray();
}
}

Output:

Xtensive.Orm.QueryTranslationException was unhandled
  Message=Unable to translate 'Query.All().Where(q => (((q.VirtualJuridicalPerson != null) && (q.VirtualJuridicalPerson.FullName != null)) && q.VirtualJuridicalPerson.FullName.StartsWith("qweqwe")))' expression. See inner exception for details.
  Source=Xtensive.Orm
  StackTrace:
       at Xtensive.Orm.Linq.QueryProvider.Translate[TResult](Expression expression) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\QueryProvider.cs:line 85
       at Xtensive.Orm.Linq.QueryProvider.Execute[TResult](Expression expression) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\QueryProvider.cs:line 69
       at Xtensive.Orm.Linq.Queryable`1.GetEnumerator() in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Queryable.cs:line 65
       at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
       at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
       at Project2.Program.Main(String[] args) in C:\Projects\Project1\Project2\Program.cs:line 22
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.NotSupportedException
       Message=Both left and right part of binary expression '(IIF((Field TypeId, [1 ... 1] == 104), EntityField ManagementCompany, [4 ... 1], IIF((Field TypeId, [1 ... 1] == 103), EntityField JuridicalPerson, [7 ... 1], IIF((Field TypeId, [1 ... 1] == 107), EntityField Organization, [10 ... 1], IIF((Field TypeId, [1 ... 1] == 106), EntityField JuridicalPerson, [13 ... 1], IIF((Field TypeId, [1 ... 1] == 108), EntityField JuridicalPerson, [16 ... 1], null))))) != null)' are NULL or not EntityExpression(EntityFieldExpression).
       Source=Xtensive.Orm
       StackTrace:
            at Xtensive.Orm.Linq.Translator.VisitBinaryRecursive(BinaryExpression binaryExpression, BinaryExpression originalBinaryExpression) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:line 567
            at Xtensive.Orm.Linq.Translator.VisitBinary(BinaryExpression binaryExpression) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:line 199
            at Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Core\Xtensive.Core\Linq\ExpressionVisitor{TResult}.cs:line 88
            at Xtensive.Orm.Linq.Translator.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:line 83
            at Xtensive.Orm.Linq.Translator.VisitBinary(BinaryExpression binaryExpression) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:line 184
            at Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Core\Xtensive.Core\Linq\ExpressionVisitor{TResult}.cs:line 88
            at Xtensive.Orm.Linq.Translator.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:line 83
            at Xtensive.Orm.Linq.Translator.VisitBinary(BinaryExpression binaryExpression) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:line 184
            at Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Core\Xtensive.Core\Linq\ExpressionVisitor{TResult}.cs:line 88
            at Xtensive.Orm.Linq.Translator.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:line 83
            at Xtensive.Orm.Linq.Translator.VisitLambda(LambdaExpression le) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:line 124
            at Xtensive.Orm.Linq.Translator.VisitWhere(Expression expression, LambdaExpression le) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Queryable.cs:line 1092
            at Xtensive.Orm.Linq.Translator.VisitQueryableMethod(MethodCallExpression mc, QueryableMethodKind methodKind) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Queryable.cs:line 227
            at Xtensive.Linq.QueryableVisitor.VisitMethodCall(MethodCallExpression mc) in d:\Home\dataobjects.net\Xtensive.Core\Xtensive.Core\Linq\QueryableVisitor.cs:line 34
            at Xtensive.Orm.Linq.Translator.VisitMethodCall(MethodCallExpression mc) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:line 370
            at Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Core\Xtensive.Core\Linq\ExpressionVisitor{TResult}.cs:line 106
            at Xtensive.Orm.Linq.Translator.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:line 83
            at Xtensive.Orm.Linq.Translator.Translate[TResult]() in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Materialization.cs:line 33
            at Xtensive.Orm.Linq.QueryProvider.Translate[TResult](Expression expression) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\QueryProvider.cs:line 80
       InnerException:

One more thing. In our production code we got this:

[NotSupportedException: Field 'flt.VirtualJuridicalPerson' must be persistent (marked by [Field] attribute).]
   Xtensive.Orm.Linq.Translator.VisitMemberAccess(MemberExpression ma) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:281
   Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Core\Xtensive.Core\Linq\ExpressionVisitor{TResult}.cs:103
   Xtensive.Orm.Linq.Translator.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:83
   Xtensive.Orm.Linq.Translator.VisitBinary(BinaryExpression binaryExpression) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:184
   Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Core\Xtensive.Core\Linq\ExpressionVisitor{TResult}.cs:88
   Xtensive.Orm.Linq.Translator.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:83
   Xtensive.Orm.Linq.Translator.VisitBinary(BinaryExpression binaryExpression) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:185
   Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Core\Xtensive.Core\Linq\ExpressionVisitor{TResult}.cs:88
   Xtensive.Orm.Linq.Translator.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:83
   Xtensive.Orm.Linq.Translator.VisitBinary(BinaryExpression binaryExpression) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:184
   Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Core\Xtensive.Core\Linq\ExpressionVisitor{TResult}.cs:88
   Xtensive.Orm.Linq.Translator.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:83
   Xtensive.Orm.Linq.Translator.VisitBinary(BinaryExpression binaryExpression) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:184
   Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Core\Xtensive.Core\Linq\ExpressionVisitor{TResult}.cs:88
   Xtensive.Orm.Linq.Translator.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:83
   Xtensive.Orm.Linq.Translator.VisitBinary(BinaryExpression binaryExpression) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:185
   Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Core\Xtensive.Core\Linq\ExpressionVisitor{TResult}.cs:88
   Xtensive.Orm.Linq.Translator.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:83
   Xtensive.Orm.Linq.Translator.VisitBinary(BinaryExpression binaryExpression) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:184
   Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Core\Xtensive.Core\Linq\ExpressionVisitor{TResult}.cs:88
   Xtensive.Orm.Linq.Translator.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:83
   Xtensive.Orm.Linq.Translator.VisitBinary(BinaryExpression binaryExpression) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:184
   Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Core\Xtensive.Core\Linq\ExpressionVisitor{TResult}.cs:88
   Xtensive.Orm.Linq.Translator.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:83
   Xtensive.Orm.Linq.Translator.VisitBinary(BinaryExpression binaryExpression) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:184
   Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Core\Xtensive.Core\Linq\ExpressionVisitor{TResult}.cs:88
   Xtensive.Orm.Linq.Translator.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:83
   Xtensive.Orm.Linq.Translator.VisitBinary(BinaryExpression binaryExpression) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:184
   Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Core\Xtensive.Core\Linq\ExpressionVisitor{TResult}.cs:88
   Xtensive.Orm.Linq.Translator.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:83
   Xtensive.Orm.Linq.Translator.VisitBinary(BinaryExpression binaryExpression) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:184
   Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Core\Xtensive.Core\Linq\ExpressionVisitor{TResult}.cs:88
   Xtensive.Orm.Linq.Translator.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:83
   Xtensive.Orm.Linq.Translator.VisitLambda(LambdaExpression le) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:124
   Xtensive.Orm.Linq.Translator.VisitWhere(Expression expression, LambdaExpression le) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Queryable.cs:1092
   Xtensive.Orm.Linq.Translator.VisitQueryableMethod(MethodCallExpression mc, QueryableMethodKind methodKind) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Queryable.cs:227
   Xtensive.Linq.QueryableVisitor.VisitMethodCall(MethodCallExpression mc) in d:\Home\dataobjects.net\Xtensive.Core\Xtensive.Core\Linq\QueryableVisitor.cs:34
   Xtensive.Orm.Linq.Translator.VisitMethodCall(MethodCallExpression mc) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:370
   Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Core\Xtensive.Core\Linq\ExpressionVisitor{TResult}.cs:106
   Xtensive.Orm.Linq.Translator.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:83
   Xtensive.Orm.Linq.Translator.VisitSequence(Expression sequenceExpression, Expression expressionPart) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Queryable.cs:1324
   Xtensive.Orm.Linq.Translator.VisitSequence(Expression sequenceExpression) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Queryable.cs:1288
   Xtensive.Orm.Linq.Translator.VisitOrderBy(Expression expression, LambdaExpression le, Direction direction) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Queryable.cs:823
   Xtensive.Orm.Linq.Translator.VisitQueryableMethod(MethodCallExpression mc, QueryableMethodKind methodKind) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Queryable.cs:180
   Xtensive.Linq.QueryableVisitor.VisitMethodCall(MethodCallExpression mc) in d:\Home\dataobjects.net\Xtensive.Core\Xtensive.Core\Linq\QueryableVisitor.cs:34
   Xtensive.Orm.Linq.Translator.VisitMethodCall(MethodCallExpression mc) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:370
   Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Core\Xtensive.Core\Linq\ExpressionVisitor{TResult}.cs:106
   Xtensive.Orm.Linq.Translator.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:83
   Xtensive.Orm.Linq.Translator.VisitSequence(Expression sequenceExpression, Expression expressionPart) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Queryable.cs:1324
   Xtensive.Orm.Linq.Translator.VisitSequence(Expression sequenceExpression) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Queryable.cs:1288
   Xtensive.Orm.Linq.Translator.VisitSkip(Expression source, Expression skip) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Queryable.cs:546
   Xtensive.Orm.Linq.Translator.VisitMethodCall(MethodCallExpression mc) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:342
   Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Core\Xtensive.Core\Linq\ExpressionVisitor{TResult}.cs:106
   Xtensive.Orm.Linq.Translator.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:83
   Xtensive.Orm.Linq.Translator.VisitSequence(Expression sequenceExpression, Expression expressionPart) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Queryable.cs:1324
   Xtensive.Orm.Linq.Translator.VisitSequence(Expression sequenceExpression) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Queryable.cs:1288
   Xtensive.Orm.Linq.Translator.VisitTake(Expression source, Expression take) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Queryable.cs:518
   Xtensive.Orm.Linq.Translator.VisitMethodCall(MethodCallExpression mc) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:340
   Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Core\Xtensive.Core\Linq\ExpressionVisitor{TResult}.cs:106
   Xtensive.Orm.Linq.Translator.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:83
   Xtensive.Orm.Linq.Translator.VisitSequence(Expression sequenceExpression, Expression expressionPart) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Queryable.cs:1324
   Xtensive.Orm.Linq.Translator.VisitSequence(Expression sequenceExpression) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Queryable.cs:1288
   Xtensive.Orm.Linq.Translator.VisitSelect(Expression expression, LambdaExpression le) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Queryable.cs:1050
   Xtensive.Orm.Linq.Translator.VisitQueryableMethod(MethodCallExpression mc, QueryableMethodKind methodKind) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Queryable.cs:185
   Xtensive.Linq.QueryableVisitor.VisitMethodCall(MethodCallExpression mc) in d:\Home\dataobjects.net\Xtensive.Core\Xtensive.Core\Linq\QueryableVisitor.cs:34
   Xtensive.Orm.Linq.Translator.VisitMethodCall(MethodCallExpression mc) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:370
   Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Core\Xtensive.Core\Linq\ExpressionVisitor{TResult}.cs:106
   Xtensive.Orm.Linq.Translator.Visit(Expression e) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Expressions.cs:83
   Xtensive.Orm.Linq.Translator.Translate() in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Translator.Materialization.cs:33
   Xtensive.Orm.Linq.QueryProvider.Translate(Expression expression) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\QueryProvider.cs:80

[QueryTranslationException: Unable to translate 'Query.All().Where(flt => ((((((((((((((((flt != null) && (flt.ForeignId != null)) && flt.ForeignId.Contains("уголь")) || (((flt != null) && (flt.Name != null)) && flt.Name.Contains("уголь"))) || (((flt != null) && (flt.ForeignName != null)) && flt.ForeignName.Contains("уголь"))) || (((flt != null) && (flt.RuleNumber != null)) && flt.RuleNumber.Contains("уголь"))) || (((flt != null) && (flt.RegistrationAuthority != null)) && flt.RegistrationAuthority.Contains("уголь"))) || (((flt != null) && (flt.FullName != null)) && flt.FullName.Contains("уголь"))) || (((flt != null) && (flt.ShortName != null)) && flt.ShortName.Contains("уголь"))) || ((((flt != null) && (flt.Currency != null)) && (flt.Currency.Name != null)) && flt.Currency.Name.Contains("уголь"))) || ((((flt != null) && (flt.VirtualJuridicalPerson != null)) && (flt.VirtualJuridicalPerson.FullName != null)) && flt.VirtualJuridicalPerson.FullName.Contains("уголь"))) || ((((flt != null) && (flt.FundCategory != null)) && (flt.FundCategory.Name != null)) && flt.FundCategory.Name.Contains("уголь"))) || ((((flt != null) && (flt.Status != null)) && (flt.Status.Name != null)) && flt.Status.Name.Contains("уголь"))) || ((((flt != null) && (flt.Country != null)) && (flt.Country.Name != null)) && flt.Country.Name.Contains("уголь"))) || ((((flt != null) && (flt.FundType != null)) && (flt.FundType.Name != null)) && flt.FundType.Name.Contains("уголь"))) || ((((flt != null) && (flt.ManagementCompany != null)) && (flt.ManagementCompany.FullName != null)) && flt.ManagementCompany.FullName.Contains("уголь")))).OrderBy( => .Name).Skip(() => $<ReadService<MutualFund>>(Werp.Controller.Services.GridReadService`1[Eis.Models.References.Funds.MutualFund]).Start).Take(() => $<ReadService<MutualFund>>(Werp.Controller.Services.GridReadService`1[Eis.Models.References.Funds.MutualFund]).Limit).Select( => new DynamicClass123() {
  Id = .Id,
  ForeignId = .ForeignId,
  Status = (((Object).Status) != null)
    ? .Status.Name
    : "",
  Name = .Name,
  SpecializedDepositoryClient = .SpecializedDepositoryClient,
  DepositoryClient = .DepositoryClient,
  Version = .Version.Ticks.ToString(),
  Revision = .Revision,
  FundType = (((Object).FundType) != null)
    ? .FundType.Name
    : "",
  FundCategory = (((Object).FundCategory) != null)
    ? .FundCategory.Name
    : "",
  FullName = .FullName,
  ShortName = .ShortName,
  ForeignName = .ForeignName,
  Cost = .Cost,
  Currency = (((Object).Currency) != null)
    ? .Currency.Name
    : "",
  ManagementCompany = (((Object).ManagementCompany) != null)
    ? .ManagementCompany.FullName
    : "",
  RuleNumber = .RuleNumber,
  RuleDate = .RuleDate,
  RegistrationAuthority = .RegistrationAuthority,
  Country = (((Object).Country) != null)
    ? .Country.Name
    : "",
  VirtualJuridicalPerson = .VirtualJuridicalPerson,
  MetaData = new DynamicClass2() {
    Style = .Status.Style.SysName
  }
})' expression. See inner exception for details.]
   Xtensive.Orm.Linq.QueryProvider.Translate(Expression expression) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\QueryProvider.cs:85
   Xtensive.Orm.Linq.QueryProvider.Execute(Expression expression) in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\QueryProvider.cs:69
   Xtensive.Orm.Linq.Queryable`1.GetEnumerator() in d:\Home\dataobjects.net\Xtensive.Orm\Xtensive.Orm\Orm\Linq\Queryable.cs:65
   System.Linq.Buffer`1..ctor(IEnumerable`1 source) +267
   System.Linq.Enumerable.ToArray(IEnumerable`1 source) +104
   Werp.Controller.Services.GridReadService`1.GetData() in d:\BuildAgents\2\work\f27cc1092d3e1cc2\Werp.Controller.Services\GridReadService.cs:68
   Werp.Controller.Services.GridReadService`1.GetObject() in d:\BuildAgents\2\work\f27cc1092d3e1cc2\Werp.Controller.Services\GridReadService.cs:96
   Werp.View.Ext.Handlers.ReadHandler.ProcessRequest(HttpContext context) in d:\BuildAgents\2\work\f27cc1092d3e1cc2\Werp.View.Ext\Handlers\ReadHandler.ashx.cs:167
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +597
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +266

asked Apr 20 '11 at 10:43

xumix's gravatar image

xumix
425727682

edited Apr 20 '11 at 11:06

Thanks for the complete test case. Will check.

(Apr 20 '11 at 10:51) Dmitri Maximov Dmitri%20Maximov's gravatar image

Good. I've added one more exception for you :)

(Apr 20 '11 at 11:06) xumix xumix's gravatar image

Very kind of you, though =)

(Apr 20 '11 at 11:07) Dmitri Maximov Dmitri%20Maximov's gravatar image

One Answer:

Fixed in revision 7588, the binaries are available on the website.

answered Jun 06 '11 at 07:34

Dmitri%20Maximov's gravatar image

Dmitri Maximov
22111211

Not really fixed, the last exception still exists. I've sent you an example.

(Jun 08 '11 at 08:12) xumix xumix's gravatar image

OK, will check.

(Jun 08 '11 at 08:14) Dmitri Maximov Dmitri%20Maximov's gravatar image

fixed now? :)

(Jun 10 '11 at 02:55) xumix xumix's gravatar image

fixed now? :)

(Jun 10 '11 at 02:55) xumix xumix's gravatar image

It's you, who decide whether it is fixed or not =)

(Jun 10 '11 at 03:09) Dmitri Maximov Dmitri%20Maximov's gravatar image

Well, I just cant see fix revision to point it. But its fixed with your assembly

(Jun 10 '11 at 03:35) xumix xumix's gravatar image

Actually, I'm in the process of committing and pushing the changes, so the info you are looking for is being prepared.

(Jun 10 '11 at 03:37) Dmitri Maximov Dmitri%20Maximov's gravatar image

Looks like the revision 7591 is the one you wanted.

(Jun 10 '11 at 06:53) Dmitri Maximov Dmitri%20Maximov's gravatar image

Sweet, works now

(Jun 10 '11 at 07:12) xumix xumix's gravatar image

High quality support in action, man! =)

(Jun 10 '11 at 07:14) Dmitri Maximov Dmitri%20Maximov's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA