public EntityFrameworkRepository(IRepositoryContext context)
 {
     if (context is IEntityFrameworkRepositoryContext)
     {
         this._efContext = context as IEntityFrameworkRepositoryContext;
     }
 }
Ejemplo n.º 2
0
 public EntityFrameworkRepository(IRepositoryContext iRepositoryContext) : base(iRepositoryContext)
 {
     if (iRepositoryContext is IEntityFrameworkRepositoryContext)
     {
         this._EFContext = iRepositoryContext as IEntityFrameworkRepositoryContext;
     }
 }
Ejemplo n.º 3
0
 public BaseRepository(IRepositoryContext context)
     : base(context)
 {
     if (context is IEntityFrameworkRepositoryContext)
     {
         _baseContext = context as IEntityFrameworkRepositoryContext;
     }
 }
Ejemplo n.º 4
0
        public CategoryRepository(IRepositoryContext context)
        {
            var efContext = context as IEntityFrameworkRepositoryContext;

            if (efContext != null)
            {
                this._efContext = efContext;
            }
        }
        protected EntityFrameworkRepository(IRepositoryContext context)
        {
            var efContext = context as IEntityFrameworkRepositoryContext;

            if (efContext != null)
            {
                this._efContext = efContext;
            }
        }
Ejemplo n.º 6
0
        public ProductRepository(IRepositoryContext context)
        {
            var efContext = context as IEntityFrameworkRepositoryContext;

            if (efContext != null)
            {
                this.efContext = efContext;
            }
        }
Ejemplo n.º 7
0
        //IOC注册EF仓储上下文
        public EntityFrameworkRepository(IRepositoryContext context)
        {
            var ctx = context as IEntityFrameworkRepositoryContext;

            if (ctx != null)
            {
                this.efContext = ctx;
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 初始化一个新的<c>EntityFrameworkRepository</c>实例
        /// </summary>
        /// <param name="context">仓储上下文。为 EntityFrameworkRepositoryContext 上下文</param>
        public EntityFrameworkRepository(IRepositoryContext context)
            : base(context)
        {
            var repositoryContext = context as IEntityFrameworkRepositoryContext;

            if (repositoryContext != null)
            {
                this.efContext = repositoryContext;
            }
        }
Ejemplo n.º 9
0
        private static DbContext CastOrThrow(IEntityFrameworkRepositoryContext context)
        {
            DbContext output = (context as DbContext);

            if (output == null)
            {
                throw new InvalidOperationException("Context does not support operation.");
            }

            return(output);
        }
Ejemplo n.º 10
0
        private static T InnerGetCopy <T>(IEntityFrameworkRepositoryContext context, T currentCopy, Func <DbEntityEntry <T>, DbPropertyValues> func) where T : Entity
        {
            //Get the database context
            DbContext dbContext = CastOrThrow(context);

            //Get the entity tracking object
            DbEntityEntry <T> entry = GetEntityOrReturnNull(currentCopy, dbContext);

            //The output
            T output = null;

            //Try and get the values
            if (entry != null)
            {
                DbPropertyValues dbPropertyValues = func(entry);
                if (dbPropertyValues != null)
                {
                    output = dbPropertyValues.ToObject() as T;
                }
            }

            return(output);
        }
Ejemplo n.º 11
0
 public RoleRepository(IEntityFrameworkRepositoryContext Context) : base(Context)
 {
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Loads the database copy.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="context">The context.</param>
 /// <param name="currentCopy">The current copy.</param>
 /// <returns></returns>
 public static T LoadDatabaseCopy <T>(this IEntityFrameworkRepositoryContext context, T currentCopy) where T : Entity
 {
     return(InnerGetCopy(context, currentCopy, e => e.GetDatabaseValues()));
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Loads the original copy.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="context">The context.</param>
 /// <param name="currentCopy">The current copy.</param>
 /// <returns></returns>
 public static T LoadOriginalCopy <T>(this IEntityFrameworkRepositoryContext context, T currentCopy) where T : Entity
 {
     return(InnerGetCopy(context, currentCopy, e => e.OriginalValues));
 }
Ejemplo n.º 14
0
 public UserManagerRepository(IEntityFrameworkRepositoryContext Context) : base(Context)
 {
 }
Ejemplo n.º 15
0
 public EntityFrameworkRepository(IEntityFrameworkRepositoryContext context)
     : base(context)
 {
     this.tempContext = context;
 }
Ejemplo n.º 16
0
 public ButtonRepository(IEntityFrameworkRepositoryContext Context) : base(Context)
 {
 }
Ejemplo n.º 17
0
 public EntityFrameworkRepository(IEntityFrameworkRepositoryContext Context)
 {
     this.EFContext = Context;
 }
 public OperationalLogRepository(IEntityFrameworkRepositoryContext Context) : base(Context)
 {
 }
Ejemplo n.º 19
0
 public DepartmentRepository(IEntityFrameworkRepositoryContext Context) : base(Context)
 {
 }
Ejemplo n.º 20
0
 public UserLoginRepository(IEntityFrameworkRepositoryContext Context) : base(Context)
 {
 }
 public CategoryRepository(IRepositoryContext context)
 {
     var efContext = context as IEntityFrameworkRepositoryContext;
     if (efContext != null)
         this._efContext = efContext;
 }
Ejemplo n.º 22
0
 public UserRepository(IEntityFrameworkRepositoryContext context) : base(context)
 {
 }