Commits

Roger Kratz committed 48eee0d

First checkin

  • Participants

Comments (0)

Files changed (18)

+# Ignore file for Visual Studio 2008/2010
+
+# use glob syntax
+syntax: glob
+
+*.obj
+*.exe
+*.pdb
+*.user
+*.aps
+*.pch
+*.vspscc
+*_i.c
+*_p.c
+*.ncb
+*.suo
+*.tlb
+*.tlh
+*.bak
+*.cache
+*.ilk
+*.log
+*.lib
+*.sbr
+*.scc
+[Bb]in
+[Db]ebug*/
+obj/
+[Rr]elease*/
+*resharper*
+_ReSharper*/
+[Tt]est[Rr]esult*
+[Bb]uild[Ll]og.*
+*.[Pp]ublish.xml
+glob:hibernate.cfg.xml
+glob:Build
+glob:Src/lint.db

File NHibernate.Envers.SetForNet4.sln

+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHibernate.Envers.SetForNet4", "NHibernate.Envers.SetForNet4\NHibernate.Envers.SetForNet4.csproj", "{D023C95F-131A-4BB5-B285-B196F9ABFF3B}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHibernate.Envers.SetForNet4Test", "NHibernate.Envers.SetForNet4Test\NHibernate.Envers.SetForNet4Test.csproj", "{50FA1694-3FC4-4174-9B93-C7A58F6D1D01}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{D023C95F-131A-4BB5-B285-B196F9ABFF3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{D023C95F-131A-4BB5-B285-B196F9ABFF3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{D023C95F-131A-4BB5-B285-B196F9ABFF3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{D023C95F-131A-4BB5-B285-B196F9ABFF3B}.Release|Any CPU.Build.0 = Release|Any CPU
+		{50FA1694-3FC4-4174-9B93-C7A58F6D1D01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{50FA1694-3FC4-4174-9B93-C7A58F6D1D01}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{50FA1694-3FC4-4174-9B93-C7A58F6D1D01}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{50FA1694-3FC4-4174-9B93-C7A58F6D1D01}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

File NHibernate.Envers.SetForNet4.sln.docstates

Binary file added.

File NHibernate.Envers.SetForNet4/NHibernate.Envers.SetForNet4.csproj

+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.30703</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{D023C95F-131A-4BB5-B285-B196F9ABFF3B}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>NHibernate.Envers.SetForNet4</RootNamespace>
+    <AssemblyName>NHibernate.Envers.SetForNet4</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

File NHibernate.Envers.SetForNet4/Properties/AssemblyInfo.cs

+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("NHibernate.Envers.SetForNet4")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("NHibernate.Envers.SetForNet4")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("5e775b31-359a-44ad-b76d-39df57811f4a")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

File NHibernate.Envers.SetForNet4Test/CollectionProxyMapperFactoryForNet4.cs

+namespace NHibernate.Envers.SetForNet4Test
+{
+	public class CollectionProxyMapperFactoryForNet4
+	{
+		
+	}
+}

File NHibernate.Envers.SetForNet4Test/NHibernate.Envers.SetForNet4Test.csproj

+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.30703</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{50FA1694-3FC4-4174-9B93-C7A58F6D1D01}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>NHibernate.Envers.SetForNet4Test</RootNamespace>
+    <AssemblyName>NHibernate.Envers.SetForNet4Test</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Iesi.Collections">
+      <HintPath>..\lib\Iesi.Collections.dll</HintPath>
+    </Reference>
+    <Reference Include="NHibernate">
+      <HintPath>..\lib\NHibernate.dll</HintPath>
+    </Reference>
+    <Reference Include="NHibernate.Envers">
+      <HintPath>..\lib\NHibernate.Envers.dll</HintPath>
+    </Reference>
+    <Reference Include="NHibernate.Envers.Tests">
+      <HintPath>..\lib\NHibernate.Envers.Tests.dll</HintPath>
+    </Reference>
+    <Reference Include="nunit.framework">
+      <HintPath>..\lib\nunit.framework.dll</HintPath>
+    </Reference>
+    <Reference Include="SharpTestsEx">
+      <HintPath>..\lib\SharpTestsEx.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="SetString\StringSetEntity.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="SetString\StringSetTest.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="SetString\Mapping.hbm.xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="hibernate.cfg.xml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

File NHibernate.Envers.SetForNet4Test/Properties/AssemblyInfo.cs

+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("NHibernate.Envers.SetForNet4Test")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("NHibernate.Envers.SetForNet4Test")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("7cbe6f71-2fa9-48c9-9460-426bbc485cec")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

File NHibernate.Envers.SetForNet4Test/SetString/Mapping.hbm.xml

+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
+                   assembly="NHibernate.Envers.SetForNet4Test"
+                   namespace="NHibernate.Envers.SetForNet4Test.SetString">
+	<class name="StringSetEntity">
+		<id name="Id">
+			<generator class="guid"/>
+		</id>
+		<set name="Strings" table="StringSetStrings">
+			<key column ="StringSetEntityId" />
+			<element column="string" type="string" />
+		</set>
+	</class>
+</hibernate-mapping>

File NHibernate.Envers.SetForNet4Test/SetString/StringSetEntity.cs

+using System;
+using System.Collections.Generic;
+
+namespace NHibernate.Envers.SetForNet4Test.SetString
+{
+	public class StringSetEntity
+	{
+		public virtual Guid Id { get; set; }
+		public virtual ISet<string> Strings { get; set; }
+
+		public StringSetEntity()
+		{
+			Strings = new HashSet<string>();
+		}
+
+		public override bool Equals(object obj)
+		{
+			var castedObj = obj as StringSetEntity;
+			if (castedObj == null)
+				return false;
+
+			return castedObj.Id == Id;
+		}
+
+
+		public override int GetHashCode()
+		{
+			return Id.GetHashCode();
+		}
+	}
+}

File NHibernate.Envers.SetForNet4Test/SetString/StringSetTest.cs

+using System;
+using NHibernate.Envers.Tests;
+using NUnit.Framework;
+
+namespace NHibernate.Envers.SetForNet4Test.SetString
+{
+	[TestFixture]
+	public class StringSetTest : TestBase
+	{
+		private Guid sse1_id;
+		private Guid sse2_id;
+
+		protected override void Initialize()
+		{
+			var sse1 = new StringSetEntity();
+			var sse2 = new StringSetEntity();
+			// Revision 1 (sse1: initialy empty, sse2: initialy 2 elements)
+			using (var tx = Session.BeginTransaction())
+			{
+				sse2.Strings.Add("sse2_string1");
+				sse2.Strings.Add("sse2_string2");
+				sse1_id = (Guid)Session.Save(sse1);
+				sse2_id = (Guid)Session.Save(sse2);
+				tx.Commit();
+			}
+			// Revision 2 (sse1: adding 2 elements, sse2: adding an existing element)
+			using (var tx = Session.BeginTransaction())
+			{
+				sse1.Strings.Add("sse1_string1");
+				sse1.Strings.Add("sse1_string2");
+				sse2.Strings.Add("sse2_string1");
+				tx.Commit();
+			}
+			// Revision 3 (sse1: removing a non-existing element, sse2: removing one element)
+			using (var tx = Session.BeginTransaction())
+			{
+				sse1.Strings.Remove("sse1_string3");
+				sse2.Strings.Remove("sse2_string1");
+				tx.Commit();
+			}
+		}
+
+		[Test]
+		public void VerifyRevisionCount()
+		{
+			CollectionAssert.AreEquivalent(new[] { 1, 2 }, AuditReader().GetRevisions<StringSetEntity>(sse1_id));
+			CollectionAssert.AreEquivalent(new[] { 1, 3 }, AuditReader().GetRevisions<StringSetEntity>(sse2_id));
+		}
+
+		[Test]
+		public void VerifyHistoryOf1()
+		{
+			var rev1 = AuditReader().Find<StringSetEntity>(sse1_id, 1);
+			var rev2 = AuditReader().Find<StringSetEntity>(sse1_id, 2);
+			var rev3 = AuditReader().Find<StringSetEntity>(sse1_id, 3);
+
+			CollectionAssert.IsEmpty(rev1.Strings);
+			CollectionAssert.AreEquivalent(new[] { "sse1_string1", "sse1_string2" }, rev2.Strings);
+			CollectionAssert.AreEquivalent(new[] { "sse1_string1", "sse1_string2" }, rev3.Strings);
+		}
+
+		[Test]
+		public void VerifyHistoryOf2()
+		{
+			var rev1 = AuditReader().Find<StringSetEntity>(sse2_id, 1);
+			var rev2 = AuditReader().Find<StringSetEntity>(sse2_id, 2);
+			var rev3 = AuditReader().Find<StringSetEntity>(sse2_id, 3);
+
+			CollectionAssert.AreEquivalent(new[] { "sse2_string1", "sse2_string2" }, rev1.Strings);
+			CollectionAssert.AreEquivalent(new[] { "sse2_string1", "sse2_string2" }, rev2.Strings);
+			CollectionAssert.AreEquivalent(new[] { "sse2_string2" }, rev3.Strings);
+		}
+	}
+}

File NHibernate.Envers.SetForNet4Test/hibernate.cfg.xml.template

+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
+  <session-factory>
+    
+    <property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property>
+    <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
+    <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
+    <property name="connection.connection_string">Data Source=(local);Initial Catalog=envers;Integrated Security=SSPI</property>
+    <property name="hbm2ddl.auto">create-drop</property>
+
+    <!--
+    <property name="dialect">NHibernate.Dialect.MsSqlCeDialect</property>
+    <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
+    <property name="connection.driver_class">NHibernate.Driver.SqlServerCeDriver</property>
+    <property name="connection.connection_string">Data Source=envers.sdf</property>
+    -->
+
+    <property name="show_sql">false</property>
+  </session-factory>
+</hibernate-configuration>

File lib/Iesi.Collections.dll

Binary file added.

File lib/NHibernate.Envers.Tests.dll

Binary file added.

File lib/NHibernate.Envers.dll

Binary file added.

File lib/NHibernate.dll

Binary file added.

File lib/SharpTestsEx.dll

Binary file added.

File lib/nunit.framework.dll

Binary file added.