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

Make existing controllers into partial classes #6

Closed
kevinkuszyk opened this issue Feb 6, 2015 · 4 comments
Closed

Make existing controllers into partial classes #6

kevinkuszyk opened this issue Feb 6, 2015 · 4 comments

Comments

@kevinkuszyk
Copy link
Member

We need to make existing controllers into partialclasses and make all the action methods virtual.

@wwwlicious
Copy link
Contributor

For modifying existing controller classes I used a ControllerRewriter with an override for VisitClassDeclaration

The classes are marked as partial here

Currently I rely on the semantic model to get the declaring type which in turn I use to determine if the class is an MVC controller class.

An issue with this is that once you update the node, it invalides the CompilationUnit in the syntax tree and my override for VisitMemberDeclaration will not be able to get the semantic model for the member (which again I use to determine if this is an MVC Controller member)

I am investigating how to avoid using the semantic model for type resolution but this appears pretty difficult vs creating a new compilation unit for the syntaxnode passed to the VisitMemberDeclaration override

@artiomchi
Copy link
Member

I think this can be closed as well, pending @wwwlicious's confirmation. If I understand his comment here there was an issue with changing classes during the compilation process, since back then the code was executing in the early stages of the compilation process. The way the module is currently running - that doesn't seem to be a problem, and there's no reference to VisitMemberDeclaration in the project anymore.

At the same time, the controllers are marked as partial without any issues.

@kevinkuszyk
Copy link
Member Author

Sounds fine to me. @wwwlicious?

@wwwlicious
Copy link
Contributor

@artiomchi @kevinkuszyk Yes, I agree this can be closed

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

No branches or pull requests

3 participants