Created
August 19, 2011 19:36
-
-
Save jmarnold/1157781 to your computer and use it in GitHub Desktop.
ModelFinder
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 ModelFinder : IModelFinder | |
| { | |
| private readonly BehaviorGraph _graph; | |
| public ModelFinder(BehaviorGraph graph) | |
| { | |
| _graph = graph; | |
| } | |
| public Type FindRelatedModel(Type type) | |
| { | |
| var post = _graph | |
| .BehaviorFor(type) | |
| .FirstCall(); | |
| // The handler Type is the CreateEndpoint so grab the Get method | |
| var getModelType = post | |
| .HandlerType | |
| .GetMethod("Get", BindingFlags.Public | BindingFlags.Instance) | |
| .GetParameters()[0] | |
| .ParameterType; | |
| return getModelType; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment