Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Greg #1

Open
wants to merge 5 commits into
base: attributerouting
Choose a base branch
from
Open

Greg #1

wants to merge 5 commits into from

Conversation

danieleli
Copy link

Hey Greg, here is a pull request with a couple of examples. I had to revert to '/api/{id}' because I screwed up the routing but I did start to implement the ability to pull a document_controller_alias (swagger_contoller) from web.config.

Also implemented swaggerConfig as singleton and moved logic out of controller in to factory.

Take what you like and leave what you don't. :)

btw - I could really use that model logic to meet a deadline! Can you put it in a gist or something?

thx!

}
};
// Arrange
var config = SwaggerConfig ?? SwaggerConfiguration.Instance;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I used DefaultConfiguration instead of a singleton is because SwaggerConfig can be passed to the controller, and in fact, if you use an IoS container like autofac or unity etc, you can have it automatically inject a SwaggerConfig. Also makes unit tests easier; singletons are hard to test.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats why I'm not using the singleton unless the this.SwaggerConfig property in null. Controller property can be marked as dependency property for IoC. (as can swaggerConfiguration.Instance)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants