0

Hi can anyone help me with json serializer and nhibernate, i want to tell json how deep he should go with serialization something like :

Employess=>Company=>Job

and i wanna serialize only

Employess=>Company and here the break for json.

2 Answers 2

3

Generally you want to create a DTO object whose responsibility is knowing how to serialize itself out. It shouldn't really be the responsibility of the nhibernate object to know how to translate itself in to something that the json consumer needs.

Sign up to request clarification or add additional context in comments.

Comments

1

You should decorate the Job property with [JsonIgnore] attribute.

[JsonIgonre]
public <JobType> Job {get; set;}

This way the serializer will ignore this property. You will need to add the proper using statement to your class header.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.