You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is a problem, that I've got starting from my previous question. I have two types with two properties - "Guid" and "Guid?". And trying to Join em.
In a Join method you call DynamicQueryableExtensions.CheckOuterAndInnerTypes() method, that must check and convert not-a-nullable part to Nullable if needed.
But in fact after parsing Lambda, Method outterLambda.Body.Type returns Anonymous type. That is always not-a-nullable one.
When using a normal LINQ query, you need to cast to nullable Guid, else it won't compile.
Like:
varquery=peopleQuery.Join(petsQuery, people =>new{firstKey=(Guid?)people.Id}, pet =>new{firstKey=pet.OwnerId},(inner,outer)=>new{pet=inner,person=outer}).Select(res =>new{personName=res.person.Name,petName=res.pet.Name});
In dynamic LINQ, you need to do the same:
vardynamicQuery2=dynamicPeopleQuery2.Join(dynamicPetsQuery2,"new (Guid?(Id) as firstKey)","new (OwnerId as firstKey)","new (inner as pet, outer as person)").Select("new (person.Name as personName, pet.Name as petName)");
There is no automatic code which can try to make two dynamic objects the same, you have to define what you want.
Here is a problem, that I've got starting from my previous question. I have two types with two properties - "Guid" and "Guid?". And trying to Join em.
In a Join method you call DynamicQueryableExtensions.CheckOuterAndInnerTypes() method, that must check and convert not-a-nullable part to Nullable if needed.
But in fact after parsing Lambda, Method outterLambda.Body.Type returns Anonymous type. That is always not-a-nullable one.
Type example: {Name = "<>f__AnonymousType276
1" FullName = "<>f__AnonymousType276
1[[System.Nullable`1[[System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"}And so your library see that there is two different and not-nullable object. I'll try to make a demo project for you.
Nullable-Demo.zip
The text was updated successfully, but these errors were encountered: