public void Execute( CreateStreamUserOp operation) { operation.MustForArg(nameof(operation)).NotBeNull(); operation.LoginName.MustForArg(nameof(operation)) .NotBeEqualTo( operation.UserName, "Sql Server does not like the loginName and userName being the same and they must be different."); var allLocators = this.ResourceLocatorProtocols.Execute(new GetAllResourceLocatorsOp()); foreach (var resourceLocator in allLocators) { var sqlServerLocator = resourceLocator.ConfirmAndConvert <SqlServerLocator>(); var roles = operation .StreamAccessKinds .GetIndividualFlags <StreamAccessKinds>() .Select(_ => StreamSchema.GetRoleNameFromStreamAccessKind(_, this.Name)) .ToList(); var rolesCsv = roles.ToCsv(); var storedProcOp = StreamSchema.Sprocs.CreateStreamUser.BuildExecuteStoredProcedureOp( this.Name, operation.LoginName, operation.UserName, operation.ClearTextPassword, rolesCsv, operation.ShouldCreateLogin); var sqlProtocol = this.BuildSqlOperationsProtocol(sqlServerLocator); var sprocResult = sqlProtocol.Execute(storedProcOp); } }
/// <inheritdoc /> public async Task ExecuteAsync( CreateStreamUserOp operation) { this.Execute(operation); await Task.FromResult(true); // just for await }