asp.net - How to get events to be handled in a particular order in C#? -


I had this idea of ​​entering an event in a base custom page on every button. I can check that it was saved or edited and after that the authorization and verification were done. The derived page still handles the click event to save on that page. I was not sure which incidents would happen for the first time (but this is probably in the order of the wireup) if the parents run the page first, then the candidate behaves by setting an IsAuthorized or IsValidated property and checking into the click handler of each derivative page. Can get it.

Either way, is there a way to run the event handler of the base page and complete it first, or is there any way to defend it?

Edit: Am I seeing a simple design for which there is no need to add boiler plate code to each edit / save / update button hander in the application? And what is the right way to communicate with one another for an incident? For example, the base page needs to be communicated to verify the success or failure, the success or failure of saving the derivative class is required to be communicated so that it can be recorded in the audit.

  // Base page - It appears that if the virus is in order to override the Zero OnInit (EventArgs e) {foreach (control possible button in control) {if (Possible button button) {button button = (button) possibleButton; button. Command + = button command precondition; }} Base.OnInit (e); Forwarding (possible control control button) {if (possible button button is) {button button = (button) possible button; button. Comand + = button comments; }}} Void ButtonCommandPreconditions (Object Sender, CommandEventArgs e) {if (e.CommandName == "save" || e.CommandName == "edit") {// stuff that other handlers // before being valid Required, Display Failures - Check for potentially-identified identical property // Post / gate, throw exception at GET, // Check for ID, throw exceptions / check for authentication on anonymous user / display Check for authorization failures - NO Automatically set IsAuthorized property}} Zero button comments (Object Sender, CommandEventArgs e) {if (e.CommandName == "save" | | E.CommandName == "edit") {// Stuffs * after other handlers * Need to save] Save log}}  

Edit: The modified code must be handled in order of the order of the wire to reflect that event hander.

Unless I am ready to provide solutions, it is necessary to get involved in the understanding of your design Tell them to separate your "Save" (and similar incidents) logic in your separate class hierarchy, and ask them to event handlers in a lifetime. However, I can comment on my basic question (before editing your in bold). The problem with your setup is that when you can increase incidents in specific order, in any event there is no guaranteed order of not framework delivery. When you can test on your god machine, but in practical deployment, the system load is high, then orders can be made that the events will be the first things to adjourn in favor of other actions. Events Arrivals for your audience can be essentially random.

You should never create your argument based on the event in which events are received. Every incident should only consider the current situation, it can not think of anything about any other incident. When you need this, the series of events will be broken.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -