Link to home
Start Free TrialLog in
Avatar of curiouswebster
curiouswebsterFlag for United States of America

asked on

MVC3 and WebService objects as models

I am on a project that is considering tightly binding a Razor Page (cshtml file)  to a web service object.  And I have been told to find out if there are any pitfalls to this approach.

In my past MVC projects, I have create a View Model as a POCO class, and used Data Transfer Objects to transfer values from the POCO to the back end methodology, with that's to a backend DLL, a Web Service or Entity Framework.  But here the suggestion is to strongly type the model with the object.  

Does any see any problems with that approach?

I need to dig into the exception handling plans for that, in the event the web service is not reachable.

Any other problems that anyone sees?

Thanks.
SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of curiouswebster

ASKER

I did discover that the plan is to use strongly typed DTO objects which were not defined in the web service as I had thought, but instead in our back-end core logic.  So right-clicking the model and selecting "Go To Definition" opens Reference.cs and points to the object as defined in the DLL for the backend.

So, now my question has become more refined...

Is there any direct value to passing a POCO between the the View and the Controller which is MORE THAN a DTO?  What kinds of useful properties could be added to the POCO for greater local value to the UI solution?

Thanks.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I refined my question in my prior post.

What do I lose when the model is just properties: a DTO object, which in this case, is defined on the backend.  What cool things can I do when the strongly typed model has function and "can do things"?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks!