Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

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