public TAgent GetAgentFrom <TAgent>(string[] text, DateTime start, DateTime end) where TAgent : IAgent { //var sw = Stopwatch.StartNew(); IAgent foundAgent = null; var range = new DateRange(start, end); //var dateStorage = range.CreateDateIndexer(); EnableRangeFilter(start, end, 7); Session.CreateQuery(string.Format(@"select new {0}(t) from TimeBox t inner join fetch t.Agent a where a.AgentId in (:text)", typeof(TAgent).Name)) .SetParameterList("text", text) .SetResultTransformer(new ResultTransformer <TAgent>( tuple => new Dictionary <string, object> { { "timeBox", tuple[0] }, { "start", start }, { "end", end } })) .List(new ActionableList <IAgent>(o => { if (!o.Schedule.IsNew()) { foundAgent = o; } })); Session.DisableFilter("LargeRange"); //sw.Stop(); return(foundAgent.As <TAgent>()); }
public World( IFactory factory, string name ) { _agent = factory.CreateAgent< IThinking >( name ?? Settings.Worlds.Names.Default ); _thinking = _agent.As< IThinking >(); }