Beispiel #1
0
        public void SetupRepository()
        {
            var dbPath = EfDataDirectoryFactory.Build();

            dbContext = new TestObjectContext("Data Source=" + dbPath);

            const int totalItems = 5;

            for (int i = 1; i <= totalItems; i++)
            {
                dbContext.Contacts.Add(
                    new Contact
                {
                    ContactId      = i.ToString(),
                    Name           = "Test User " + i,
                    EmailAddresses = new List <EmailAddress> {
                        new EmailAddress {
                            ContactId      = i.ToString(),
                            EmailAddressId = i,
                            Email          = "omar.piani." + i.ToString() + "@email.com",
                            Label          = "omar.piani." + i.ToString()
                        }
                    }
                });
            }

            dbContext.SaveChanges();

            // reistantiate in order to lose caches
            dbContext = new TestObjectContext("Data Source=" + dbPath);
        }
Beispiel #2
0
 public static EagerContext AsEager(this TestObjectContext source)
 {
   return new EagerContext(source);
 }
Beispiel #3
0
 public EagerContext(TestObjectContext context)
 {
   _context = context;
 }
 public void ShowHowIWantIt()
 {
     TestObjectContext context = new TestObjectContext();
     var query = from a in context.AsEager().TestEntity select a;
 }