This is a migrated thread and some comments may be shown as answers.

Extending TrackedList<T>

3 Answers 108 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Pål
Top achievements
Rank 1
Pål asked on 19 Sep 2011, 11:08 PM
Hi.

I'm trying to make a collection with custom logic by extending the TrackedList<T> class. This works fine, but when the parent owner of my custom collection is loaded from the database, the collection is no longer custom but an instance of TrackedList<T>.

Am I doing something wrong?

Thanks

Pål

3 Answers, 1 is accepted

Sort by
0
Pål
Top achievements
Rank 1
answered on 20 Sep 2011, 12:47 PM
Update:

I tried to change my implementation of the TrackedList<T> class and it now works.

What I did initially was to create a class:

public class ViewColumnCollection : TrackedList<ViewColumn> { ... }

This did not work, but if I do:

public class MyCollection<T> : TrackedList<T> { ... }

It works fine.

However, I would really like to use my first implementation. Is this not possible?

Thanks
Pål
0
Pål
Top achievements
Rank 1
answered on 20 Sep 2011, 01:03 PM
I have also tried this, which works:
public class FooCollecion<T> : TrackedList<ViewColumn> { }

But this throws a 'NotImplemented' exception:
public class FooCollecion : TrackedList<ViewColumn> { }

Error: Not implemented: No SCO factory registered for type: Navita.Data.FooCollecion .
Class: Navita.Data.View Field: m_Columns
StackTrace:   at Telerik.OpenAccess.RT.ExceptionWrapper.Throw()
   at OpenAccessRuntime.storagemanager.StorageManagerFactoryBuilder.createSmfForURL()
   at OpenAccessRuntime.storagemanager.StorageManagerFactoryBuilder.createStorageManagerFactory()
   at OpenAccessRuntime.DataObjects.tools.ant.DataObjectsTaskBase.execute()
   at OpenAccessRuntime.DataObjects.tools.ant.CreateRelationalSchemaTask.execute()
   at Telerik.OpenAccess.RT.OpenAccessSchemaAdapter.Create(Assembly inputAssembly, List`1 referencedAssemblies, SchemaProperties schemaProps, SchemaCreateProperties schemaCreateProps, IOutputAdapter log)
   at Telerik.OpenAccess.Tools.ILSchema.CreateSchema()
   at Telerik.OpenAccess.Tools.ILSchema.RunCommand()
   at Telerik.OpenAccess.Tools.ILSchema.RunCommandWithCatch()

Pål
0
Nikola
Telerik team
answered on 22 Sep 2011, 08:51 AM
Hello Pål,

Sorry for the late response. I did some investigation of the problem and I found out that if you declare the field of your property as 

IList<SomeEntityty> cusomTrackedList = new CustomTrackedList();
instead of
CusomTrackedList cusomTrackedList = new CustomTrackedList();
it works.

The CustomTrackedList class is declared as follows
public class CustomTrackedList : TrackedList<SomeEntity>
{
}

We are going to do further investigation of the problem and get back to you with more details soon. In the meantime I hope the information above is useful to you.

Kind regards,
Nikola
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's SQL Server Community Awards. We are competing in TWO categories and every vote counts! VOTE for Telerik NOW >>

Tags
General Discussions
Asked by
Pål
Top achievements
Rank 1
Answers by
Pål
Top achievements
Rank 1
Nikola
Telerik team
Share this question
or