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

Migration generator missing the namespace System.Collections.Generic in MySQL for ef core #6367

Closed
yukozh opened this issue Aug 19, 2016 · 2 comments

Comments

@yukozh
Copy link
Contributor

yukozh commented Aug 19, 2016

Hi, I'm the author of Pomelo.EntityFrameworkCore.MySql. Since we have supported json db type, we have an issue in json type migrations.

If we add or remove a JsonObject<T> field which T is a generic collection, the generated migrations C# code missing the namespace System.Collections.Generic.(Both 20160819XXX_xxxxx.cs and XXXModelSnapshot.cs)

The following code is the result of migration generator generated.

using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using MyCatSample;

namespace MyCatSample.Migrations
{
    [DbContext(typeof(SampleContext))]
    partial class SampleContextModelSnapshot : ModelSnapshot
    {
        protected override void BuildModel(ModelBuilder modelBuilder)
        {
            modelBuilder
                .HasAnnotation("ProductVersion", "1.0.0-rtm-21431");

            modelBuilder.Entity("MyCatSample.Blog", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<string>("Content");

                    b.Property<JsonObject<List<string>>>("Tags"); // Missing namespace System.Collections.Generic

                    b.Property<DateTime>("Time");

                    b.Property<string>("Title");

                    b.HasKey("Id");

                    b.ToTable("Blogs");
                });
        }
    }
}

How should I fix the migration c# code generator to add the namespace in?

@rowanmiller @natemcmaster

@yukozh yukozh changed the title Migration generator missing the namespace System.Collections.Generic Migration generator missing the namespace System.Collections.Generic in MySQL for ef core Aug 19, 2016
@bricelam
Copy link
Contributor

Dupe of #5912

@divega
Copy link
Contributor

divega commented Aug 19, 2016

Closing as duplicate.

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

No branches or pull requests

4 participants