This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [MyCustomControllerAttribute1] | |
| [MyCustomControllerAttribute2] | |
| public class HomeController : Controller | |
| { | |
| public ActionExecutingContext FilterContext; | |
| [KitchenSinkActionExecutingFilter] | |
| [MyCustomActionAttribute1] | |
| [MyCustomActionAttribute2] | |
| public ActionResult Index(string id, string anotherParam) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using SheepAspect.Attributes; | |
| using SheepAspect.Runtime; | |
| namespace SheepAspectExample | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // better like this? | |
| var isMyFavoriteLetter = new List<string> { "A", "B", "C"}.Contains(myFavoriteLetter); | |
| // or better like this? | |
| var isMyFavoriteLetter = myFavoriteLetter == "A" || myFavoriteLetter == "B" || myFavoriteLetter == "C"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Serializable] | |
| public class TraceAttribute : OnMethodBoundaryAspect | |
| { | |
| public override void OnEntry(MethodExecutionEventArgs args) | |
| { | |
| Trace.TraceInformation("Entering {0}.", args.Method); | |
| } | |
| public override void OnExit(MethodExecutionEventArgs args) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class CustomerController : Controller | |
| { | |
| public ViewResult Index() | |
| { | |
| return View(); | |
| } | |
| public ViewResult Edit() | |
| { | |
| var existingCustomer = new Customer(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [MyCustomControllerAttribute1] | |
| [MyCustomControllerAttribute2] | |
| public class HomeController : Controller | |
| { | |
| public ActionExecutedContext FilterExecutedContext; | |
| public ActionResult Index(string id, string anotherParam) | |
| { | |
| return View(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // this is how your code might look without using notifypropertyweaver | |
| public class Person1 : INotifyPropertyChanged | |
| { | |
| public event PropertyChangedEventHandler PropertyChanged; | |
| private void NotifyPropertyChanged(string propertyName) | |
| { | |
| if (PropertyChanged != null) | |
| { | |
| PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <title>Javascript AOP Example</title> | |
| <script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js" type="text/javascript"></script> | |
| <script type="text/javascript"> | |
| String.prototype.capitalize = String.prototype.capitalize.wrap( | |
| function(callOriginal, eachWord) { | |
| if (eachWord && this.include(" ")) { | |
| // capitalize each word in the string | |
| return this.split(" ").invoke("capitalize").join(" "); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MyClass | |
| { | |
| [MyAspect] | |
| public void MyMethod() | |
| { | |
| Console.WriteLine("inside of my method"); | |
| } | |
| } | |
| [Serializable] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // in the controller class | |
| [KitchenSinkresultExecutingFilter] | |
| public ActionResult OnResultExecuting(string id, string anotherParam) | |
| { | |
| return View(); | |
| } | |
| // outside the controller class | |
| public class KitchenSinkresultExecutingFilterAttribute : ActionFilterAttribute | |
| { |