Commits

Roger Kratz committed b6dd933

changing code to targeting NH Envers 1.1

  • Participants
  • Parent commits 10c7d38

Comments (0)

Files changed (5)

NHibernate.Envers.SetForNet4/SetForNet4CollectionInitializor.cs

 {
 	public class SetForNet4CollectionInitializor<T> : AbstractCollectionInitializor<ISet<T>>
 	{
-		private readonly System.Type collectionType;
 		private readonly MiddleComponentData elementComponentData;
 
 		public SetForNet4CollectionInitializor(AuditConfiguration verCfg,
 		                                       IAuditReaderImplementor versionsReader,
 		                                       IRelationQueryGenerator queryGenerator,
 		                                       object primaryKey, long revision,
-		                                       System.Type collectionType,
 		                                       MiddleComponentData elementComponentData) 
 			:base(verCfg, versionsReader, queryGenerator, primaryKey, revision)
 		{
-			this.collectionType = collectionType;
 			this.elementComponentData = elementComponentData;
 		}
 
 		protected override ISet<T> InitializeCollection(int size) 
 		{
-			return (ISet<T>) Activator.CreateInstance(collectionType);
+			return new HashSet<T>();
 		}
 
 		protected override void AddToCollection(ISet<T> collection, object collectionRow) 

NHibernate.Envers.SetForNet4/SetForNet4CollectionMapper.cs

 		private readonly MiddleComponentData _elementComponentData;
 
 		public SetForNet4CollectionMapper(CommonCollectionMapperData commonCollectionMapperData, MiddleComponentData elementComponentData)
-			: base(commonCollectionMapperData, typeof(HashSet<T>), typeof(SetForNet4Proxy<T>))
+			: base(commonCollectionMapperData, typeof(SetForNet4Proxy<T>))
 		{
 			_elementComponentData = elementComponentData;
 		}
 			                                              CommonCollectionMapperData.QueryGenerator,
 			                                              primaryKey,
 			                                              revision,
-			                                              CollectionType,
 			                                              _elementComponentData);
 		}
 

NHibernate.Envers.SetForNet4Test/Tests/SimpleTest.cs

 		[Test]
 		public void VerifyRevisionCount()
 		{
-			CollectionAssert.AreEquivalent(new[] { 1 }, AuditReader().GetRevisions<ParentEntity>(parentId));
-			CollectionAssert.AreEquivalent(new[] { 1, 2}, AuditReader().GetRevisions<ParentEntity>(childId1));
-			CollectionAssert.AreEquivalent(new[] { 1 }, AuditReader().GetRevisions<ParentEntity>(childId2));
+			CollectionAssert.AreEquivalent(new[] { 1 }, AuditReader().GetRevisions(typeof(ParentEntity), parentId));
+			CollectionAssert.AreEquivalent(new[] { 1, 2}, AuditReader().GetRevisions(typeof(ParentEntity), childId1));
+			CollectionAssert.AreEquivalent(new[] { 1 }, AuditReader().GetRevisions(typeof(ParentEntity), childId2));
 		}
 
 		[Test]

lib/NHibernate.Envers.Tests.dll

Binary file modified.

lib/NHibernate.Envers.dll

Binary file modified.