EntityCollection does not contain a definition for 'SupportsSorting'

Posts   
 
    
sbalaji123
User
Posts: 26
Joined: 13-Oct-2006
# Posted on: 16-Oct-2006 14:26:45   

Hi, I am using LLBLGen2.0.My desinger is havinh selfservicetwoclasses.Software ASP.NET2.0,SQLServer2005 and VStudio2005.When i migrate from 1.0 to 2.0 then i got lots of conversion error in my projests. For ex: EntityCollection does not contain a definition for 'SupportsSorting'

How can i go about this?

Thanks in advance, Balaji

Jessynoo avatar
Jessynoo
Support Team
Posts: 296
Joined: 19-Aug-2004
# Posted on: 16-Oct-2006 16:34:39   

Hi,

did you try regenerating?

propably most of your errors come from the old generated code rather than from you own.

When done with regenerating using the new designer, you should have much less errors to deal with.

With those, you have to apply the modifications by hand. You can refer to the "Migrating your code" section from the manual for some advices.

Cheers

sbalaji123
User
Posts: 26
Joined: 13-Oct-2006
# Posted on: 16-Oct-2006 16:42:00   

The error is EntityCollection does not contain a definition for 'SupportsSorting' . Please help me how to solve this?

Jessynoo avatar
Jessynoo
Support Team
Posts: 296
Joined: 19-Aug-2004
# Posted on: 16-Oct-2006 17:25:03   

can you post your code?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 16-Oct-2006 17:36:45   

It doesn't support this property because that property is part of the IBindingList interface, which is now implemented by the EntityView2 class, not by the collection anymore. You should bind to the EntityView2 returned by the DefaultView property of EntityCollection instead, which does support this property

Frans Bouma | Lead developer LLBLGen Pro
Posts: 20
Joined: 02-Apr-2004
# Posted on: 10-Jul-2008 05:49:31   

I'm getting the same problem. But Otis' suggested solution will not work in this case. IBindingList has a SupportsSorting property. But it is read-only. I need to be able to update it, or at least the code I am converting updates it. DefaultView returns an EntityView<TEntity>, not an Entity2. EntityView<TEntity> does not have a SupportsSorting property.

I think the discrepancy has something to do with the fact that I have just upgraded the project to generate .NET 2.0 code. Previously I had used LLBLGen Pro 2.5 to generate .NET 1.1 code for the same project and did not get this problem.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 10-Jul-2008 07:26:53   

Hi Simon, What's the exact problem you are getting into? Could you be more specific about what are the troubles sorting the grid when you sue LLBLGen Pro 2.0 generating for .NET 1.1 ?

Also please post the RuntimeLibraries version.

David Elizondo | LLBLGen Support Team
Posts: 20
Joined: 02-Apr-2004
# Posted on: 11-Jul-2008 00:38:18   

I'm running LLBLGen Pro 2.5. I used it to generate self-servicing code for .NET 2.0 and SQL Server, so the runtime libraries are SD.LLBLGen.Pro.DQE.SqlServer.NET20.dll version 2.5.7.1219 and SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll version 2.5.8.109.

I'm upgrading a C# application from .NET 1.1 to .NET 2 and from LLBLGen Pro 1 to LLBLGen Pro 2.5. It's a big application which someone else wrote and is new to me. So I don't yet know in detail what the problematic code fragments are trying to achieve, though it looks straightforward enough. Building the project that invokes the generated code fails with error messages like this one:

'MyApplication.Data.CollectionClasses.QuestionActionCollection' does not contain a definition for 'SupportsSorting'

where QuestionActionCollection is a collection class generated by LLBLGen Pro.

The code which causes the build error looks like this:

// Get and sort the actions.
QuestionActionCollection actions;
// [Code to populate the collection ommitted.]
if (!actions.SupportsSorting) {
    actions.SupportsSorting = true;
    actions.Sort(
        (int)QuestionActionFieldIndex.ActionIndex,
         ListSortDirection.Ascending);
}

The build error message is listed for each occurrence of actions.SupportsSorting in the above code fragment.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 11-Jul-2008 09:44:29   

The thing is that IBIndingList.SupportsSorting is a readonly property, it only defines a get. It always returns true, so an entity view is always sortable. This property is used by controls which have to determine if the object (in this case the entityview) supports sorting code or not, llblgen pro code does so true is returned.

So migrating the code you have posted, I think you will have to modify it to be:

//if (!actions.SupportsSorting) {
//   actions.SupportsSorting = true;
    actions.Sort(
        (int)QuestionActionFieldIndex.ActionIndex,
         ListSortDirection.Ascending);
//}
Posts: 20
Joined: 02-Apr-2004
# Posted on: 13-Jul-2008 22:35:58   

Thanks!