public StatelessSessionImpl(RulesEngine rulesEngine, Cache <Type, ActivationTypeProxy> objectCache)
 {
     _rulesEngine = rulesEngine;
     _objectCache = objectCache;
     _memoryCache = new ConcurrentCache <int, ContextMemory>();
     _facts       = new FactCache();
     _agenda      = new AgendaImpl();
 }
        public FactHandle Activate(RulesEngine rulesEngine,
                                   ActivationContext baseContext,
                                   FactCache factCache,
                                   object obj)
        {
            var fact = obj as T;

            if (fact == null)
            {
                throw new ArgumentNullException("fact");
            }

            ActivationContext <T> context = baseContext.CreateContext(fact);

            rulesEngine.Activate(context);

            return(factCache.Add(context));
        }