public DataAccessServiceGeneric(IGetDbContext <TDbContext> getDbContextImpl) : base(getDbContextImpl) { SetBehaviorOfLoadTuple(new DataAccessGenericImpl <TDbContext, TEntity>(getDbContextImpl)); SetBehaviorOfAddTuple(new DataAccessGenericImpl <TDbContext, TEntity>(getDbContextImpl)); SetBehaviorOfModifyTuple(new DataAccessGenericImpl <TDbContext, TEntity>(getDbContextImpl)); SetBehaviorOfDeleteTuple(new DataAccessGenericImpl <TDbContext, TEntity>(getDbContextImpl)); }
private static int exec(IToCommand builder) { IGetDbContext db = builder as IGetDbContext ?? throw new ArgumentNullException(nameof(builder)); var cmd = builder.ToCommand(); try { if (cmd.Parameters != null && cmd.Parameters.Length > 0) { return(db.GetDbContext().Database.ExecuteSqlCommand(cmd.Sql, cmd.Parameters)); } else { return(db.GetDbContext().Database.ExecuteSqlCommand(cmd.Sql)); } } catch (Exception ex) { throw new Exception(ex.Message + " sql:" + cmd.Sql, ex); } }
public BaseDataAccessService(IGetDbContext <TDbContext> getDbContextImpl) : base(getDbContextImpl) { }
public TancleDbContext(IGetDbContext <TDbContext> getDbContextImpl) { _getDbContext = getDbContextImpl; }
public DataAccessGenericImpl(IGetDbContext <TDbContext> getDbContextImpl) : base(getDbContextImpl) { }