protected virtual void SetupLogging(ContextWrapper contextWrapper) { LoggingConfiguration.Configure( contextWrapper.GetPropertyValue(ContextPropertyKeys.TransientDatabaseConnectionString), contextWrapper.GetPropertyValue(ContextPropertyKeys.LogLevel), _databaseSchema ); }
protected virtual bool IsValidContext(ContextWrapper contextWrapper) { if (string.IsNullOrEmpty(contextWrapper.GetPropertyValue(ContextPropertyKeys.TransientDatabaseConnectionString))) { throw new InvalidContextException(InvalidContextException.ContextPropertiesNoConnectionStringMessage); } if (string.IsNullOrEmpty(contextWrapper.GetPropertyValue(ContextPropertyKeys.LogLevel))) { throw new InvalidContextException(InvalidContextException.ContextPropertiesNoLogLevelMessage); } return(true); }
protected override void apply(Type pluginType, IConfiguredInstance instance) { var connectionString = instance?.Constructor?.GetParameters().FirstOrDefault(x => x.Name.Equals("connectionString", StringComparison.OrdinalIgnoreCase)); if (connectionString != null) { var transientConnectionString = _context.GetPropertyValue(ContextPropertyKeys.TransientDatabaseConnectionString); instance.Dependencies.AddForConstructorParameter(connectionString, transientConnectionString); } }