コード例 #1
0
        public static SessionFactoryInfo GetFromAssemblyOf <T>(ProviderTypeEnum providerType,
                                                               string nameOrConnectionString,
                                                               FluentNHibernatePersistenceBuilderOptions options = null)
        {
            options = options ?? new FluentNHibernatePersistenceBuilderOptions();
            Func <ConfigurationInfo> configFunc = () => FluentNHibernatePersistenceBuilder.Build(providerType,
                                                                                                 nameOrConnectionString, options);
            var keyInfo = new KeyInfo
            {
                ProviderType           = providerType,
                NameOrConnectionString = nameOrConnectionString,
                options      = options,
                TypeFullName = typeof(T).FullName
            };

            return(GetSessionFactoryInfo <T>(options, keyInfo, providerType, configFunc));
        }
コード例 #2
0
        public static SessionFactoryInfo GetFromAssemblies(List <Assembly> sourceAssemblies,
                                                           ProviderTypeEnum providerType,
                                                           string nameOrConnectionString,
                                                           FluentNHibernatePersistenceBuilderOptions options = null)
        {
            options = options ?? new FluentNHibernatePersistenceBuilderOptions();
            Func <ConfigurationInfo> configFunc = () => FluentNHibernatePersistenceBuilder.Build(providerType,
                                                                                                 nameOrConnectionString, options);
            var keyInfo = new KeyInfo
            {
                ProviderType           = providerType,
                NameOrConnectionString = nameOrConnectionString,
                Options       = options,
                AssemblyNames = string.Join(",", sourceAssemblies.Distinct().OrderBy(i => i.FullName))
            };

            return(GetSessionFactoryInfo(sourceAssemblies, options, keyInfo, providerType, configFunc));
        }