I was reading some articles about how to implement a service layer in MVC applications yesterday. One thought that came to mind was: what about data annotations used for model state validation? When you implement a service layer, do you get rid of those data annotations (like [Required] or [MaxLength]) for the model classes? This[^] is the article I was reading.
MVC development is mostly new to me, aside from the fact that I have a fundamental knowledge of the core concepts. I switched employers recently and our work here is done primarily in MVC, which I'm happy about because I've been wanting to get into it for a while now. My two coworkers are more knowledgeable than I am, for sure, but they're open to new ideas and new techniques that may help improve the applications. I figured a service layer would be beneficial not only to remove business/validation logic from controllers, but also because we're starting to write unit tests.
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
If I get you correctly then are pointing towards that if you have BL or service layer then you would do away with Model? Correct me if I'm wrong.
But, please note that model is the manifestation of your view i.e. it is tightly coupled to your view. You should have that as well as Business layer where you would get the data (from DAL), do some processing and then pass the data onto the model. Also, note that model does not do away DTO as well which would be used to communicate between your various layers. A lot of the time DTO and models are pretty much the same but can differ based on the requirements.
How do annotations pass through serialisation (JSON)?
Caveat: I am even less knowledgeable about MVC!
MVC, being server based can have the DAL/Models etc in the same project, eliminating the service component. I don't like that design and will need to look at a service component so this is relevant to me.
So the service would supply data based on the Table/View structure from the database via json and the MVC would then deserialise them into UI models.
This to me reduces the benefits of using EF spit as the DAL as it is bloody useless in a service.
Never underestimate the power of human stupidity
we are managing in sql server. I came to know that when we manage session in sql server then session end event never fire..,.is it true? Just guide me how to capture session timeout when we manage session in sql server. Thanks
I am using Visual Studio 2010, VB.NET, my site has .NET 4, using Web Forms. I have a page with, among other things, two asp:ImageButton controls, each in its own little AJAX UpdatePanel. This page has been working since some time in 2013. One button is Add To Wishlist, the other Add To Cart. Both have an OnClick event and they are nearly identical, with the exception of the purpose and SQL Server stored procedure they call. As I said, they've both been working for quite a while. I made no changes to the page. Yet, suddenly, the Add to Cart button does not work...nothing happens, no error is thrown, it just doesn't do anything. the Add to Wishlist button still works as before. When they are updated, the image is changed. Add to Cart image is changed to "In Cart", Add to Wishlist is changed to "In Wishlist".
I've seen some complaints about ImageButtons not working in the latest IE, but this is in Firefox as well as IE.
I don't understand why one works and the other doesn't, and why it happened when no changes were made to the page.
My site is on a shared hosting plan at web.com, so there are many things that I cannot do. I only have access to certain things on the server.
Could a change they made cause this? But still, one button still works, same page, nearly the same exact code.
there are actually two pages, one is for pay items, one is for freebies. Both use the same code, and the Add to Cart button is not working on either page...both were working until recently.
I thought that perhaps the page was corrupted, so I re-uploaded the pay item page and cycled the application (I at least can do that), but it made no difference.
Protected Sub ib_Add_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)
If Page.IsPostBack Then