Extending TrackedList<T>

Thread is closed for posting
4 posts, 0 answers
  1. Pål
    Pål avatar
    53 posts
    Member since:
    Sep 2012

    Posted 19 Sep 2011 Link to this post

    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
  2. Pål
    Pål avatar
    53 posts
    Member since:
    Sep 2012

    Posted 20 Sep 2011 Link to this post

    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
  3. Pål
    Pål avatar
    53 posts
    Member since:
    Sep 2012

    Posted 20 Sep 2011 Link to this post

    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
  4. Nikola
    Admin
    Nikola avatar
    27 posts

    Posted 22 Sep 2011 Link to this post

    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 >>

Back to Top