示例#1
0
        public AccountModule(
            [Import(typeof(IServerInterceptor))] IServerInterceptor server,
            [ImportMany(typeof(ICommand))] IEnumerable <ICommand> commands,
            [Import(typeof(IDatabaseContextFactory))] IDatabaseContextFactory contextFactory)
        {
            if (server == null)
            {
                throw new ArgumentNullException(nameof(server));
            }

            if (commands == null)
            {
                throw new ArgumentNullException(nameof(commands));
            }

            if (contextFactory == null)
            {
                throw new ArgumentNullException(nameof(contextFactory));
            }

            this.commandCollection                  = new CommandCollection(commands);
            server.Clients.ClientConnect           += this.ClientsClientConnect;
            this.contextFactory                     = contextFactory;
            this.accountController                  = new AccountController(contextFactory);
            this.accountController.ClientLoggedIn  += this.AccountControllerClientLoggedIn;
            this.accountController.ClientLoggedOut += this.AccountControllerClientLoggedOut;
        }
示例#2
0
 public DemoPlugin([Import] IServer server, [Import] IServerInterceptor interceptor)
 {
     server.Initialize               += this.ServerInitialize;
     server.Clients.ClientConnect    += Clients_ClientConnect;
     server.Clients.ClientDisconnect += Clients_ClientDisconnect;
 }