Esempio n. 1
0
        public DbContextCore(System.Data.Entity.DbContext dbContext)
        {
            if (dbContext == null) throw new ArgumentNullException("dbContext may not be null");

            this.dbContext = dbContext;
            this.ConfigDbContext();
        }
Esempio n. 2
0
        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)
 {
 }
Esempio n. 4
0
 public static SqlParameter CreateQueryParam(this System.Data.Entity.DbContext db, string name, object value)
 {
     return(new SqlParameter(name, value));
 }
Esempio n. 5
0
 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;
 }
Esempio n. 7
0
 public DeviceRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
Esempio n. 8
0
 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)
 {
 }
Esempio n. 12
0
 public HopDongDOLABHocVienMappingRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
Esempio n. 13
0
 public UserStore(System.Data.Entity.DbContext context) : base(context)
 {
 }
Esempio n. 14
0
 /// <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));
 }
Esempio n. 15
0
 public AspNetUserRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
Esempio n. 16
0
 public SequentialIdProvider(System.Data.Entity.DbContext context)
 {
     _context = context;
 }
Esempio n. 17
0
 public MyConfig()
 {
     db = new Entities();
 }
Esempio n. 18
0
        /// <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)
 {
 }
Esempio n. 20
0
 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)
 {
 }
Esempio n. 23
0
 public AccountRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
Esempio n. 24
0
 public tbAppointmentStatuRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
 public PlaceImageRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
Esempio n. 26
0
 public BusRepository(System.Data.Entity.DbContext context) : base(context)
 {
 }
Esempio n. 27
0
 /// <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)
 {
 }
Esempio n. 29
0
 public InstitutionRepository(System.Data.Entity.DbContext context) : base(context)
 {
 }
 public BrandRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
Esempio n. 31
0
 public VisualTypeRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
Esempio n. 32
0
 public BaseController(System.Data.Entity.DbContext dbContext)
 {
     service = new BaseService <T, TR, TV>(dbContext);
 }
 public ThumbnailRepository(System.Data.Entity.DbContext context) : base(context)
 {
 }
Esempio n. 34
0
 public TrungTamGTVLRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
Esempio n. 35
0
 public UserStore(System.Data.Entity.DbContext applicationDBContext) : base(applicationDBContext)
 {
 }
Esempio n. 36
0
        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;
        }
Esempio n. 37
0
 /// <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;
 }