MySqlWorldContext.cs 598 B

1234567891011121314151617181920212223
  1. using System.Data.Entity;
  2. namespace Benchmarks.Mono.AspNet.Models
  3. {
  4. public class MySqlWorldContext : DbContext
  5. {
  6. public DbSet<World> World { get; set; }
  7. public MySqlWorldContext()
  8. : base("MySQL")
  9. {
  10. }
  11. protected override void OnModelCreating(DbModelBuilder modelBuilder)
  12. {
  13. modelBuilder.Entity<World>()
  14. .HasKey(w => w.id)
  15. .Property(w => w.randomNumber).HasColumnName("randomNumber");
  16. modelBuilder.Entity<World>().ToTable("world");
  17. }
  18. }
  19. }