| Bug #80363 | String property does not use Unicode attribute with EF | ||
|---|---|---|---|
| Submitted: | 15 Feb 2016 3:19 | Modified: | 16 Feb 2016 7:34 |
| Reporter: | Leny LL | Email Updates: | |
| Status: | Duplicate | Impact on me: | |
| Category: | Connector / NET | Severity: | S3 (Non-critical) |
| Version: | 6.9.8, EF 6.0.0, vs 2013 up5 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[16 Feb 2016 6:49]
Chiranjeevi Battula
Hello Leny LL, Thank you for the bug report. I could not repeat the issue on Visual Studio 2013 (C#.Net) with MySQL Connector/Net 6.9.8 and EF6.1.3. This is duplicate of Bug #74240. Thanks, Chiranjeevi.
[16 Feb 2016 6:49]
Chiranjeevi Battula
Screenshot.
Attachment: 80363.png (image/png, text), 63.88 KiB.
[16 Feb 2016 6:58]
Leny LL
I could replicate with 6.9.8, EF 6.1.3, vs 2013 up5
[16 Feb 2016 7:34]
Leny LL
Although If I add an attribute to the properties it works:
public class Person
{
[Key]
public int PersonId { get; set; }
[MaxLength(50)]
public string Name { get; set; }
[MaxLength(50)]
public string Address { get; set; }
}
generates:
reateTable(
"dbo.People",
c => new
{
PersonId = c.Int(nullable: false, identity: true),
Name = c.String(maxLength: 50, storeType: "nvarchar"),
Address = c.String(maxLength: 50, storeType: "nvarchar"),
})
.PrimaryKey(t => t.PersonId);

Description: Let's use the following EF 6.0.0 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); } } 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 generated migration code is wrong : "unicode:" is never set to true. How to repeat: Create an application with EF 6.0.0 run enable-migrations run add-migration initial Suggested fix: N.A.