Answer the question
In order to leave comments, you need to log in
How to disable the loading of reference properties from the database for a class instance that is returned in a web service method?
Good afternoon!
There are 2 classes: user and role .
The user class has a Role reference property of type role .
The Role class has a Creator reference property of type User .
The web service's GetUser() method returns the user.
In my particular example, User1 has the Admin role.
The Admin role is set to User1 in the Creator property.
When I call the GetUser() method to get User1, the method iterates endlessly over the Creator and Role properties.
Is it possible to somehow tell the web service to simply get the Role property from User1 and then recursively not run through the properties in this reference property?
At the same time, I cannot touch the classes themselves, because they are created in the ORM.
I was told that I need to use custom XML serialization, but I can't figure out where to dig.
Please help.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question