public DbContextCore(System.Data.Entity.DbContext dbContext) { if (dbContext == null) throw new ArgumentNullException("dbContext may not be null"); this.dbContext = dbContext; this.ConfigDbContext(); }
public static void ExecuteUpgradeScript(string basePath) { string sqlScriptName = basePath + "upgrade.sql"; if (!File.Exists(sqlScriptName)) return; using (FileStream sqlScriptStream = File.OpenRead(sqlScriptName)) { if (sqlScriptStream.Length < 1) throw new FileNotFoundException(); byte[] readBuffer = new byte[sqlScriptStream.Length]; sqlScriptStream.Read(readBuffer, 0, (int)sqlScriptStream.Length); string sqlScript = ASCIIEncoding.ASCII.GetString(readBuffer); Match goMatch = Regex.Match(sqlScript, GO_SEPARATOR); if (!goMatch.Success) throw new InvalidDataException(); using (System.Data.Entity.DbContext upgradeDbContext = new System.Data.Entity.DbContext("UpgradeDb")) { System.Data.Entity.DbContextTransaction upgradeTransaction = upgradeDbContext.Database.BeginTransaction(); int startIndex = 0; try { while (goMatch.Success) { string sqlCommand = sqlScript.Substring(startIndex, goMatch.Index - startIndex); upgradeDbContext.Database.ExecuteSqlCommand(sqlCommand); startIndex = goMatch.Index + GO_SEPARATOR.Length; goMatch = goMatch.NextMatch(); } upgradeTransaction.Commit(); } catch (Exception ex) { upgradeTransaction.Rollback(); throw ex; } } } }
public QuaTrinhHocTapRepository(System.Data.Entity.DbContext dbContext) : base(dbContext) { }
public static SqlParameter CreateQueryParam(this System.Data.Entity.DbContext db, string name, object value) { return(new SqlParameter(name, value)); }
public MyConfig() { //实例化EF数据上下文 db = new Entities();//注:Entities()要修改成与EF上下文统一 }
protected static System.Data.Entity.DbContext _dbContext; //Get instance from container public JobRepository(System.Data.Entity.DbContext dbContext) : base(dbContext) { _dbContext = dbContext; }
public DeviceRepository(System.Data.Entity.DbContext dbContext) : base(dbContext) { }
public PlaylistItemRepository(System.Data.Entity.DbContext dbContext) : base(dbContext) { }
protected EntityFrameworkQuery(System.Data.Entity.DbContext dbContext) { if (dbContext == null) throw new ArgumentNullException("dbContext may not be null"); this._dbContext = dbContext; }
public BookingHistoryRepository(System.Data.Entity.DbContext dbContext) : base(dbContext) { }
public C__MigrationHistoryRepository(System.Data.Entity.DbContext dbContext) : base(dbContext) { }
public HopDongDOLABHocVienMappingRepository(System.Data.Entity.DbContext dbContext) : base(dbContext) { }
public UserStore(System.Data.Entity.DbContext context) : base(context) { }
/// <summary> /// Gets the query using the specified dbContext /// </summary> /// <param name="sortProperty">The sort property.</param> /// <param name="dbContext">The database context.</param> /// <param name="databaseTimeoutSeconds">The database timeout seconds.</param> /// <param name="errorMessages">The error messages.</param> /// <returns></returns> public IQueryable <IEntity> GetQuery(SortProperty sortProperty, System.Data.Entity.DbContext dbContext, int?databaseTimeoutSeconds, out List <string> errorMessages) { return(GetQuery(sortProperty, dbContext, null, databaseTimeoutSeconds, out errorMessages)); }
public AspNetUserRepository(System.Data.Entity.DbContext dbContext) : base(dbContext) { }
public SequentialIdProvider(System.Data.Entity.DbContext context) { _context = context; }
public MyConfig() { db = new Entities(); }
/// <summary> /// Initializes a new instance of the <see cref="DbContext" /> class. /// </summary> /// <param name="aDbContext">The database context.</param> /// <exception cref="System.ArgumentNullException">Thrown if the aDbContext parameter is null.</exception> public DbContext([NotNull] System.Data.Entity.DbContext aDbContext) { if (aDbContext == null) throw new ArgumentNullException("aDbContext"); mDbContext = aDbContext; }
public ServiceItemRepository(System.Data.Entity.DbContext dbContext) : base(dbContext) { }
public ProductRepository(System.Data.Entity.DbContext dbContext) : base(dbContext) { }
public MarkerRepository(System.Data.Entity.DbContext dbContext) : base(dbContext) { }
public CategoryRepository(System.Data.Entity.DbContext dbContext) : base(dbContext) { }
public AccountRepository(System.Data.Entity.DbContext dbContext) : base(dbContext) { }
public tbAppointmentStatuRepository(System.Data.Entity.DbContext dbContext) : base(dbContext) { }
public PlaceImageRepository(System.Data.Entity.DbContext dbContext) : base(dbContext) { }
public BusRepository(System.Data.Entity.DbContext context) : base(context) { }
/// <summary> /// Możliwość ustawienia innego kontekstu niż wbudowany /// </summary> /// <param name="context">Nowy kontekst EF</param> public void SetContext(System.Data.Entity.DbContext context) { base.SetNewContext(context); }
public sysdiagramRepository(System.Data.Entity.DbContext dbContext) : base(dbContext) { }
public InstitutionRepository(System.Data.Entity.DbContext context) : base(context) { }
public BrandRepository(System.Data.Entity.DbContext dbContext) : base(dbContext) { }
public VisualTypeRepository(System.Data.Entity.DbContext dbContext) : base(dbContext) { }
public BaseController(System.Data.Entity.DbContext dbContext) { service = new BaseService <T, TR, TV>(dbContext); }
public ThumbnailRepository(System.Data.Entity.DbContext context) : base(context) { }
public TrungTamGTVLRepository(System.Data.Entity.DbContext dbContext) : base(dbContext) { }
public UserStore(System.Data.Entity.DbContext applicationDBContext) : base(applicationDBContext) { }
public Club EditClub(ClubViewModel editClubView) { int countryId = 0; if (!String.IsNullOrEmpty(editClubView.Country.Trim())) { countryId = AddCountry(editClubView.Country); } int stateId = 0; if (!String.IsNullOrEmpty(editClubView.State.Trim())) { stateId = AddState(editClubView.State, countryId); } int cityId = 0; if (!String.IsNullOrEmpty(editClubView.City.Trim())) { cityId = AddCity(editClubView.City, stateId); } editClubView.Club.CityID = cityId; System.Data.Entity.DbContext dbContext = new System.Data.Entity.DbContext(entities,true); dbContext.Entry(editClubView.Club).State = System.Data.EntityState.Modified; dbContext.SaveChanges(); return editClubView.Club; }
/// <summary> /// Initializes a new instance of the <see cref="EntityFrameworkQuery" /> class. /// </summary> /// <param name="aDbContext">The database context.</param> protected EntityFrameworkQuery([NotNull] System.Data.Entity.DbContext aDbContext) { mDbContext = aDbContext; }