コード例 #1
0
        public override IEnumerable <Variable> FindVariables(IMethodVariables chain)
        {
            _store = chain.FindVariable(typeof(IDocumentStore));

            Session = chain.TryFindVariable(typeof(IDocumentSession), VariableSource.NotServices);
            if (Session == null)
            {
                _createsSession = true;
                Session         = new Variable(typeof(IDocumentSession), this);
            }

            _isUsingPersistence = chain.IsUsingMartenPersistence();

            // Inside of messaging. Not sure how this is gonna work for HTTP yet
            _context = chain.TryFindVariable(typeof(IMessageContext), VariableSource.NotServices);

            yield return(_store);

            if (_context != null)
            {
                yield return(_context);
            }
            if (Session != null)
            {
                yield return(Session);
            }
        }