Beispiel #1
0
    internal static void Main()
    {
        // Using an EF Core provider
        using var dbContext = new EfCoreContext();
        var totalQueries = new QueryologyEngineBuilder <EfCoreContext>()
                           .Configure(options => options.DataContextProvider = dbContext)
                           .AddObjectDumper()
                           .Build()
                           .Execute();

        Console.WriteLine($"\n🦄🦄 Total Queries allowed to be executed by QueryologyEngine<EfCoreContext>: {totalQueries}");
        Console.WriteLine("🐵🐵 Press Enter to continue... 🐵🐵");
        Console.ReadLine();

        // Only to work with LINQ to Objects
        using var nullDbContext = new NullDbContext();
        totalQueries            = new QueryologyEngineBuilder <NullDbContext>()
                                  .Configure(options => options.DataContextProvider = nullDbContext)
                                  .AddObjectDumper()
                                  .Build()
                                  .Execute();

        Console.WriteLine($"\n🦄🦄 Total Queries allowed to be executed by QueryologyEngine<NullDbContext>: {totalQueries}");
        Console.WriteLine("🐵🐵 Press Enter to continue... 🐵🐵");

        Console.ReadLine();
    }
Beispiel #2
0
        public void AddObjectDumper_ReturnsIQueryologyEngineBuilder_WhenHasCorrectInputParams()
        {
            // Arrange
            using var dbContext = new InMemoryDbContext();
            var sut = new QueryologyEngineBuilder <InMemoryDbContext>()
                      .Configure(options => options.DataContextProvider = dbContext);

            // Act
            sut.AddObjectDumper();

            // Assert
            Assert.NotNull(sut);
            Assert.IsType <QueryologyEngine <InMemoryDbContext> >(sut.Build());
        }