public async Task <Robot> CreateAsync(Robot value) => await ManagerInvoker.Current.InvokeAsync(this, async() => { await value.Validate().Mandatory().RunAsync(throwOnError: true).ConfigureAwait(false); value.Id = await _guidIdentifierGenerator.GenerateIdentifierAsync <Robot>().ConfigureAwait(false); Cleaner.CleanUp(value); await value.Validate().Entity().With <IValidator <Robot> >().RunAsync(throwOnError: true).ConfigureAwait(false); return(Cleaner.Clean(await _dataService.CreateAsync(value).ConfigureAwait(false))); }, BusinessInvokerArgs.Create).ConfigureAwait(false);
public Task <Robot> CreateAsync(Robot value) { value.Validate(nameof(value)).Mandatory().Run().ThrowOnError(); return(ManagerInvoker.Current.InvokeAsync(this, async() => { ExecutionContext.Current.OperationType = OperationType.Create; Cleaner.CleanUp(value); value.Validate(nameof(value)).Entity(RobotValidator.Default).Run().ThrowOnError(); return Cleaner.Clean(await _dataService.CreateAsync(value).ConfigureAwait(false)); })); }