Skip to content

Localization extension - complex entity class hierarchies and projection to custom types #100

Closed
@beercsaba

Description

@beercsaba

Projection to custom types does not work (throws exception) when model uses complex class hierarchy with abstract properties.

From ProjectionToCustomTypesTests.ComplexClassHierarchyTest() method:
session.Query.All<BuiltinMessage>().OrderBy(e => e.Identifier).Select(e => new { e.Identifier, e.Name, e.Enabled, e.Description })

throws this exception:
Xtensive.Orm.QueryTranslationException : Unable to translate 'Query.All().OrderBy(e => e.Identifier).Select(e => new @<Identifier, Name, Enabled, Description>(
e.Identifier,
e.Name,
e.Enabled,
e.Description
))' expression. See inner exception for details.
----> System.NotSupportedException : Field 'e.Name' must be persistent (marked by [Field] attribute).
Stack Trace:
QueryProvider.Translate(Expression expression, CompilerConfiguration compilerConfiguration) line 166
QueryProvider.Translate(Expression expression) line 155
QueryProvider.Execute[TResult](Expression expression, Func4 runQuery) line 97 QueryProvider.ExecuteSequence[T](Expression expression) line 90 Queryable1.GetEnumerator() line 39
List1.ctor(IEnumerable1 collection)
Enumerable.ToList[TSource](IEnumerable1 source) ProjectionToCustomTypesTests.ComplexClassHierarchyTest() line 121 --NotSupportedException Translator.VisitMemberAccess(MemberExpression ma) line 315 ExpressionVisitor1.Visit(Expression e) line 103
Translator.Visit(Expression e) line 87
Translator.VisitNewExpressionArguments(NewExpression n) line 150
Translator.VisitNew(NewExpression newExpression) line 595
ExpressionVisitor1.Visit(Expression e) line 112 Translator.Visit(Expression e) line 87 Translator.VisitLambda(LambdaExpression le) line 132 Translator.BuildProjection(LambdaExpression le) line 1337 Translator.VisitSelect(Expression expression, LambdaExpression le) line 1329 Translator.VisitQueryableMethod(MethodCallExpression mc, QueryableMethodKind methodKind) line 164 QueryableVisitor.VisitMethodCall(MethodCallExpression mc) line 33 Translator.VisitMethodCall(MethodCallExpression mc) line 444 ExpressionVisitor1.Visit(Expression e) line 106
Translator.Visit(Expression e) line 87
Translator.Translate() line 32
QueryProvider.Translate(Expression expression, CompilerConfiguration compilerConfiguration) line 163

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions