Skip to content

Throw error for unsupported scenarios in dotnet-ef - #5312

Merged
natemcmaster merged 2 commits into
releasefrom
namc/not-supported-errors
May 10, 2016
Merged

natemcmaster merged 2 commits into
releasefrom
namc/not-supported-errors

Conversation

@natemcmaster

@natemcmaster natemcmaster commented May 9, 2016 •

Copy link
Copy Markdown
Contributor

Point users to a webpage with dotnet-ef RC2 limitations when:

  1. When dotnet-ef fails on a class library project or
  2. Loading external startup on desktop .NET

Fix #5321

@natemcmaster

Copy link
Copy Markdown
Contributor Author

cc @divega

@divega

divega commented May 9, 2016

Copy link
Copy Markdown
Contributor

LGTM. I think @rowanmiller should review the message and provide the forward link.

@natemcmaster

Copy link
Copy Markdown
Contributor Author

@divega I've updated this PR to include the removal of "--startup-project". 😢

if (IsDotNetProject $fallbackProject) {
# this means users specified -StartupProject explicitly
# otherwise, ignore what VS has marked as the "startup project"
Write-Warning "'-StartupProject' is not supported on .NET Core projects. This parameter will be ignored."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it not supported in .NET Core projects or in project.json based projects?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. It's all "xproj" type projects.

@divega

divega commented May 10, 2016

Copy link
Copy Markdown
Contributor

I had a question about an error message in the PowerShell commands but everything else LGTM.

@natemcmaster

Copy link
Copy Markdown
Contributor Author

Also added a fix for #4832 because this is going to be encountered much more now.

{
// TODO
var fwlink = "";
Reporter.Error.WriteLine($"This version of Entity Framework tools for .NET Core CLI does not support class library projects. See {fwlink} for more details.");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

http://go.microsoft.com/fwlink/?LinkId=798221

Here is my suggestion for the message...

This preview of Entity Framework tools does not support targeting class library projects in ASP.NET Core and .NET Core applications. See {fwlink} for details and workarounds.

@natemcmaster
natemcmaster force-pushed the namc/not-supported-errors branch from 96222db to 33e3c84 Compare May 10, 2016 17:50
@natemcmaster

Copy link
Copy Markdown
Contributor Author

Updated with PR feedback.

<value>Removing migration '{name}' without checking the database. If this migration has been applied to the database, you will need to manually reverse the changes it made.</value>
</data>
<data name="NoParameterlessConstructor" xml:space="preserve">
<value>No parameterless constructor on type '{contextType}' was available. Either add one to '{contextType}' or add an implementation of 'IDbContextFactory&lt;{contextType}&gt;'.</value>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@rowanmiller new exception message if I am not mistaken.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor changes....

No parameterless constructor was found on '{contextType}'. Either add a parameterless constructor to '{contextType}' or add an implementation of 'IDbContextFactory<{contextType}>' in the same assembly as '{contextType}'.

@divega

divega commented May 10, 2016

Copy link
Copy Markdown
Contributor

:shipit: with any necessary changes to exceptions.

Nate McMaster added 2 commits May 10, 2016 12:28
…rs when dotnet-ef fails on a class library project

Add warning in powershell that -StartupProject is going to be ignored
@rowanmiller

Copy link
Copy Markdown
Contributor

:shipit: with exception message updates

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.

4 participants