Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collection serialization expression 'contains' #56

Closed
mc-ren opened this issue Aug 26, 2015 · 1 comment
Closed

Collection serialization expression 'contains' #56

mc-ren opened this issue Aug 26, 2015 · 1 comment

Comments

@mc-ren
Copy link

mc-ren commented Aug 26, 2015

So unless I am doing something wrong, this looks like it's the same issue assafw is seeing (#53 below). I have the following:

            var enterpriseKeys = new List<long?> { 1, 2, 3, 4 };

            var predicatePart =
                (Expression<Func<GroupEntity, bool>>)
                (groupType =>
                 enterpriseKeys.Contains(groupType.GroupEnterpriseKey));

            var serializeTo = new ExpressionSerializer(new XmlSerializer());
            var predicatePartSerializedToString = serializeTo.SerializeText(predicatePart);

I get the error as follows:

Error converting type: Type 'System.Collections.Generic.List1[[System.Nullable1[[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' with data contract name 'ArrayOfNullableOflong:http://schemas.datacontract.org/2004/07/System' is not expected.

Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.

esskar pushed a commit that referenced this issue Aug 27, 2015
esskar pushed a commit that referenced this issue Aug 27, 2015
@esskar
Copy link
Owner

esskar commented Aug 27, 2015

Thanks for that. I fixed it. See Unit Test for your Issue: https://github.com/esskar/Serialize.Linq/blob/master/src/Serialize.Linq.Tests/Issues/Issue56.cs

@esskar esskar closed this as completed Aug 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants