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

Design: Look at generic parameters when generating namespace using directives #7352

Closed
ajcvickers opened this issue Jan 4, 2017 · 1 comment
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. good first issue This issue should be relatively straightforward to fix. help wanted This issue involves technologies where we are not experts. Expert help would be appreciated. type-bug
Milestone

Comments

@ajcvickers
Copy link
Member

In various places where we generate code we look at the namespaces of the types used in order to generate using directives. This was done in #5912, which has the details of where we do this. However, if the type is generic, then we should also generate using directives for the namespaces of those types.

@yukozh
Copy link
Contributor

yukozh commented Jan 11, 2017

Reproduce

Add Pomelo.EntityFrameworkCore.MySql 1.1.0 into project.json

using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;

namespace ConsoleApp
{
    public class InnerModel
    {
        public string Name { get; set; }

        public int Grade { get; set; }
    }

    public class ReproduceModel
    {
        public int Id { get; set; }

        public JsonObject<List<InnerModel>> Inner { get; set; } // Requires MySQL >= 5.7
    }

    public class ReproduceContext : DbContext
    {
        public DbSet<ReproduceModel> ReproduceModels { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            optionsBuilder.UseMySql("server=localhost;uid=root;pwd=123456;database=repro");
        }
    }
}

Then dotnet ef migrations add Init

@bricelam bricelam changed the title Look at generic parameters when generating namespace using directives Migrations: Look at generic parameters when generating namespace using directives Jan 13, 2017
@bricelam bricelam added the help wanted This issue involves technologies where we are not experts. Expert help would be appreciated. label Feb 27, 2017
@ajcvickers ajcvickers modified the milestones: 2.0.0-preview1, 2.0.0 Apr 19, 2017
@bricelam bricelam changed the title Migrations: Look at generic parameters when generating namespace using directives Design: Look at generic parameters when generating namespace using directives May 2, 2017
@bricelam bricelam assigned smitpatel and unassigned bricelam Jun 23, 2017
@smitpatel smitpatel added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Jun 27, 2017
@bricelam bricelam added good first issue This issue should be relatively straightforward to fix. and removed good first issue This issue should be relatively straightforward to fix. labels May 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. good first issue This issue should be relatively straightforward to fix. help wanted This issue involves technologies where we are not experts. Expert help would be appreciated. type-bug
Projects
None yet
Development

No branches or pull requests

5 participants