Solved

mvc 3 c#: What is preferred methodology for passing notifications/messages from service layer

Posted on 2013-01-24
1
634 Views
Last Modified: 2013-01-30
I am developing a .net mvc 3  c# application and I am currently using a ModelStateWrapper to pass messages from the service layer to the controller.  The question is, considering that the underlying ModelStateDictionary is based upon key/value pairs, what key would I need to tell the view to display this message along with the form-based errors?  When the validation summary is called.
0
Comment
Question by:rawcoder
1 Comment
 
LVL 22

Accepted Solution

by:
ambience earned 500 total points
ID: 38821108
ModelState has a collection of errors for each key and I believe if you add with the empty key the messages are displayed as form level summary but otherwise if the keyname matches field name (I'm not 100% sure of this) then it appears as field level validation message.

In short, if the message is specific to a field (which should really not be coming from the service layer though) but if it is then the fieldname can be the key otherwise just the empty keyname.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question