You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AppDbContext.cs 573 B

6 年之前
6 年之前
6 年之前
6 年之前
1234567891011121314151617181920212223
  1. using Microsoft.EntityFrameworkCore;
  2. namespace Sample.RabbitMQ.MySql
  3. {
  4. public class Person
  5. {
  6. public int Id { get; set; }
  7. public string Name { get; set; }
  8. }
  9. public class AppDbContext : DbContext
  10. {
  11. public const string ConnectionString = "Server=localhost;Database=testcap;UserId=root;Password=123123;";
  12. public DbSet<Person> Persons { get; set; }
  13. protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
  14. {
  15. optionsBuilder.UseMySql(ConnectionString);
  16. }
  17. }
  18. }