Is it a good idea to return nHibernate Entity from WebApi? For simple entity I tried to use this but what about complex entities. How will lazy loading be handled in that case?
相关问题
- MVC-Routing,Why i can not ignore defaults,The matc
- Register MicroServices in Azure Active Directory (
- PromptDialog Choice with List object Bot Framework
- Dotnet Core API - Get the URL of a controller meth
- parameters in routing do not work MVC 3
相关文章
- Fluent NHibernate — Saving Entity with Composite K
- How to get a list of connected clients on SignalR
- How do you redirect to the calling page in ASP.NET
- Change color of bars depending on value in Highcha
- The program '[4432] iisexpress.exe' has ex
- ASP.Net MVC 4 Bundles
- How to get server path of physical path ?
- Cannot implicitly convert Web.Http.Results.JsonRes
It is possible to return complex entities via WebAPI, however it is not the best way to do it, what I would suggest is create a DTO object to match the client side operation map it to the NHibernate entity and send it over the API.
With regard to the lazy loading, it will have no use if you expose the object via the web API, as the object serializes all the properties of the entity will be accessed and they will be loaded from the persistence, so in fact using lazy loading is inefficient in this scenario.