internal Query(ISession session, SqlQuery sourceQuery) { Session = session; SourceQuery = sourceQuery; Context = session.Context.CreateQueryContext(); Context.RegisterInstance <IQuery>(this); StartedOn = DateTimeOffset.UtcNow; metadata = GetMetadata(); }
internal Query(ISession session, SqlQuery sourceQuery) : base(session as IEventSource) { Session = session; SourceQuery = sourceQuery; Context = session.Context.CreateQueryContext(); Context.RegisterInstance <IQuery>(this); StartedOn = DateTimeOffset.UtcNow; Access = new RequestAccess(this); }
public Block(IRequest request) { if (request == null) { throw new ArgumentNullException("request"); } query = request as IQuery; Context = request.CreateBlockContext(); Context.UnregisterService <IBlock>(); Context.RegisterInstance <IBlock>(this); Parent = request as IBlock; }
internal Block(IRequest request) : base(request as IEventSource) { if (request == null) { throw new ArgumentNullException("request"); } query = request as IQuery; Context = request.Context.CreateBlockContext(); Context.UnregisterService <IBlock>(); Context.RegisterInstance <IBlock>(this); Parent = request as IBlock; Access = new RequestAccess(this); }
public SystemSession(ITransaction transaction, string currentSchema) { if (String.IsNullOrEmpty(currentSchema)) { throw new ArgumentNullException("currentSchema"); } if (transaction == null) { throw new ArgumentNullException("transaction"); } CurrentSchema = currentSchema; Transaction = transaction; Context = transaction.Context.CreateSessionContext(); Context.RegisterInstance(this); User = new User(this, User.SystemName); startedOn = DateTimeOffset.UtcNow; Access = new SessionAccess(this); }
/// <summary> /// Constructs the session for the given user and transaction to the /// given database. /// </summary> /// <param name="transaction">A transaction that handles the commands issued by /// the user during the session.</param> /// <param name="userName"></param> /// <seealso cref="ITransaction"/> public Session(ITransaction transaction, string userName) : base(transaction as IEventSource) { if (transaction == null) { throw new ArgumentNullException("transaction"); } if (String.IsNullOrEmpty(userName)) { throw new ArgumentNullException("userName"); } if (String.Equals(userName, User.SystemName, StringComparison.OrdinalIgnoreCase) || String.Equals(userName, User.PublicName, StringComparison.OrdinalIgnoreCase)) { throw new ArgumentException(String.Format("Cannot open a session for user '{0}'.", userName)); } Transaction = transaction; Context = transaction.Context.CreateSessionContext(); Context.RegisterInstance(this); Transaction.Context.Route <QueryEvent>(OnQueryCommand); Transaction.GetTableManager().AddInternalTables(new SessionTableContainer(this)); access = new SessionAccess(this); if (!transaction.Database.Sessions.Add(this)) { throw new InvalidOperationException("The session was already in the database session list"); } User = new User(this, userName); startedOn = DateTimeOffset.UtcNow; this.OnEvent(new SessionEvent(SessionEventType.Begin)); }