您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

AppDbContext.cs 573 B

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. }