Bug #74240 String property does not use Unicode attribute with EF
Submitted: 6 Oct 2014 21:20 Modified: 18 May 2015 17:51
Reporter: Gabriela Martinez Sanchez Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:6.8, 6.9 OS:Any
Assigned to: CPU Architecture:Any

[6 Oct 2014 21:20] Gabriela Martinez Sanchez
Description:
I have the following EF 6.1.1 model:

 public class Person
    {
        [Key]
        public int PersonId { get; set; }
        public string Name { get; set; }
        public string Address { get; set; }       
    }

    public class PersonalContext : DbContext
    {
        public DbSet<Person> Persons { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            modelBuilder.Entity<Person>().Property(e => e.Name).IsUnicode(true);
        }
    }

I run the project the first time, which creates an initial table in the database. 

Then I run this to generate the initial migrations:

This is the resulting code of the migration:

 public override void Up()
        {
            CreateTable(
                "People",
                c => new
                    {
                        PersonId = c.Int(nullable: false, identity: true),
                        Name = c.String(unicode: false),
                        Address = c.String(unicode: false),                       
                    })
                .PrimaryKey(t => t.PersonId)                ;
            
        }

The migration code is wrong due that the unicode:false is never true even the initialization specified.

How to repeat:
How to repeat:
Create an application with EF 6.1. 
run enable-migrations
run add-migration initial

Suggested fix:
N.A.
[18 May 2015 17:46] Chiranjeevi Battula
Hello Gabriela Martinez Sanchez,

Thank you for the bug report.
I could not repeat the issue on Visual Studio 2013 (C#.Net) with MySQL Connector/Net 6.9.6, EF6.1.1 and EF6.1.3.

Thanks,
Chiranjeevi.
[18 May 2015 17:47] Chiranjeevi Battula
screenshot

Attachment: 74240.PNG (image/png, text), 64.90 KiB.

[12 Feb 2016 2:55] Leny LL
I could repeat the issue with Gabriela example.
VS 2013 Up5, MySQL Connector 6.9.8, EF 6.0.0
[16 Feb 2016 6:51] Chiranjeevi Battula
http://bugs.mysql.com/bug.php?id=80363 marked as duplicate of this one.