コード例 #1
0
        protected override EFCFNorthwindEntities CreateDbContext()
        {
            EFCFNorthwindEntities context = null;

            string connection = DBImager.GetNewDatabaseConnectionString("Northwind");

            if (!string.IsNullOrEmpty(connection))
            {
                // if there is an active connection in scope use it
                // Here we have to append the mapping file info to the connection string
                connection = string.Format("Persist Security Info=True;MultipleActiveResultSets=True;{0}", connection);
                context    = new EFCFNorthwindEntities(connection);
            }
            else
            {
                context = base.CreateDbContext();
            }

            return(context);
        }
コード例 #2
0
        protected override EFCFNorthwindEntities CreateDbContext()
        {
            EFCFNorthwindEntities context = null;

            string connection = ActiveConnections.Get("Northwind");

            if (!string.IsNullOrEmpty(connection))
            {
                // if there is an active connection in scope use it
                // Here we have to append the mapping file info to the connection string
                //"data source=Alexappfxss01;Persist Security Info=True;User ID=RiaTest;Password=TestPassword;MultipleActiveResultSets=True;Database=Northwind_Light"
                connection = string.Format("Persist Security Info=True;MultipleActiveResultSets=True;{0}", connection);
                //connection = "Data Source=AlexAppFxss02;Initial Catalog=Northwind;Persist Security Info=True;User ID=RiaTest;Password=TestPassword;MultipleActiveResultSets=True";
                context = new EFCFNorthwindEntities(connection);
            }
            else
            {
                context = base.CreateDbContext();
            }

            return(context);
        }