Skip to content

Commit 020deb9

Browse files
Tastefulpaulbatum
authored andcommitted
Adding CollectionTypeFactory mapping to the PersistenceConfiguration.cs on the same way as the ProxyFactoryFactory.
1 parent 72ecfe6 commit 020deb9

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

src/FluentNHibernate/Cfg/Db/PersistenceConfiguration.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public abstract class PersistenceConfiguration<TThisConfiguration, TConnectionSt
2727
protected const string ShowSqlKey = "show_sql";
2828
protected const string FormatSqlKey = "format_sql";
2929

30+
protected const string CollectionTypeFactoryClassKey = NHibernate.Cfg.Environment.CollectionTypeFactoryClass;
3031
protected const string ConnectionProviderKey = "connection.provider";
3132
protected const string DefaultConnectionProviderClassName = "NHibernate.Connection.DriverConnectionProvider";
3233
protected const string DriverClassKey = "connection.driver_class";
@@ -306,6 +307,41 @@ public TThisConfiguration Raw(string key, string value)
306307
return (TThisConfiguration) this;
307308
}
308309

310+
/// <summary>
311+
/// Sets the collectiontype.factory_class property.
312+
/// NOTE: NHibernate 2.1 only
313+
/// </summary>
314+
/// <param name="collectionTypeFactoryClass">factory class</param>
315+
/// <returns>Configuration</returns>
316+
public TThisConfiguration CollectionTypeFactory(string collectionTypeFactoryClass)
317+
{
318+
values[CollectionTypeFactoryClassKey] = collectionTypeFactoryClass;
319+
return (TThisConfiguration)this;
320+
}
321+
322+
/// <summary>
323+
/// Sets the collectiontype.factory_class property.
324+
/// NOTE: NHibernate 2.1 only
325+
/// </summary>
326+
/// <param name="collectionTypeFactoryClass">factory class</param>
327+
/// <returns>Configuration</returns>
328+
public TThisConfiguration CollectionTypeFactory(Type collectionTypeFactoryClass)
329+
{
330+
values[CollectionTypeFactoryClassKey] = collectionTypeFactoryClass.AssemblyQualifiedName;
331+
return (TThisConfiguration)this;
332+
}
333+
334+
/// <summary>
335+
/// Sets the collectiontype.factory_class property.
336+
/// NOTE: NHibernate 2.1 only
337+
/// </summary>
338+
/// <typeparam name="TCollectionTypeFactory">factory class</typeparam>
339+
/// <returns>Configuration</returns>
340+
public TThisConfiguration CollectionTypeFactory<TCollectionTypeFactory>() where TCollectionTypeFactory : ICollectionTypeFactory
341+
{
342+
return CollectionTypeFactory(typeof(TCollectionTypeFactory));
343+
}
344+
309345
/// <summary>
310346
/// Sets the proxyfactory.factory_class property.
311347
/// NOTE: NHibernate 2.1 only

0 commit comments

Comments
 (0)