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

Error on IDictionary<int, IList>

1 Answer 70 Views
Databases and Data Types
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
jr
Top achievements
Rank 1
jr asked on 04 Feb 2010, 06:39 PM
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

1 Answer, 1 is accepted

Sort by
0
Damyan Bogoev
Telerik team
answered on 08 Feb 2010, 07:49 PM
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.
Tags
Databases and Data Types
Asked by
jr
Top achievements
Rank 1
Answers by
Damyan Bogoev
Telerik team
Share this question
or