Created
November 27, 2012 21:42
-
-
Save thecodejunkie/4157277 to your computer and use it in GitHub Desktop.
Automatic dependency resolution in Nancy
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 Demo : NancyModule | |
{ | |
public Demo(MyDependency dependency) | |
{ | |
Get["/{name}"] = parameters => { | |
return dependency.GetMessage(parameters.name); | |
}; | |
} | |
} | |
public class MyDependency | |
{ | |
public string GetMessage(string name) | |
{ | |
return string.Concat("Hi, ", name); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment