Error on IDictionary<int, IList>

2 posts, 0 answers
  1. jr
    jr avatar
    6 posts
    Member since:
    Sep 2009

    Posted 04 Feb 2010 Link to this post

    Hi,

    I need a Dictionary where the key would be an int and the value would be a list of strings.

    I'm using IDictionary<int, IList<string>> or IDictionary<int, IList>.

    But I get an error:

    Error    8    OpenAccess Error: Telerik.OpenAccess: Updating SQL schema failed. No RelationalTypeMapping found for class 'System.Collections.IList' used by field '<value>'. Type is interface. 

    I tried to use List instead of IList, but I get another error saying that List is not supported and that I should use IList.

    Any tips to resolve this problem or any differente approach to do the same thing?

    Thanks

    João
  2. Damyan Bogoev
    Admin
    Damyan Bogoev avatar
    581 posts

    Posted 08 Feb 2010 Link to this post

    Hi jr,

    Unfortunately you cannot use an IList or List as a value type for IDictionary fields. Such fields are not supported. I would suggest you to use an instance of the following class instead of a Dictionary:

    public class Data
    {
     private int id;
     public int Id
     {
      get { return id; }
      set { id = value; }
     }
     private IList<string> dataList = new List<String>();
     public IList<string> DataList
     {
      get { return dataList; }
      set { dataList = value; }
     }
    }

    During the Forward Mapping process you should mark the Data class as persistent.
    Hope that helps.

    All the best,
    Damyan Bogoev
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  3. DevCraft banner
Back to Top