private void HandleConnectionString(ConnectionStringRegistrationRequest @event) { if (_connectionStrings.Any(x => x.Name == @event.Name && x.ConnectionString != @event.ConnectionString)) { throw new Exception($"Misconfiguration in [{GetType().Name}]: ConnectionString with name [{@event.Name}] already defined with different value to [{@event.ConnectionString}]."); } _connectionStrings.Add(@event); }
private void HandleConnectionString(ConnectionStringRegistrationRequest @event) { if (Model.RuntimeEnvironment?.Name != @event.RuntimeEnvironment) { return; } if (!string.IsNullOrWhiteSpace(@event.ForProjectWithRole) && !OutputTarget.GetProject().HasRole(@event.ForProjectWithRole)) { return; } @event.MarkHandled(); if (_connectionStrings.Any(x => x.Name == @event.Name && x.ConnectionString != @event.ConnectionString)) { throw new Exception($"Misconfiguration in [{GetType().Name}]: ConnectionString with name [{@event.Name}] already defined with different value to [{@event.ConnectionString}]."); } _connectionStrings.Add(@event); }