public void test() { Core.Identity.DomainIdentity domainIdentity = null; Backend.Infrastructure.IBackend backend = this.ninjectKernel.Get <Backend.Infrastructure.IBackend>("lest", new Ninject.Parameters.Parameter("domainIdentity", domainIdentity, true)); backend.Should().NotBeNull(); }
protected Backend.Infrastructure.IBackend LookForBackend(Core.Identity.UserIdentity userIdentity, Core.Identity.ClientIdentity clientIdentity) { Core.Identity.DomainIdentity domainIdentity = DomainIdentity.Create(userIdentity, clientIdentity); Backend.Infrastructure.IBackend backend = null; if (this.state != KernelState.initialized) { throw new Core.Exceptions.CoreNotInitializedException(); } this.backends.TryGetValue(domainIdentity, out backend); return(backend); }
internal virtual void AddUser(Core.Identity.UserIdentity userIdentity) { IEnumerable <Extensibility.IProducerPlugin> producers = this.ActivateProducers(userIdentity); foreach (Extensibility.IProducerPlugin producer in producers) { //producer.notifyNewDigitalInputs += handleNewDigitalInputsNotification; Observable.FromEventPattern <Core.Extensibility.Events.NotifyNewDigitalInputsEventHandler, Core.Extensibility.Events.NewDigitalInputsEventArgs>( h => producer.notifyNewDigitalInputs += h, h => producer.notifyNewDigitalInputs -= h ) .Subscribe( evt => { Backend.Infrastructure.IBackend backend = this.LookForBackend(evt.EventArgs.UserIdentity, evt.EventArgs.ClientIdentity); backend.saveDigitalInputs(evt.EventArgs.DigitalInputs); } ); //producer.notifyDeletedSources += handleDeletedSourcesNotification; Observable.FromEventPattern <Core.Extensibility.Events.NotifyRemovedSourcesEventHandler, Core.Extensibility.Events.RemovedDigitalInputsEventArgs>( h => producer.notifyRemovedSources += h, h => producer.notifyRemovedSources -= h ) .Subscribe( evt => { Backend.Infrastructure.IBackend backend = this.LookForBackend(evt.EventArgs.UserIdentity, evt.EventArgs.ClientIdentity); backend.deleteSources(evt.EventArgs.Sources); } ); this.BindBackendFor(userIdentity, producer.ProducerInfo.Identity);// userIdentity.BackendKey); log4net.LogManager.GetLogger("").Info(string.Format("Configuring (prod: {0} - user: {1})", producer.ProducerInfo.Name, userIdentity.UserId)); producer.Initialize(); this.producers.Add(producer); } }
private string handleNewDigitalInputsNotification(Core.Identity.ClientIdentity clientIdentity, Core.Identity.UserIdentity userIdentity, IEnumerable <Backend.Domain.DigitalInput> digitalInputs) { Backend.Infrastructure.IBackend backend = this.LookForBackend(userIdentity, clientIdentity); return(backend.saveDigitalInputs(digitalInputs)); }
private void handleDeletedSourcesNotification(Core.Identity.ClientIdentity clientIdentity, Core.Identity.UserIdentity userIdentity, IEnumerable <Backend.Domain.Source.SourceId> sourceIds) { Backend.Infrastructure.IBackend backend = this.LookForBackend(userIdentity, clientIdentity); backend.deleteSources(sourceIds); }