I have a javascript application (ASP.net MVC 3 on the back end with SignalR) and i want to return only the fields that are needed (it must be dynamic).
I use the entity framework but i cant select only the specific columns because i need some fields for checking or something in the method that are no needed on the client side.
so, currently i make this:
public void GetPerson(int personID)
{
// Some logic...
// person is a entity from the entity framework (Person)
dynamic p = new
{
ID = person.ID,
FirstName = person.FirstName,
LastName = person.LastName
};
Clients[Context.ConnectionId].loadPerson(p);
}
But i'm not sure, if its a good practice (Performance etc.). Is there a better solution or can i still continue with the dynamic type?