Collection view source and filtering data.

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
Massimiliano.Modena
Posts: 1
Joined: Wed 03 Dec 2014 13:29

Collection view source and filtering data.

Post by Massimiliano.Modena » Wed 03 Dec 2014 13:47

Hi.
I'm using MySqlConnect with LinqToSql.
I'm replacing all old entities in my software with the DevArt version.
I've a little problem.
I'm using Wpf datagrid with a Extension for filtering data. This extension use ColelctionView filter method for filtering data. If I apply filter, it thrown an System Not Supported exception.
ICollectionView is the default object for interacting with wpf object.
It's my error or it's a bug?
Little example:

Code: Select all

 MessaggeDataContext ctx = new MessaggeDataContext ();

[...]
 ICollectionView view = CollectionViewSource.GetDefaultView(ctx.Table);
// here the error will spawn. 
      view.Filter = item =>
      {
        
        return true;

      };
There's better method to filtering data without re-write all my application?

edit:
Also using DataAdapter and DataSet I've same error

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Collection view source and filtering data.

Post by MariiaI » Thu 04 Dec 2014 12:12

Please refer to this article:
http://msdn.microsoft.com/en-us/library ... 10%29.aspx
Simpler implementations do not support filtering and throw a NotSupportedException. Use the CanFilter property to test if filtering is supported before assigning this property with a non-null value.

To solve the issue you can try using this code:

Code: Select all

[...]
var list = ctx.Table.ToList();
ICollectionView view = CollectionViewSource.GetDefaultView(list);
[...]
Please tell us if this helps.

xam8re
Posts: 2
Joined: Mon 03 Nov 2014 07:33

Re: Collection view source and filtering data.

Post by xam8re » Tue 09 Dec 2014 14:18

MariiaI wrote:Please refer to this article:
http://msdn.microsoft.com/en-us/library ... 10%29.aspx
Simpler implementations do not support filtering and throw a NotSupportedException. Use the CanFilter property to test if filtering is supported before assigning this property with a non-null value.

To solve the issue you can try using this code:

Code: Select all

[...]
var list = ctx.Table.ToList();
ICollectionView view = CollectionViewSource.GetDefaultView(list);
[...]
Please tell us if this helps.
Yes, with ToList(), work fine. But with ToList() i'll loose virtualization engine.

I'd tryed also with DataSet and DataAdapter and i'd get same error.
If I switch to Default MySql connector, it work fine.

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Collection view source and filtering data.

Post by MariiaI » Thu 11 Dec 2014 06:36

Thank you for the response. Most likely, the issue is no related to dotConnect for MySQL/LinqConnect (please see the link we've posted above). However, we will investigate this behaviour more clearly and inform you about the results as soon any are available.

xam8re
Posts: 2
Joined: Mon 03 Nov 2014 07:33

Re: Collection view source and filtering data.

Post by xam8re » Tue 27 Jan 2015 10:45

MariiaI wrote:Thank you for the response. Most likely, the issue is no related to dotConnect for MySQL/LinqConnect (please see the link we've posted above). However, we will investigate this behaviour more clearly and inform you about the results as soon any are available.
Any news?
It's strictly relate to dotConnect.

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Collection view source and filtering data.

Post by MariiaI » Thu 29 Jan 2015 12:01

The investigation is in progress.
This extension use ColelctionView filter method for filtering data. If I apply filter, it thrown an System Not Supported exception.
...
I'd tryed also with DataSet and DataAdapter and i'd get same error.
Please send us your test project that reproduces this behaviour. This will significantly speed up the process of finding the solution for you. Please also send us a working example with MySqlConnector.

Post Reply