What kinds of collections are supported?

Thread is closed for posting
4 posts, 0 answers
  1. byron
    byron avatar
    5 posts
    Member since:
    Dec 2008

    Posted 26 Jun 2010 Link to this post

    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!

  2. Petko_I
    Admin
    Petko_I avatar
    184 posts

    Posted 29 Jun 2010 Link to this post

    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
  3. byron
    byron avatar
    5 posts
    Member since:
    Dec 2008

    Posted 01 Jul 2010 Link to this post

    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
  4. Petko_I
    Admin
    Petko_I avatar
    184 posts

    Posted 02 Jul 2010 Link to this post

    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
Back to Top