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

[TINY] RevEng: Throw error if user attempts to run Scaffold-DbContext in a VB project. #4087

Closed
wants to merge 1 commit into from

Conversation

lajones
Copy link
Contributor

@lajones lajones commented Dec 15, 2015

Fix for #3417.

@@ -409,6 +409,9 @@ function Scaffold-DbContext {
$values = ProcessCommonParameters $StartupProject $Project
$dteStartupProject = $values.StartupProject
$dteProject = $values.Project
if ([string]::Compare($dteProject.Kind.ToString(), "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", $True) -eq 0) {
throw "Project $Project is a Visual Basic project which is not yet supported by Scaffold-DbContext."
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this cover all VB.NET projects, or just class library?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would say all relevant project types: http://www.mztools.com/articles/2008/mz2008017.aspx

Copy link
Contributor

Choose a reason for hiding this comment

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

In EF6, we detected using project.CodeModel.Language == CodeModelLanguageConstants.vsCMLanguageVB. I believe this caught all projects including Web Sites.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll test a few more project types, but the above code was taken from VsUtils in EF6.

@bricelam
Copy link
Contributor

Why doesn't it just spit out C# code? The project models are almost identical...

@bricelam
Copy link
Contributor

I don't like the idea of blocking users from doing this. In Migrations, they can override the MigrationsCodeGenerator design-time service with a VB-specific one and everything should work. It would be nice to have the same seam in RevEng.

@bricelam
Copy link
Contributor

I believe we said in the past that we wouldn't necessarily support VB, but we also wouldn't explicitly block it either.

@lajones
Copy link
Contributor Author

lajones commented Dec 15, 2015

@bricelam As mentioned in the issue #3417 I'm happy to just leave the code as is - in which case it does successfully output C# code into the VB project. But @rowanmiller is in favor of the error message...

@rowanmiller
Copy link
Contributor

Oh, right, yeah I missed that we would be blocking someone from implementing support themselves... yeah we should not block that.

@rowanmiller
Copy link
Contributor

Ok, yeah... just C# is fine

@lajones
Copy link
Contributor Author

lajones commented Dec 15, 2015

OK. I'll close this and update the issue to say we're leaving it as is.

@lajones lajones closed this Dec 15, 2015
@lajones lajones added this to the 7.0.0-rc2 milestone Dec 15, 2015
@lajones lajones deleted the 151214-lajones_VBProjectError_01 branch December 15, 2015 22:01
@ajcvickers ajcvickers removed this from the 1.0.0-rc2 milestone Oct 15, 2022
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.

6 participants