public EntityFrameworkRepository(IRepositoryContext context) { if (context is IEntityFrameworkRepositoryContext) { this._efContext = context as IEntityFrameworkRepositoryContext; } }
public EntityFrameworkRepository(IRepositoryContext iRepositoryContext) : base(iRepositoryContext) { if (iRepositoryContext is IEntityFrameworkRepositoryContext) { this._EFContext = iRepositoryContext as IEntityFrameworkRepositoryContext; } }
public BaseRepository(IRepositoryContext context) : base(context) { if (context is IEntityFrameworkRepositoryContext) { _baseContext = context as IEntityFrameworkRepositoryContext; } }
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; } }
public ProductRepository(IRepositoryContext context) { var efContext = context as IEntityFrameworkRepositoryContext; if (efContext != null) { this.efContext = efContext; } }
//IOC注册EF仓储上下文 public EntityFrameworkRepository(IRepositoryContext context) { var ctx = context as IEntityFrameworkRepositoryContext; if (ctx != null) { this.efContext = ctx; } }
/// <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; } }
private static DbContext CastOrThrow(IEntityFrameworkRepositoryContext context) { DbContext output = (context as DbContext); if (output == null) { throw new InvalidOperationException("Context does not support operation."); } return(output); }
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); }
public RoleRepository(IEntityFrameworkRepositoryContext Context) : base(Context) { }
/// <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())); }
/// <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)); }
public UserManagerRepository(IEntityFrameworkRepositoryContext Context) : base(Context) { }
public EntityFrameworkRepository(IEntityFrameworkRepositoryContext context) : base(context) { this.tempContext = context; }
public ButtonRepository(IEntityFrameworkRepositoryContext Context) : base(Context) { }
public EntityFrameworkRepository(IEntityFrameworkRepositoryContext Context) { this.EFContext = Context; }
public OperationalLogRepository(IEntityFrameworkRepositoryContext Context) : base(Context) { }
public DepartmentRepository(IEntityFrameworkRepositoryContext Context) : base(Context) { }
public UserLoginRepository(IEntityFrameworkRepositoryContext Context) : base(Context) { }
public CategoryRepository(IRepositoryContext context) { var efContext = context as IEntityFrameworkRepositoryContext; if (efContext != null) this._efContext = efContext; }
public UserRepository(IEntityFrameworkRepositoryContext context) : base(context) { }