public abstract class EntityBase : Entity
    {  
        [Field,Key]
        public Guid Id { get; private set; }
    }

[HierarchyRoot]
    public class Control : EntityBase
    {
        public Control(Guid id) : base(id)
        {
        }

        [Field,Association(PairTo = "Owner")]
        public EntitySet<ControlMessage> Messages { get; private set; }
    }
[HierarchyRoot]
    public class ControlMessage : TablePartBase<Control>
    {
        public ControlMessage(Guid id) : base(id)
        {
        }
    }

var ids = new[] { new Guid("EA00DFEE-1A1A-4D66-B1F3-636C9985A149"), new Guid("302D3FB2-38D6-B73E-B52F-B6039CE41F47") };

var items = Query.All<Control>().Where(a => ids.ContainsAny(a.Messages.Select(b => b.Id)));

Using this code gives me > Internal error: 'Xtensive.Storage.Linq.Expressions.Visitors.PersistentExpressionVisitor' does not support 'Xtensive.Storage.Linq.Expressions.ProjectionExpression'. Is there any other way to get the same result?


Updated at 24.03.2010 6:51:59

var items = Query.All<Control>().Where(a => a.Messages.Any(b => ids.Contains(b.Id)));
var items = Query.All<Control>().Where(a => a.Messages.Any(b => b.Id.In(ids)));

Any of the above methods gives me:

Type 'System.Guid' does not has any public readable properties or fields, so it can't be persisted to storage.


Updated at 24.03.2010 7:29:54

Moreover, this code does not work also:

var ids = new[] { new Guid("EA00DFEE-1A1A-4D66-B1F3-636C9985A149"), new Guid("302D3FB2-38D6-B73E-B52F-B6039CE41F47") };
var items = Query.All<ControlMessage>().Where(cm => ids.Contains(cm.Id));
var items2 = Query.All<ControlMessage>().Where(cm => cm.Id.In(ids));

[InvalidOperationException: Type 'System.Guid' does not has any public readable properties or fields, so it can't be persisted to storage.] Xtensive.Storage.Linq.ItemToTupleConverter1.BuildLocalCollectionExpression(Type type, ISet1 processedTypes, Int32& columnIndex, MemberInfo parentMember, IEnumerable1& types) +795 Xtensive.Storage.Linq.ItemToTupleConverter1.BuildConverter() +186 Xtensive.Storage.Linq.ItemToTupleConverter1..ctor(Func1 enumerableFunc, DomainModel model, Expression sourceExpression) +41 [TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType) +0 System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType) +15 System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +249 Xtensive.Storage.Linq.ItemToTupleConverter.BuildConverter(Type type, Object enumerable, DomainModel model, Expression sourceExpression) +161 Xtensive.Storage.Linq.Translator.CreateLocalCollectionProjectionExpression(Type itemType, Object value, Translator translator, Expression sourceExpression) +59 Xtensive.Storage.Linq.Translator.VisitLocalCollectionSequence(Expression sequence) +135 [TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0 System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +71 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +261 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29 Xtensive.Storage.Linq.Translator.VisitSequence(Expression sequenceExpression, Expression expressionPart) +535 Xtensive.Storage.Linq.Translator.VisitExists(Expression source, LambdaExpression predicate, Boolean notExists) +139 Xtensive.Storage.Linq.Translator.VisitContains(Expression source, Expression match, Boolean isRoot) +155 Xtensive.Storage.Linq.Translator.VisitQueryableMethod(MethodCallExpression mc, QueryableMethodKind methodKind) +1353 Xtensive.Core.Linq.QueryableVisitor.VisitMethodCall(MethodCallExpression mc) +262 Xtensive.Storage.Linq.Translator.VisitMethodCall(MethodCallExpression mc) +1198 Xtensive.Core.Linq.ExpressionVisitor1.Visit(Expression e) +398 Xtensive.Storage.Linq.Translator.Visit(Expression e) +146 Xtensive.Storage.Linq.Translator.VisitLambda(LambdaExpression le) +59 Xtensive.Storage.Linq.Translator.VisitWhere(Expression expression, LambdaExpression le) +217 Xtensive.Storage.Linq.Translator.VisitQueryableMethod(MethodCallExpression mc, QueryableMethodKind methodKind) +4757 Xtensive.Core.Linq.QueryableVisitor.VisitMethodCall(MethodCallExpression mc) +262 Xtensive.Storage.Linq.Translator.VisitMethodCall(MethodCallExpression mc) +1198 Xtensive.Core.Linq.ExpressionVisitor1.Visit(Expression e) +398 Xtensive.Storage.Linq.Translator.Visit(Expression e) +146 Xtensive.Storage.Linq.Translator.Translate() +22 Xtensive.Storage.Linq.QueryProvider.Translate(Expression expression) +122 [TranslationException: Unable to translate 'Query.All().Where(cm => @.ids.Contains(cm.Id))' expression. See inner exception for details.] Xtensive.Storage.Linq.QueryProvider.Translate(Expression expression) +193 Xtensive.Storage.Linq.QueryProvider.Execute(Expression expression) +49 Xtensive.Storage.Linq.Queryable1.GetEnumerator() +79 System.Collections.Generic.List1..ctor(IEnumerable1 collection) +7667878 System.Linq.Enumerable.ToList(IEnumerable1 source) +61 Web.Tester._Default.Page_Load(Object sender, EventArgs e) in D:\Home\Docs\Visual Studio 2008\Projects\Platform\Web.Tester\Default.aspx.cs:65 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive() +50 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

This thread was imported from our support forum. The original discussion may contain more detailed answer.

asked Mar 23 '10 at 15:47

xumix's gravatar image

xumix
425757682


One Answer:

AlexGX wrote:

Hello. We will investigate this problem ASAP. For now try to use "In" extension method. Something like this:

var items = Query.All<Control>().Where(a => a.Messages.Any(b => b.Id.In(ids)));

Alex Gamzov X-tensive

answered Mar 23 '10 at 21:14

Editor's gravatar image

Editor
46156156157

We're fixing the issue.

(Mar 23 '10 at 21:14) Alex Yakunin Alex%20Yakunin's gravatar image

AlexGX wrote: The issue has been fixed. Bugfix will be available in the next nightly build. Please try it and let us know if it doesn't help.

Thank you for your help and patience.

Alex Gamzov X-tensive

(Mar 23 '10 at 21:14) Editor Editor's gravatar image

Отлично, спасибо:)

(Mar 23 '10 at 21:14) xumix xumix'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

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×574

Asked: Mar 23 '10 at 15:47

Seen: 2,360 times

Last updated: Mar 23 '10 at 15:47

powered by OSQA