using Generics

Thread is closed for posting
4 posts, 0 answers
  1. Parchet
    Parchet avatar
    2 posts
    Member since:
    Jun 2009

    Posted 02 Jul 2009 Link to this post

    Hello I would like to do something like that

    public class GenericList<T>  
    2     {  
    3         private List<T> _list = new List<T>();  
    4         public List<T> List { get { return _list; } set { _list = value; } }  
    5     }  
    6  
    7  
    8     [Telerik.OpenAccess.Persistent()]  
    9     public class PersonList : GenericList<Person>  
    10     {  
    11         private string _personListName;  
    12         public string PersonListName { get { return _personListName; } set { _personListName = value; } }  
    13     } 

    How can I achive that I can't put the Persistent attribute on the base class.

    Thank you
  2. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 06 Jul 2009 Link to this post

    Hello Frédéric,

    I am afraid this is not possible that way. We cannot create tables for generic types as we do not know their particular type. As far as I can see you are trying to implement a custom persistent capable collection. You can achieve this by making the collection deriving directly from our TrackedList<T> generic collection which is persistent capable and you will not need the Persistent attribute.

    Greetings,
    Alexander
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Parchet
    Parchet avatar
    2 posts
    Member since:
    Jun 2009

    Posted 08 Jul 2009 Link to this post

    Hello thank you for the answer.

    I will have a look at the TrackedList<T> to see if it can help.

    In fact I have a generic Tree class in my code and this tree class is inherited by a specialiyed tree class that specifies the Generic Type with a persitent capable type.

    What I would like is to be able to persist the inherited tree with the particular type specified, is it possible?

    Have you as well a TrackedDictionary<T>?

    Thank you
  4. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 09 Jul 2009 Link to this post

    Hi Frédéric,

    Unfortunately we do not have a TrackedDictionary<T> but I hope you will be able to accomplish your task with the TrackedList<T>. All collections that derive from it are persistent capable.
    Please feel free to contact us if you have any further questions.

    Best wishes,
    Alexander
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top