public Configuration BuildConfiguration(string basePath = null)
        {
            var dependencyList = basePath == null
                ? DependencyList.WithBasePathOfAssembly(Assembly.GetExecutingAssembly())
                : DependencyList.WithPathPrefix(basePath);

            dependencyList
            .AddAssemblies(_mappingAssemblies);

            if (!string.IsNullOrEmpty(_configFile))
            {
                dependencyList.AddFile(_configFile);
            }
            dependencyList.AddFiles(_additionalDependencies);

            var timestamp = dependencyList.GetLastModificationTime();

            if (timestamp == null)
            {
                throw new InvalidOperationException("No dependencies were specified");
            }

            var configuration = _configurationCache.TryLoad(timestamp.Value);

            if (configuration == null)
            {
                configuration = LoadExternalConfiguration();
                configuration = ApplyCustomSettings(configuration);
                _configurationCache.Save(configuration, timestamp.Value);
            }

            return(configuration);
        }
Exemplo n.º 2
0
 /// <inheritdoc />
 public DependencyList_With_RealFileSystem_Tests()
 {
     _dependencyList = DependencyList.WithBasePathOfAssembly(Assembly.GetExecutingAssembly());
 }
Exemplo n.º 3
0
 /// <inheritdoc />
 public NHibernateSessionFactoryBuilderTests()
 {
     _tempFileName   = "SharpArch.Tests." + Guid.NewGuid().ToString("D") + ".tmp";
     _dependencyList = DependencyList.WithBasePathOfAssembly(Assembly.GetExecutingAssembly());
 }