Esempio n. 1
0
        public async Task <ChangeSetResponse> ServiceApplyChangeSet(ChangeSetRequest changeSet)
        {
            ICRUDOperationsUseCaseFactory factory        = ServiceContainer.CRUDOperationsUseCaseFactory;
            CRUDServiceMethods            serviceMethods = new CRUDServiceMethods(
                (err) => { _OnError(err); return(GetFriendlyErrorMessage(err)); },
                (row) => TrackChangesToEntity(row),
                async() =>
            {
                await ExecuteChangeSet();
            },
                async() =>
            {
                await AfterExecuteChangeSet(changeSet);
            },
                async(subResults) =>
            {
                await AfterChangeSetCommited(changeSet, subResults);
            });

            ICRUDOperationsUseCase uc = factory.Create(this, serviceMethods);

            IResponsePresenter <ChangeSetResponse, ChangeSetResponse> output = ServiceContainer.GetRequiredService <IResponsePresenter <ChangeSetResponse, ChangeSetResponse> >();

            bool res = await uc.Handle(changeSet, output);

            return(output.Response);
        }
 public CRUDOperationsUseCase(BaseDomainService service,
                              CRUDServiceMethods serviceMethods,
                              RequestDelegate <CRUDContext <TService> > pipeline)
 {
     _service          = service;
     _serviceContainer = (IServiceContainer <TService>)service.ServiceContainer;
     _serviceMethods   = serviceMethods;
     _pipeline         = pipeline;
 }
Esempio n. 3
0
 public ICRUDOperationsUseCase <TService> Create(TService service, CRUDServiceMethods serviceMethods)
 {
     return(_func(service, serviceMethods));
 }
Esempio n. 4
0
 public ICRUDOperationsUseCase Create(BaseDomainService service, CRUDServiceMethods serviceMethods)
 {
     return(_func(service, serviceMethods));
 }