void ThenICanManuallyLoadReferences()
        {
            using (var context = new DemoContextFactory().Create())
            {
                context.Configuration.LazyLoadingEnabled = false;

                var brendan = context.Students.FirstOrDefault(s => s.FirstName == "Brendan");

                Assert.Null(brendan.Enrolments);

                context.Entry(brendan).Collection(s => s.Enrolments).Load();

                Assert.NotNull(brendan.Enrolments);
                Assert.NotEmpty(brendan.Enrolments);
            }
        }
Ejemplo n.º 2
0
        void ThenICanManuallyLoadReferences()
        {
            using (var context = new DemoContextFactory().Create())
            {
                context.Configuration.LazyLoadingEnabled = false;

                var brendan = context.Students.FirstOrDefault(s => s.FirstName == "Brendan");

                Assert.Null(brendan.Enrolments);

                context.Entry(brendan).Collection(s => s.Enrolments).Load();

                Assert.NotNull(brendan.Enrolments);
                Assert.NotEmpty(brendan.Enrolments);
            }
        }