private void EnsureSessionOpen(IDapperSession session) { if (session.State != ConnectionState.Open) { session.Open(); } }
public EntityBuilder(IDapperSession session, Expression <Func <T, bool> > expression, IDapperImplementor dapperImplementor) { _dapperImplementor = dapperImplementor; _session = session; _expression = expression; _sort = new List <ISort>(); }
public EntityQuery(IDapperImplementor implementor, IDapperSession session, Expression <Func <T, bool> > expression) { _session = session; _expression = expression; _implementor = implementor; _sort = new List <ISort>(); }
public virtual IEntityBuilder <T> Query(Expression <Func <T, bool> > predicate) { return(new EntityBuilder <T>(() => { IDapperSession session = GetCurrentSession(); return session.GetList <T>(QueryBuilder <T> .FromExpression(predicate), null, session.Transaction); })); }
public void Unbind() { if (_sessionDictionary == null) { return; } List <string> keys = _sessionDictionary.Keys.ToList(); foreach (var conString in keys) { IDapperSession session = _sessionDictionary[conString]; if (session.Transaction != null) { session.Transaction.Rollback(); session.Transaction.Dispose(); session.Transaction = null; } session.Close(); session.Dispose(); } _sessionDictionary = null; }
public virtual bool Delete(Expression <Func <T, bool> > predicate = null) { IDapperSession session = GetCurrentSession(); return(session.Delete <T>(QueryBuilder <T> .FromExpression(predicate), session.Transaction)); }
public EntityBuilder(IDapperSession session, Expression <Func <T, bool> > expression) { _session = session; _expression = expression; _sort = new List <ISort>(); }
public DapperRepository() { _dapperImplementor = new DapperImplementor(new SqlGeneratorImpl(DapperConfiguration.Instance)); _sessionContext = new DapperSessionContext(); session = _sessionContext.GetSession <T>(); }