コード例 #1
0
ファイル: StartServer.cs プロジェクト: xSLiveGit/mpp-cs
        static void Main(string[] args)
        {
            DatabaseConnectionManager databaseConnectionManager = new DatabaseConnectionManager();

            UserValidator   userValidator   = new UserValidator();
            MatchValidator  matchValidator  = new MatchValidator();
            TicketValidator ticketValidator = new TicketValidator();

            UserRepository   userRepository   = new UserRepository(databaseConnectionManager, "users", userValidator);
            TicketRepository ticketRepository = new TicketRepository(databaseConnectionManager, "tickets", ticketValidator);
            MatchRepository  matchRepository  = new MatchRepository(databaseConnectionManager, "matches", matchValidator);


            UserService   userService   = new UserService(userRepository);
            MatchService  matchService  = new MatchService(matchRepository);
            TicketService ticketService = new TicketService(ticketRepository, matchRepository);

            SellTicketsServer sellTicketsServer = new SellTicketsServer(ticketService, userService, matchService);
            ConcurrentServer  concurrentServer  = new SerialSellTicketsServer("127.0.0.1", 5555, sellTicketsServer);

            concurrentServer.Start();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            DatabaseConnectionManager databaseConnectionManager = new DatabaseConnectionManager();

            UserValidator   userValidator   = new UserValidator();
            MatchValidator  matchValidator  = new MatchValidator();
            TicketValidator ticketValidator = new TicketValidator();

            UserRepository   userRepository   = new UserRepository(databaseConnectionManager, "users", userValidator);
            TicketRepository ticketRepository = new TicketRepository(databaseConnectionManager, "tickets", ticketValidator);
            MatchRepository  matchRepository  = new MatchRepository(databaseConnectionManager, "matches", matchValidator);


            UserService   userService   = new UserService(userRepository);
            MatchService  matchService  = new MatchService(matchRepository);
            TicketService ticketService = new TicketService(ticketRepository, matchRepository);

            SellTicketsServer sellTicketsServer = new SellTicketsServer(ticketService, userService, matchService);

            var server = new Grpc.Core.Server
            {
                Services = { AppService.BindService(sellTicketsServer) },
                Ports    = { new ServerPort("localhost", 5555, ServerCredentials.Insecure) }
            };

            server.Start();
            while (true)
            {
                var line = Console.ReadLine();
                if (line != null && line.ToLower().Equals("exit"))
                {
                    server.ShutdownAsync().Wait();
                    break;
                }
            }
        }
コード例 #3
0
 public TicketerService(TicketRepository ticketRepository)
 {
     _ticketRepository = ticketRepository;
 }