MapTableToType issue in C#

Hi,
I have started a project with a client in C# and one in Java. During some parallel programming I’ve have noticed that Backendless.Data.MapTableToType method doesn’t work in C#. In Java the same code works with no problems.
Here is a code example:
Backendless.Data.MapTableToType(“Persons”, typeof(Person));
List<Person> list = Backendless.Persistence.Of<Person>().Find().Data;
When I run this code I get this exception:
{“Table with the name Person does not exist. Make sure the client class referenced in the API call has the same literal name as the table in Backendless console”}
Is there a way to solve this problem besides changing my classnames to the same name as my tables in backendless?

Hi Kris,

Does the Person class belong to a namespace?

Regards,
Mark

Yes,

MyCustomProjectNamespace.DataServices.Models

I use the same namespace in my Java project and there it works. Shoud I use com.mbaas.service instead and is the the cause of the problem?

With regards,

Kris

Hi Kris,

Can you please try to specify the class name with package in your C# code?

I’ve got one library package with a namespace:

Podisa.PodoAssist.DataServices

In the root I have a DataController who fetches the data. In the subdir Models I have my data classes that I want to map.

Strange thing is when I use business logic I don’t have problems with mapping. When I use Backendless.CustomService.Invoke the mapping works perfectly.

I was saying about you to try the following code instead:

Backendless.Data.MapTableToType("MyCustomProjectNamespace.DataServices.Models.Persons", typeof(Person));
List&lt;Person&gt; list = Backendless.Persistence.Of&lt;Person&gt;().Find().Data;

Would it work?

Sadly it doesn’t… still the same error.

“Table with the name Person does not exist. Make sure the client class referenced in the API call has the same literal name as the table in Backendless console”

I’ve currently solved it by using business logic… but I don’t think that’s the way to go when there is an easier way of fetching data