Exemplo n.º 1
0
 private MainController()
 {
     Database.SetInitializer(new DropCreateDatabaseAlways <SupermarketContext>());
     //Database.SetInitializer(new MigrateDatabaseToLatestVersion<SupermarketContext, Configuration>());
     this.sQLServerContext = new SupermarketContext();
     this.mySqlContext     = new SuperMarketEntitiesModel();
     this.excelConnection  = new OleDbConnection();
     this.sqliteContext    = new SuperMarketEntities();
 }
Exemplo n.º 2
0
        public string ReadData(SQLServerController sqlServer)
        {
            StringBuilder sb = new StringBuilder();

            using (var context = new SuperMarketEntitiesModel())
            {
                sb.AppendLine("No Fetch optimization:");
                var query = context.Products.Where(p => p.ProductName.Contains("Coca"));
                sb.AppendLine("Product\tProductName");
                foreach (var product in query)
                {
                    sb.AppendFormat("{0}\t{1}", product.ProductName, product.Vendor);
                    sb.AppendLine();
                }
            }
            return(sb.ToString());
        }
Exemplo n.º 3
0
 public FromMySQLToSQLServer(SupermarketContext sqlServerContext,
                             SuperMarketEntitiesModel mySqlContext)
 {
     this.sqlServerContext = sqlServerContext;
     this.mySqlContext     = mySqlContext;
 }