Developers Forum


Entity With DTO Objects

 
MvcCms uses the Data Transfer Object (DTO) pattern to pass data primarily to ajax consumers. We have noticed in the error logs that sometimes the manipulation of the IEnumerable object to transfer it into the DTO object was causing and error because the connection was getting closed.

To fix this we have started adding the .ToList() ending to all the List_ method linq syntax in the data class. 
9 months 6 days ago by jon

Replies

Reply posted by jon 9 months 5 days ago View Branch And Reply
After doing some load testing we found that the threading was different from the custom membership provider and was clashing with the normal way of getting the user from the data context being shared by the business object. So what we did is to create a different method for get user in the custom membership provider that creates its own context with a using statement. This has had a big improvement on the application and was something that didn't really show up until the application came under load.

So what we learned from load testing was to always use ToList when returning an IEnumerable from the data project so that the context is not required for later manipulations, disable pooling, and give requests for data from threads outside the normal application their own context. These three things have really helped the application work much better.