public GlimpseDbDependencyResolver(DbConfiguration originalDbConfiguration)
 {
     // Get the original resolver
     var internalConfigProp = originalDbConfiguration.GetType().GetProperty("InternalConfiguration", BindingFlags.Instance | BindingFlags.NonPublic);
     var internalConfig = internalConfigProp.GetValue(originalDbConfiguration, null);
     var rootResolverProp = internalConfig.GetType().GetProperty("RootResolver", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
     rootResolver = (IDbDependencyResolver)rootResolverProp.GetValue(internalConfig, null);
 }
        public virtual void SetConfiguration(DbConfiguration configuration)
        {
            Contract.Requires(configuration != null);

            configuration = _loader.TryLoadFromConfig(AppConfig.DefaultInstance) ?? configuration;

            if (_configuration == null)
            {
                _configuration = configuration;
                _configuration.Lock();
            }
            else if (_configuration.GetType()
                     != configuration.GetType())
            {
                if (_configuration.GetType()
                    == typeof(DbConfiguration))
                {
                    throw new InvalidOperationException(Strings.DefaultConfigurationUsedBeforeSet(configuration.GetType().Name));
                }

                throw new InvalidOperationException(
                    Strings.ConfigurationSetTwice(configuration.GetType().Name, _configuration.GetType().Name));
            }
        }