TestDbContext.cs 775 B

1234567891011121314151617181920212223
  1. using System.Diagnostics;
  2. using Microsoft.EntityFrameworkCore;
  3. using Quadarax.Foundation.Core.Data.Domain;
  4. namespace qdr.fnd.core.test.Repositories.Fakes
  5. {
  6. public class TestDbContext : DataDomain, IDataDomain
  7. {
  8. public DbSet<TestDao> Daos { get; set; } = null!;
  9. public TestDbContext(DbContextOptions options) : base(options)
  10. {
  11. }
  12. protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
  13. {
  14. var dbName = "test" + DateTime.Now.ToFileTime().ToString();
  15. optionsBuilder.UseInMemoryDatabase(dbName)
  16. .LogTo(message => Debug.WriteLine("EFSQL>>" + message));
  17. Debug.WriteLine($"*** Context created [{dbName}]");
  18. }
  19. }
  20. }