25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

32 lines
1.0 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using DotNetCore.CAP.Infrastructure;
  6. using JetBrains.Annotations;
  7. using Microsoft.EntityFrameworkCore;
  8. namespace Sample.Kafka
  9. {
  10. public class AppDbContext : DbContext
  11. {
  12. public DbSet<CapSentMessage> SentMessages { get; set; }
  13. public DbSet<CapReceivedMessage> ReceivedMessages { get; set; }
  14. protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
  15. {
  16. optionsBuilder.UseSqlServer("Server=192.168.2.206;Initial Catalog=Test;User Id=cmswuliu;Password=h7xY81agBn*Veiu3;MultipleActiveResultSets=True");
  17. }
  18. protected override void OnModelCreating(ModelBuilder modelBuilder)
  19. {
  20. modelBuilder.Entity<CapSentMessage>().Property(x => x.StatusName).HasMaxLength(50);
  21. modelBuilder.Entity<CapReceivedMessage>().Property(x => x.StatusName).HasMaxLength(50);
  22. base.OnModelCreating(modelBuilder);
  23. }
  24. }
  25. }