public List <Employee> QueryInvolvingMultipleEntities()
        {
#if NHIBERNATE
            // need to figure out what to do here
            //return new List<Employee>();
            var dc0 = new NorthwindNHContext();
            var dc  = new NorthwindNHContext();
#elif CODEFIRST_PROVIDER
            var dc0 = new NorthwindIBContext_CF();
            var dc  = new EFContextProvider <NorthwindIBContext_CF>();
#elif DATABASEFIRST_OLD
            var dc0 = new NorthwindIBContext_EDMX();
            var dc  = new EFContextProvider <NorthwindIBContext_EDMX>();
#elif DATABASEFIRST_NEW
            var dc0 = new NorthwindIBContext_EDMX_2012();
            var dc  = new EFContextProvider <NorthwindIBContext_EDMX_2012>();
#elif ORACLE_EDMX
            var dc0 = new NorthwindIBContext_EDMX_Oracle();
            var dc  = new EFContextProvider <NorthwindIBContext_EDMX_Oracle>();
#endif
            //the query executes using pure EF
            var query0 = (from t1 in dc0.Employees
                          where (from t2 in dc0.Orders select t2.EmployeeID).Distinct().Contains(t1.EmployeeID)
                          select t1);
            var result0 = query0.ToList();

            //the same query fails if using EFContextProvider
            dc0 = dc.Context;
            var query = (from t1 in dc0.Employees
                         where (from t2 in dc0.Orders select t2.EmployeeID).Distinct().Contains(t1.EmployeeID)
                         select t1);
            var result = query.ToList();
            return(result);
        }
Exemplo n.º 2
0
        public List <Employee> QueryInvolvingMultipleEntities()
        {
            var dc0 = new NorthwindIBContext_CF(PersistenceManager.Context.Options);
            var pm  = new EFPersistenceManager <NorthwindIBContext_CF>(dc0);

            //the query executes using pure EF
            var query0 = (from t1 in dc0.Employees
                          where (from t2 in dc0.Orders select t2.EmployeeID).Distinct().Contains(t1.EmployeeID)
                          select t1);
            var result0 = query0.ToList();

            //the same query fails if using EFContextProvider
            dc0 = pm.Context;
            var query = (from t1 in dc0.Employees
                         where (from t2 in dc0.Orders select t2.EmployeeID).Distinct().Contains(t1.EmployeeID)
                         select t1);
            var result = query.ToList();

            return(result);
        }
Exemplo n.º 3
0
 // called via DI
 public NorthwindIBModelController(NorthwindIBContext_CF context)
 {
     PersistenceManager = new NorthwindPersistenceManager(context);
 }
 public NorthwindIBModelController(NorthwindIBContext_CF context)
 {
     ContextProvider = new NorthwindContextProvider(context);
 }