c# - Prevent getting whole context value in Json.NET Serializer -


i using json.net serializer send data.

public string getallbuildingtype()   {     ienumerable<model.buildingtype> getall = ceepmscontext.buildingtype_repository.getall();     return jsonconvert.serializeobject(getall);    } 

in repository getall function

public ienumerable<buildingtype> getall() {     return context.buildingtypes.tolist();            } 

i want buildingtype data getting data of whole context in it. how can buildingtype data?is missing in json.net or implemented in wrong way.

after many research on problem couldn't find out reason why taking data of whole conext :( solved problem parsing required table context.

buildingtype building = new buildingtype(); building.id = context.buildingtype.id; building.name = context.buildingtype.name; .....  return jsonconvert.serializeobject(building); 

this way sending correct data.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -