Example #1
0
 protected virtual void SetupLogging(ContextWrapper contextWrapper)
 {
     LoggingConfiguration.Configure(
         contextWrapper.GetPropertyValue(ContextPropertyKeys.TransientDatabaseConnectionString),
         contextWrapper.GetPropertyValue(ContextPropertyKeys.LogLevel),
         _databaseSchema
         );
 }
Example #2
0
        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);
        }
Example #3
0
        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);
            }
        }