コード例 #1
0
ファイル: DbContextCore.cs プロジェクト: heraclex/BookStore
        public DbContextCore(System.Data.Entity.DbContext dbContext)
        {
            if (dbContext == null) throw new ArgumentNullException("dbContext may not be null");

            this.dbContext = dbContext;
            this.ConfigDbContext();
        }
コード例 #2
0
ファイル: BaseDaoHelper.cs プロジェクト: aozkesek/dotNET
        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;
                    }
                }
            }
        }
コード例 #3
0
 public QuaTrinhHocTapRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
コード例 #4
0
 public static SqlParameter CreateQueryParam(this System.Data.Entity.DbContext db, string name, object value)
 {
     return(new SqlParameter(name, value));
 }
コード例 #5
0
ファイル: MyConfig.cs プロジェクト: aha100/wkmvc
 public MyConfig()
 {
     //实例化EF数据上下文
     db = new Entities();//注:Entities()要修改成与EF上下文统一
 }
コード例 #6
0
 protected static System.Data.Entity.DbContext _dbContext; //Get instance from container
 public JobRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
     _dbContext = dbContext;
 }
コード例 #7
0
 public DeviceRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
コード例 #8
0
 public PlaylistItemRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
コード例 #9
0
        protected EntityFrameworkQuery(System.Data.Entity.DbContext dbContext) {
            if (dbContext == null) throw new ArgumentNullException("dbContext may not be null");

            this._dbContext = dbContext;
        }
コード例 #10
0
 public BookingHistoryRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
コード例 #11
0
 public C__MigrationHistoryRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
コード例 #12
0
 public HopDongDOLABHocVienMappingRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
コード例 #13
0
 public UserStore(System.Data.Entity.DbContext context) : base(context)
 {
 }
コード例 #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));
 }
コード例 #15
0
 public AspNetUserRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
コード例 #16
0
 public SequentialIdProvider(System.Data.Entity.DbContext context)
 {
     _context = context;
 }
コード例 #17
0
 public MyConfig()
 {
     db = new Entities();
 }
コード例 #18
0
ファイル: DbContext.cs プロジェクト: rbrock/Sharp-Lite
        /// <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;
        }
コード例 #19
0
 public ServiceItemRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
コード例 #20
0
 public ProductRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
コード例 #21
0
 public MarkerRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
コード例 #22
0
 public CategoryRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
コード例 #23
0
 public AccountRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
コード例 #24
0
 public tbAppointmentStatuRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
コード例 #25
0
 public PlaceImageRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
コード例 #26
0
ファイル: BusRepository.cs プロジェクト: Vul4BP/web_2
 public BusRepository(System.Data.Entity.DbContext context) : base(context)
 {
 }
コード例 #27
0
ファイル: EFTypeRepository.cs プロジェクト: radtek/adServer
 /// <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);
 }
コード例 #28
0
 public sysdiagramRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
コード例 #29
0
 public InstitutionRepository(System.Data.Entity.DbContext context) : base(context)
 {
 }
コード例 #30
0
 public BrandRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
コード例 #31
0
 public VisualTypeRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
コード例 #32
0
 public BaseController(System.Data.Entity.DbContext dbContext)
 {
     service = new BaseService <T, TR, TV>(dbContext);
 }
コード例 #33
0
 public ThumbnailRepository(System.Data.Entity.DbContext context) : base(context)
 {
 }
コード例 #34
0
 public TrungTamGTVLRepository(System.Data.Entity.DbContext dbContext) : base(dbContext)
 {
 }
コード例 #35
0
 public UserStore(System.Data.Entity.DbContext applicationDBContext) : base(applicationDBContext)
 {
 }
コード例 #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;
        }
コード例 #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;
 }