示例#1
0
        public UseCaseFactory(IActivitiesFactory activitiesFactory)
        {
            // Extension point of the factory
            this.collection.Add(typeof(IUseCase <EnterRequestEvent, EnterResponseEvent>),
                                new LoginUseCase(
                                    activitiesFactory.Create <IValidationActivity <EnterRequestEvent> >(),
                                    activitiesFactory.Create <IRequestActivity <EnterRequestEvent, EnterResponseEvent, IUserRepository> >(),
                                    activitiesFactory.Create <IValidationActivity <EnterResponseEvent> >()
                                    ));

            this.collection.Add(typeof(IUseCase <EditUserRequestEvent, EditUserResponseEvent>),
                                new EditUserUseCase(
                                    activitiesFactory.Create <IValidationActivity <EditUserRequestEvent> >(),
                                    activitiesFactory.Create <IRequestActivity <EditUserRequestEvent, EditUserResponseEvent, IUserRepository> >(),
                                    activitiesFactory.Create <IRequestActivity <EditAccountRequestEvent, EditAccountResponseEvent, IAccountRepository> >(),
                                    activitiesFactory.Create <IValidationActivity <AccessLevelCheckEvent> >()
                                    ));

            this.collection.Add(typeof(IUseCase <GetNotesRequestEvent, GetNotesResponseEvent>),
                                new GetNotesUseCase(
                                    activitiesFactory.Create <IRequestActivity <GetNotesRequestEvent, GetNotesResponseEvent, INoteRepository> >()
                                    ));

            this.collection.Add(typeof(IUseCase <EditNoteRequestEvent, EditNoteResponseEvent>),
                                new EditNoteUseCase(
                                    activitiesFactory.Create <IValidationActivity <EditNoteRequestEvent> >(),
                                    activitiesFactory.Create <IRequestActivity <EditNoteRequestEvent, EditNoteResponseEvent, INoteRepository> >()
                                    ));

            this.collection.Add(typeof(IUseCase <ChangeUserStatusRequestEvent, ChangeUserStatusResponseEvent>),
                                new ChangeUserStatusUseCase(
                                    activitiesFactory.Create <IRequestActivity <ChangeUserStatusRequestEvent, ChangeUserStatusResponseEvent, IUserRepository> >()
                                    ));

            this.collection.Add(typeof(IUseCase <CreateUserRequestEvent, CreateUserResponseEvent>),
                                new RegistrationUseCase(
                                    activitiesFactory.Create <IRequestActivity <CreateAccountRequestEvent, CreateAccountResponseEvent, IAccountRepository> >(),
                                    activitiesFactory.Create <IRequestActivity <CreateUserRequestEvent, CreateUserResponseEvent, IUserRepository> >()
                                    ));

            this.collection.Add(typeof(IUseCase <DeleteUserRequestEvent, DeleteUserResponseEvent>),
                                new DeleteUserUseCase(
                                    activitiesFactory.Create <IRequestActivity <DeleteUserRequestEvent, DeleteUserResponseEvent, IUserRepository> >()
                                    ));
        }
        public UseCaseFactory(IActivitiesFactory activitiesFactory, Logger logger)
        {
            this.logger = logger;

            #region User

            collection.Add(typeof(IUseCase <GetUserByIdInputData, GetUserByIdOutputData>),
                           new GetUserByIdUseCase(
                               activitiesFactory.Create <IRequestActivity <GetUserByIdInputData, GetUserByIdOutputData> >(), logger
                               ));

            collection.Add(typeof(IUseCase <GetUserByEmailInputData, GetUserByEmailOutputData>),
                           new GetUserByEmailUserCase(
                               activitiesFactory.Create <IRequestActivity <GetUserByEmailInputData, GetUserByEmailOutputData> >(),
                               logger
                               ));

            collection.Add(typeof(IUseCase <UpdateContactInfoByIdInputData, UpdateContactInfoByIdOutputData>),
                           new UpdateContactInfoByIdUseCase(
                               activitiesFactory
                               .Create <IRequestActivity <UpdateContactInfoByIdInputData, UpdateContactInfoByIdOutputData> >(),
                               logger
                               ));

            #endregion

            #region Group

            collection.Add(typeof(IUseCase <CreateGroupInputData, CreateGroupOutputData>),
                           new CreateGroupUseCase(
                               activitiesFactory.Create <IRequestActivity <CreateGroupInputData, CreateGroupOutputData> >(), logger
                               ));

            collection.Add(typeof(IUseCase <GetGroupByIdInputData, GetGroupByIdOutputData>),
                           new GetGroupByIdUseCase(
                               activitiesFactory.Create <IRequestActivity <GetGroupByIdInputData, GetGroupByIdOutputData> >(), logger
                               ));

            collection.Add(typeof(IUseCase <GetGroupByNameInputData, GetGroupByNameOutputData>),
                           new GetGroupByNameUseCase(
                               activitiesFactory.Create <IRequestActivity <GetGroupByNameInputData, GetGroupByNameOutputData> >(),
                               logger
                               ));

            collection.Add(typeof(IUseCase <GetListGroupMemberByIdInputData, GetListGroupMemberByIdOutputData>),
                           new GetListGroupMemberByIdUseCase(
                               activitiesFactory
                               .Create <IRequestActivity <GetListGroupMemberByIdInputData, GetListGroupMemberByIdOutputData> >(),
                               logger
                               ));

            collection.Add(typeof(IUseCase <GetListGroupInputData, GetListGroupOutputData>),
                           new GetListGroupUseCase(
                               activitiesFactory.Create <IRequestActivity <GetListGroupInputData, GetListGroupOutputData> >(), logger
                               ));

            collection.Add(typeof(IUseCase <JoinUserToGroupByIdInputData, JoinUserToGroupByIdOutputData>),
                           new JoinUserToGroupByIdUseCase(
                               activitiesFactory
                               .Create <IRequestActivity <JoinUserToGroupByIdInputData, JoinUserToGroupByIdOutputData> >(), logger
                               ));

            #endregion

            #region Team

            collection.Add(typeof(IUseCase <CrateTeamFromGroupByIdInputData, CrateTeamFromGroupByIdOutputData>),
                           new CrateTeamFromGroupByIdUseCase(
                               activitiesFactory
                               .Create <IRequestActivity <CrateTeamFromGroupByIdInputData, CrateTeamFromGroupByIdOutputData> >(),
                               logger
                               ));

            collection.Add(typeof(IUseCase <CreateOrAddTeamInputData, CreateOrAddTeamOutputData>),
                           new CreateOrAddTeamUseCase(
                               activitiesFactory.Create <IRequestActivity <CreateOrAddTeamInputData, CreateOrAddTeamOutputData> >()
                               ));

            collection.Add(typeof(IUseCase <GetListTeamMemberByIdInputData, GetListTeamMemberByIdOutputData>),
                           new GetListTeamMemberByIdUseCase(
                               activitiesFactory
                               .Create <IRequestActivity <GetListTeamMemberByIdInputData, GetListTeamMemberByIdOutputData> >(),
                               logger
                               ));

            collection.Add(typeof(IUseCase <GetTeamByIdInputData, GetTeamByIdOutputData>),
                           new GetTeamByIdUseCase(
                               activitiesFactory.Create <IRequestActivity <GetTeamByIdInputData, GetTeamByIdOutputData> >(), logger
                               ));

            collection.Add(typeof(IUseCase <JoinUsersToTeamByIdInputData, JoinUsersToTeamByIdOutputData>),
                           new JoinUsersToTeamByIdUseCase(
                               activitiesFactory
                               .Create <IRequestActivity <JoinUsersToTeamByIdInputData, JoinUsersToTeamByIdOutputData> >(), logger
                               ));

            #endregion
        }
示例#3
0
        public UseCaseFactory(IActivitiesFactory activitiesFactory)
        {
            // Extension point of the factory
            this.collection.Add(typeof(IUseCase <LoginRequestEvent, LoginResponseEvent>),
                                new LoginUseCase(activitiesFactory.Create <IValidationActivity <LoginRequestEvent> >(),
                                                 activitiesFactory.Create <IRequestActivity <LoginRequestEvent, LoginResponseEvent> >()));

            this.collection.Add(typeof(IUseCase <CreateAccountRequestEvent, CreateAccountResponseEvent>),
                                new CreateAccountUseCase(activitiesFactory.Create <IValidationActivity <CreateAccountRequestEvent> >(),
                                                         activitiesFactory.Create <IRequestActivity <CreateAccountRequestEvent, CreateAccountResponseEvent> >()));


            this.collection.Add(typeof(IUseCase <GetAccountByIdRequestEvent, GetAccountByIdResponseEvent>),
                                new GetAccountByIdUseCase(activitiesFactory.Create <IRequestActivity <GetAccountByIdRequestEvent, GetAccountByIdResponseEvent> >()));

            this.collection.Add(typeof(IUseCase <GetAllAccountRequestEvent, GetAllAccountResponseEvent>),
                                new GetAllAccountUseCase(activitiesFactory.Create <IRequestActivity <GetAllAccountRequestEvent, GetAllAccountResponseEvent> >()));


            this.collection.Add(typeof(IUseCase <CreateEmployeeRequestEvent, CreateEmployeeResponseEvent>),
                                new CreateEmployeeUseCase(activitiesFactory.Create <IRequestActivity <CreateEmployeeRequestEvent, CreateEmployeeResponseEvent> >()));
            this.collection.Add(typeof(IUseCase <GetAllEmployeeRequestEvent, GetAllEmployeeResponseEvent>),
                                new GetAllEmployeeUseCase(activitiesFactory.Create <IRequestActivity <GetAllEmployeeRequestEvent, GetAllEmployeeResponseEvent> >()));
            this.collection.Add(typeof(IUseCase <GetEmployeeByIdRequestEvent, GetEmployeeByIdResponseEvent>),
                                new GetEmployeeByIdUseCase(activitiesFactory.Create <IRequestActivity <GetEmployeeByIdRequestEvent, GetEmployeeByIdResponseEvent> >()));
            this.collection.Add(typeof(IUseCase <GetEmployeeByAccountIdRequestEvent, GetEmployeeByAccountIdResponseEvent>),
                                new GetEmployeeByAccountIdUseCase(activitiesFactory.Create <IRequestActivity <GetEmployeeByAccountIdRequestEvent, GetEmployeeByAccountIdResponseEvent> >()));
            this.collection.Add(typeof(IUseCase <GetCountEmployeeByTeamIdRequestEvent, GetCountEmployeeByTeamIdResponseEvent>),
                                new GetCountEmployeeByTeamIdUseCase(activitiesFactory.Create <IRequestActivity <GetCountEmployeeByTeamIdRequestEvent, GetCountEmployeeByTeamIdResponseEvent> >()));



            this.collection.Add(typeof(IUseCase <CreateTeamRequestEvent, CreateTeamResponseEvent>),
                                new CreateTeamUseCase(activitiesFactory.Create <IRequestActivity <CreateTeamRequestEvent, CreateTeamResponseEvent> >()));
            this.collection.Add(typeof(IUseCase <GetAllTeamRequestEvent, GetAllTeamResponseEvent>),
                                new GetAllTeamUseCase(activitiesFactory.Create <IRequestActivity <GetAllTeamRequestEvent, GetAllTeamResponseEvent> >()));
            this.collection.Add(typeof(IUseCase <GetTeamByIdRequestEvent, GetTeamByIdResponseEvent>),
                                new GetTeamByIdUseCase(activitiesFactory.Create <IRequestActivity <GetTeamByIdRequestEvent, GetTeamByIdResponseEvent> >()));

            this.collection.Add(typeof(IUseCase <CreateProjectRequestEvent, CreateProjectResponseEvent>),
                                new CreateProjectUseCase(activitiesFactory.Create <IRequestActivity <CreateProjectRequestEvent, CreateProjectResponseEvent> >()));
            this.collection.Add(typeof(IUseCase <UpdateProjectRequestEvent, UpdateProjectResponseEvent>),
                                new UpdateProjectUseCase(activitiesFactory.Create <IRequestActivity <UpdateProjectRequestEvent, UpdateProjectResponseEvent> >()));
            this.collection.Add(typeof(IUseCase <GetAllProjectRequestEvent, GetAllProjectResponseEvent>),
                                new GetAllProjectUseCase(activitiesFactory.Create <IRequestActivity <GetAllProjectRequestEvent, GetAllProjectResponseEvent> >()));
            this.collection.Add(typeof(IUseCase <GetProjectByIdRequestEvent, GetProjectByIdResponseEvent>),
                                new GetProjectByIdUseCase(activitiesFactory.Create <IRequestActivity <GetProjectByIdRequestEvent, GetProjectByIdResponseEvent> >()));
            this.collection.Add(typeof(IUseCase <GetProjectByTeamIdRequestEvent, GetProjectByTeamIdResponseEvent>),
                                new GetProjectByTeamIdUseCase(activitiesFactory.Create <IRequestActivity <GetProjectByTeamIdRequestEvent, GetProjectByTeamIdResponseEvent> >()));

            this.collection.Add(typeof(IUseCase <CreateProjectTaskRequestEvent, CreateProjectTaskResponseEvent>),
                                new CreateProjectTaskUseCase(activitiesFactory.Create <IRequestActivity <CreateProjectTaskRequestEvent, CreateProjectTaskResponseEvent> >()));
            this.collection.Add(typeof(IUseCase <UpdateProjectTaskRequestEvent, UpdateProjectTaskResponseEvent>),
                                new UpdateProjectTaskUseCase(activitiesFactory.Create <IRequestActivity <UpdateProjectTaskRequestEvent, UpdateProjectTaskResponseEvent> >()));
            this.collection.Add(typeof(IUseCase <GetAllProjectTaskRequestEvent, GetAllProjectTaskResponseEvent>),
                                new GetAllProjectTaskUseCase(activitiesFactory.Create <IRequestActivity <GetAllProjectTaskRequestEvent, GetAllProjectTaskResponseEvent> >()));
            this.collection.Add(typeof(IUseCase <GetProjectTaskByIdRequestEvent, GetProjectTaskByIdResponseEvent>),
                                new GetProjectTaskByIdUseCase(activitiesFactory.Create <IRequestActivity <GetProjectTaskByIdRequestEvent, GetProjectTaskByIdResponseEvent> >()));
            this.collection.Add(typeof(IUseCase <GetTaskListByEmployeeIdRequestEvent, GetTaskListByEmployeeIdResponseEvent>),
                                new GetProjectTaskByEmployeeIdUseCase(activitiesFactory.Create <IRequestActivity <GetTaskListByEmployeeIdRequestEvent, GetTaskListByEmployeeIdResponseEvent> >()));

            this.collection.Add(typeof(IUseCase <GetCountTaskByProjectIdRequestEvent, GetCountTaskByProjectIdResponseEvent>),
                                new GetCountProjectTaskByProjectIdUseCase(activitiesFactory.Create <IRequestActivity <GetCountTaskByProjectIdRequestEvent, GetCountTaskByProjectIdResponseEvent> >()));
            this.collection.Add(typeof(IUseCase <GetCountSuccessTaskByProjectIdRequestEvent, GetCountSuccessTaskByProjectIdResponseEvent>),
                                new GetCountSuccessProjectTaskByProjectIdUseCase(activitiesFactory.Create <IRequestActivity <GetCountSuccessTaskByProjectIdRequestEvent, GetCountSuccessTaskByProjectIdResponseEvent> >()));


            this.collection.Add(typeof(IUseCase <GetAllCustomerRequestEvent, GetAllCustomerResponseEvent>),
                                new GetAllCustomerUseCase(activitiesFactory.Create <IRequestActivity <GetAllCustomerRequestEvent, GetAllCustomerResponseEvent> >()));
            this.collection.Add(typeof(IUseCase <GetCustomerByIdRequestEvent, GetCustomerByIdResponseEvent>),
                                new GetCustomerByIdUseCase(activitiesFactory.Create <IRequestActivity <GetCustomerByIdRequestEvent, GetCustomerByIdResponseEvent> >()));
        }