1
I have a web service api where a query to the bank is relaunched through nhibernate, but when returning the object, its referenced properties are overwritten, I believe it is because of the nhibernate proxy.
How can I be doing to fix this problem?
Follows the classes Personal Clinic and then Person:
Could explain better and put the code from where the problem occurs. I can’t help if I can’t reproduce the problem.
– Miguel Angelo
Good afternoon @Miguelangelo the example is very simple to reproduce, I have a Personal class and inside it has a property of type Person, where it contains all the properties related to the person. I’m using Nhibernate to connect to the database, when I return the Personal object through a web api controller, the client arrives as per the image above, the correct one was Pessoa contain only the properties that are within _target.
– Rodrigo Martins
I just posted some images of the Personal Clinical class and the Person class, see if it’s clearer now. I am making a consultation of Personal Clinic and in the return in the client is as the first image.
– Rodrigo Martins
How you are doing class mapping: you are using Fluentnhibernate, the Fluent syntax of Nhibernate itself or XML file?
– Miguel Angelo
I am using fluentNHibernate, with structureMap.
– Rodrigo Martins