First post and still very new to Backendless, loving it so far tho!
I am a little but stuck on something where I am not sure whether it’s a bug, or if I am not doing it right. Basically what I want to do is to retrieve the
Users table with some relation depth. I got this working, but then I wanted to implement it with a custom class in my code.
So essentially, instead of getting the Users table, I want it to be a
I quickly figured out I could to this by using:
Backendless.Data.MapTableToType( "Users", typeof( CustomUser ) )
But it doesn’t seem to work. I found someone with the same issue a while back, but it doesn’t seem to have an actual solution, but more of a workaround.
So in the end, my code looks as following:
BackendlessUser user = await Backendless.UserService.LoginAsync(username, password); Backendless.Data.MapTableToType("Users", typeof(CustomUser)); CustomUser loggedInUser = await Backendless.Data.Of<CustomUser >().FindByIdAsync(user.ObjectId, 2);
But I am still getting this exception:
BackendlessException: Table not found by name 'CustomUser '. Make sure the client class referenced in the API call has the same literal name as the table in Backendless console
Just to clarify what I am doing/want to do:
My users have a relation to a “Company” and a company can have an X amount of active product relations. So I want to get a user with all the relations (2 at the moment, but could be more. We’re still experimenting). From what I understood, it is generally not considered good practice to convert the Users table to something different, and I should use the BackendlessUser class for it, but after logging in, that class does not have any of the relations (will search a bit more on this topic), so instead I get the row of the current user from the Users table, and I want to have that in a custom class that adheres to our standards.