private static IUnityContainer ResolveCommonDependenciesForMainContainer(bool useSignalRLog, bool verbose) { var mainContainer = new UnityContainer(); var log = useSignalRLog ? (ILogger)SignalRLogger.GetResolvedSignalRLogger(verbose) : new ConsoleLogger(verbose); mainContainer.RegisterInstance <ILogger>(log); mainPublisher = new InMemoryEventPublisher(log); var serializer = new JsonTextSerializer(); mainContainer.RegisterInstance <ITextSerializer>(serializer); var time = new UtcTimeProvider() as IUtcTimeProvider; mainContainer.RegisterInstance <IUtcTimeProvider>(time); mainContainer.RegisterInstance <IGuidProvider>(new SequentialGuid()); // Do not share this with child dependencies mainContainer.RegisterInstance <IBus>(new Bus()); return(mainContainer); }
public LongPoller(IBus bus, ILogger log, TimeSpan timeout, string pollerName, IInMemoryEventPublisher inMemoryPublisher) : base(bus) { Ensure.NotNullNeitherEmtpyNorWhiteSpace(pollerName, "pollerName"); Ensure.NotNull(log, "log"); if (timeout.TotalSeconds <= 1) throw new ArgumentOutOfRangeException("timeout", "The timeout value must be greater than one second."); this.inMemoryPublisher = inMemoryPublisher; //if it is null, then it means that the poller is absolutely remote. this.timeout = timeout; this.log = log; this.pollerName = pollerName; // More info:http://stackoverflow.com/questions/3210393/how-do-i-remove-all-non-alphanumeric-characters-from-a-string-except-dash this.pollerName = new string(pollerName.Where(x => x != '.').ToArray()); }
public LongPoller(IBus bus, ILogger log, TimeSpan timeout, string pollerName, IInMemoryEventPublisher inMemoryPublisher) : base(bus) { Ensure.NotNullNeitherEmtpyNorWhiteSpace(pollerName, "pollerName"); Ensure.NotNull(log, "log"); if (timeout.TotalSeconds <= 1) { throw new ArgumentOutOfRangeException("timeout", "The timeout value must be greater than one second."); } this.inMemoryPublisher = inMemoryPublisher; //if it is null, then it means that the poller is absolutely remote. this.timeout = timeout; this.log = log; this.pollerName = pollerName; // More info:http://stackoverflow.com/questions/3210393/how-do-i-remove-all-non-alphanumeric-characters-from-a-string-except-dash this.pollerName = new string(pollerName.Where(x => x != '.').ToArray()); }