????????????
???????????????? Specified key was too long;max key length is 767 bytes
????1?????????????????????????????????
????2??MyContext ?????????????????mysql ????????? [DbConfigurationType(typeof(MySqlEFConfiguration))]
????????????????    Model compatibility cannot be checked because the database does not contain model metadata
???????????????????????????г???
???????????????????в??????κ???????
?????????£?
???????磺1.
public class Employee
{
[Key]
public int EmployeeId { get; set; }
public string Name { get; set; }
[ForeignKey("ManagerId")]
public Employee Manager { get; set; }
public int ManagerId { get; set; }
}
[ForeignKey("ManagerId")]
public Employee Manager { get; set; }
public int ManagerId { get; set; }
?????????á?
????2.
[Column(TypeName="VARCHAR(254)")]
public string ColumnName { get; set; }
????????壬????
[MaxLength(254)] [Column(TypeName="VARCHAR")]
public string ColumnName { get; set; }
????3.?????′???δ???????????????????????????????н????в????
modelBuilder.Entity<Category>()
.HasKey(c => c.IdCategory )
.HasOptional(p => p.Children)
.WithMany()
.HasForeignKey(c => c.ChildrenId);
???:
modelBuilder.Entity<Category>()
.HasKey(c => c.IdCategory )
.HasMany(p => p.Children)
.WithOptional()
.HasForeignKey(c => c.ChildrenId);
.WithMany()????.WithOptional()