Skip to content

Commit d61762b

Browse files
author
Ivar Tiller
committed
IQueryCache constraint should be an IQueryCacheFactory constraint
The configuration setting is used to create an instance of a factory, not of the query cache itself.
1 parent ea4c7ff commit d61762b

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

src/NHibernate.Test/CfgTest/Loquacious/ConfigurationFixture.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void CompleteConfiguration()
2929
.Through<HashtableCacheProvider>()
3030
.PrefixingRegionsWith("xyz")
3131
.Queries
32-
.Through<StandardQueryCache>()
32+
.Through<StandardQueryCacheFactory>()
3333
.UsingMinimalPuts()
3434
.WithDefaultExpiration(15)
3535
.GeneratingCollections
@@ -69,7 +69,7 @@ public void CompleteConfiguration()
6969
Assert.That(cfg.Properties[Environment.SessionFactoryName], Is.EqualTo("SomeName"));
7070
Assert.That(cfg.Properties[Environment.CacheProvider], Is.EqualTo(typeof(HashtableCacheProvider).AssemblyQualifiedName));
7171
Assert.That(cfg.Properties[Environment.CacheRegionPrefix], Is.EqualTo("xyz"));
72-
Assert.That(cfg.Properties[Environment.QueryCacheFactory], Is.EqualTo(typeof(StandardQueryCache).AssemblyQualifiedName));
72+
Assert.That(cfg.Properties[Environment.QueryCacheFactory], Is.EqualTo(typeof(StandardQueryCacheFactory).AssemblyQualifiedName));
7373
Assert.That(cfg.Properties[Environment.UseMinimalPuts], Is.EqualTo("true"));
7474
Assert.That(cfg.Properties[Environment.CacheDefaultExpiration], Is.EqualTo("15"));
7575
Assert.That(cfg.Properties[Environment.CollectionTypeFactoryClass], Is.EqualTo(typeof(DefaultCollectionTypeFactory).AssemblyQualifiedName));

src/NHibernate.Test/CfgTest/Loquacious/LambdaConfigurationFixture.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public void FullConfiguration()
2727
c.DefaultExpiration = 15;
2828
c.RegionsPrefix = "xyz";
2929
c.Provider<HashtableCacheProvider>();
30-
c.QueryCache<StandardQueryCache>();
30+
c.QueryCache<StandardQueryCacheFactory>();
3131
});
3232
configure.CollectionTypeFactory<DefaultCollectionTypeFactory>();
3333
configure.HqlQueryTranslator<ASTQueryTranslatorFactory>();
@@ -69,7 +69,7 @@ public void FullConfiguration()
6969
Is.EqualTo(typeof(HashtableCacheProvider).AssemblyQualifiedName));
7070
Assert.That(configure.Properties[Environment.CacheRegionPrefix], Is.EqualTo("xyz"));
7171
Assert.That(configure.Properties[Environment.QueryCacheFactory],
72-
Is.EqualTo(typeof(StandardQueryCache).AssemblyQualifiedName));
72+
Is.EqualTo(typeof(StandardQueryCacheFactory).AssemblyQualifiedName));
7373
Assert.That(configure.Properties[Environment.UseMinimalPuts], Is.EqualTo("true"));
7474
Assert.That(configure.Properties[Environment.CacheDefaultExpiration], Is.EqualTo("15"));
7575
Assert.That(configure.Properties[Environment.CollectionTypeFactoryClass],

src/NHibernate/Cfg/Loquacious/CacheConfiguration.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void Provider<TProvider>() where TProvider : ICacheProvider
3939
cfg.SetProperty(Environment.CacheProvider, typeof(TProvider).AssemblyQualifiedName);
4040
}
4141

42-
public void QueryCache<TFactory>() where TFactory : IQueryCache
42+
public void QueryCache<TFactory>() where TFactory : IQueryCacheFactory
4343
{
4444
UseSecondLevelCache = true;
4545
UseQueryCache = true;
@@ -111,7 +111,7 @@ public QueryCacheConfiguration(CacheConfiguration cc)
111111

112112
#region Implementation of IQueryCacheConfiguration
113113

114-
public ICacheConfiguration Through<TFactory>() where TFactory : IQueryCache
114+
public ICacheConfiguration Through<TFactory>() where TFactory : IQueryCacheFactory
115115
{
116116
cc.Configuration.SetProperty(Environment.UseSecondLevelCache, "true");
117117
cc.Configuration.SetProperty(Environment.UseQueryCache, "true");
@@ -121,4 +121,4 @@ public ICacheConfiguration Through<TFactory>() where TFactory : IQueryCache
121121

122122
#endregion
123123
}
124-
}
124+
}

src/NHibernate/Cfg/Loquacious/ICacheConfiguration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ public interface ICacheConfigurationProperties
1717
string RegionsPrefix { set; }
1818
int DefaultExpiration { set; }
1919
void Provider<TProvider>() where TProvider : ICacheProvider;
20-
void QueryCache<TFactory>() where TFactory : IQueryCache;
20+
void QueryCache<TFactory>() where TFactory : IQueryCacheFactory;
2121
}
22-
}
22+
}

src/NHibernate/Cfg/Loquacious/IQueryCacheConfiguration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ namespace NHibernate.Cfg.Loquacious
44
{
55
public interface IQueryCacheConfiguration
66
{
7-
ICacheConfiguration Through<TFactory>() where TFactory : IQueryCache;
7+
ICacheConfiguration Through<TFactory>() where TFactory : IQueryCacheFactory;
88
}
9-
}
9+
}

0 commit comments

Comments
 (0)