Skip to content

Commands: Error gracefully on non-relational providers #1652

Closed

Description

@adamvoss

When migrations are not available because of the data store (provider) configuration, the failure message is not very helpful in indicating the issue. Ideally the failure message when migrations are not available would communicate the failure is because of the data store configuration and provide hints/suggestions as to how to go about correcting the issue.

Given a project with only the following classes:

public class BlogDbContext : DbContext
{
    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<Blog>();
    }
}

public class Blog
{
    public int BlogId { get; set; }
    public string Url { get; set; }
}

An attempt to create a migration with Add-Migration fails with the following message:

Unable to resolve service for type 'Microsoft.Data.Entity.Commands.Migrations.MigrationScaffolder' while attempting to activate 'Microsoft.Data.Entity.Relational.Migrations.Infrastructure.MigrationAssembly'.

Desired behavior might be a message along the lines of (example text only):

Migrations are unavailable because the configured data store does not support Migrations.

or

Migrations are unavailable because no data store configuration was found.

Either better conveys the issue in form the user's perspective. Information about how/where configuration can be done would make them even better. There might also be value in keeping the technical information as well for debugging and such?

Activity

  1. changed the title [-]Failure message when migrations are not available would benefit from improvment[/-] [+]Failure message when migrations are not available would benefit from improvement[/+] on Feb 19, 2015
  2. added this to the 7.0.0 milestone on Feb 20, 2015
  3. modified the milestones: , 7.0.0 on Sep 24, 2015
  4. changed the title [-]Failure message when migrations are not available would benefit from improvement[/-] [+]Commands: Error gracefully on non-relational providers[/+] on Sep 24, 2015
  5. modified the milestones: , 1.0.0 on Oct 15, 2022
  6. added theissue type on Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions