User Property Data Relation returns a Dictionary.

I am using the .NET SDK for desktop. I have a data relation with a table called Group as a property to the Users table. Upon retrieval of the BackendlessUser object from the database, calling GetProperty(“Group”) returns a Dictionary not a Group object.
This is causing two problems:
1- To get the actual group assigned to the user I need to requery it using the objectId found in the Dictionary returned.
2- Upon trying to update a user’s information, a backendless fault occurs, as a Dictionary not a Group Object is assigned to the Group Property (Attached a screenshot to the fault). Therefore I have to reassign the group every time I want to update or delete a user.

Is there an easier way to retrieve the actual Group Object assigned to the user? Also I am using the autoload option on this relation.

exception.PNG

Hi Maheed,

Whenever you retrieve a related property for an object, it’s type must be explicitly mapped to the table it comes from.

For example, suppose you have a related property in the Users table called “Group”. The related table may also be called “Group”. On the .NET side you would have a class for the objects from the “Group” table. Say the classname is “MyGroup” (or it could be “Group” it is up to you). Before you retrieve the data, make sure to make the following API call:

 Backendless.Data.MapTableToType( "Group", typeof( MyGroup ) );

Hope this helps.

Mark

Hi Mark,

Thanks a lot for your fast response. This fixed the problem.