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);
        }
コード例 #2
0
 /// <inheritdoc />
 public DependencyList_With_RealFileSystem_Tests()
 {
     _dependencyList = DependencyList.WithBasePathOfAssembly(Assembly.GetExecutingAssembly());
 }
コード例 #3
0
 /// <inheritdoc />
 public NHibernateSessionFactoryBuilderTests()
 {
     _tempFileName   = "SharpArch.Tests." + Guid.NewGuid().ToString("D") + ".tmp";
     _dependencyList = DependencyList.WithBasePathOfAssembly(Assembly.GetExecutingAssembly());
 }