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

What kinds of collections are supported?

3 Answers 127 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.
byron
Top achievements
Rank 1
byron asked on 26 Jun 2010, 10:36 AM
Hi,

From my own experiment, it seems that the following types of collections are not supported in forward mapping
  • List<T>
  • Collection<T>
  • ReadOnlyCollection<T>
  • ReadOnlyObservableCollection<T>
  • Custom Collection like the following
  • public class CustomerCollection : Collection<Customer>

Using these types of collections in the fields will generate the following error:
Make this field [transient] as it is refers to a Non-persistent class or a Non-supported type

I would like to know what kinds of collections are supported and whether it is possible to use custom collection because it is very common to use custom collection in a domain model. Thanks!

3 Answers, 1 is accepted

Sort by
0
Petko_I
Telerik team
answered on 29 Jun 2010, 06:58 PM
Hi byron,

Currently we support an IList<T> collection to forward map a one-to-many relationship. In order to define a custom collection to be persisted you can derive from our class TrackedList<T>. Here is a blog post elaborating on this topic:

You can define your custom logic by overriding the collection methods. This provides a lot of flexibility and I hope this is exactly what you are looking for.

If you have any further questions, do not hesitate to contact us.


Greetings,
Petko_I
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
byron
Top achievements
Rank 1
answered on 01 Jul 2010, 06:02 AM
Why can't Collection<T> which implements IList<T> be used directly in the field declaration?

private Collection<Customer> Customers;    // generate error

private IList<Customer> Customers = new Collection<Customer>();   // no problem

Thanks
0
Petko_I
Telerik team
answered on 02 Jul 2010, 07:47 PM
Hello byron,

There is an explanation which you can find in our documentation. You can navigate to

OpenAccess ORM Classic - > Programming with OpenAccess -> The .NET Data Model > Generic collections/dictionaries.

Let us take the IList interface as an example. The basic idea is that there is a code generated by our enhancer that translates the IList interface to one that can be tracked. This is a preventive measure in cases where customers may derive from the existing IList and add additional methods which will not be tracked. The tracking mechanism makes use of the generic collections interface members.

Hope this information is what will answer your question. Do not hesitate to contact us back for further assistance.

Kind regards,
Petko_I
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
byron
Top achievements
Rank 1
Answers by
Petko_I
Telerik team
byron
Top achievements
Rank 1
Share this question
or