class MyContext : DbContext { public DbSet<Order> Orders { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.HasSequence<int>("OrderNumbers"); } } public class Order { public int OrderId { get; set; } public int OrderNo { get; set; } public string Url { get; set; } }
As mysql don't have funtion 'Sequences'mysql
so we need to Create a table to stored Sequences sql
just as the article belowide
http://blog.csdn.net/chenaini119/article/details/51993211ui