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

using Generics

3 Answers 84 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.
Parchet
Top achievements
Rank 1
Parchet asked on 02 Jul 2009, 03:36 PM
Hello I would like to do something like that

public class GenericList<T>  
    {  
        private List<T> _list = new List<T>();  
        public List<T> List { get { return _list; } set { _list = value; } }  
    }  
 
 
    [Telerik.OpenAccess.Persistent()]  
    public class PersonList : GenericList<Person>  
    {  
        private string _personListName;  
        public string PersonListName { get { return _personListName; } set { _personListName = value; } }  
    } 

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

Thank you

3 Answers, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 06 Jul 2009, 05:57 AM
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.
0
Parchet
Top achievements
Rank 1
answered on 08 Jul 2009, 07:30 AM
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
0
Alexander
Telerik team
answered on 09 Jul 2009, 01:57 PM
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.
Tags
General Discussions
Asked by
Parchet
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Parchet
Top achievements
Rank 1
Share this question
or