|
From: <fab...@us...> - 2010-08-06 23:17:29
|
Revision: 5120
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5120&view=rev
Author: fabiomaulo
Date: 2010-08-06 23:17:22 +0000 (Fri, 06 Aug 2010)
Log Message:
-----------
Minor (added comments)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/IMultiQuery.cs
trunk/nhibernate/src/NHibernate/Impl/MultiQueryImpl.cs
Modified: trunk/nhibernate/src/NHibernate/IMultiQuery.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/IMultiQuery.cs 2010-08-06 22:29:22 UTC (rev 5119)
+++ trunk/nhibernate/src/NHibernate/IMultiQuery.cs 2010-08-06 23:17:22 UTC (rev 5120)
@@ -13,103 +13,124 @@
/// <summary>
/// Get all the results
/// </summary>
+ /// <remarks>
+ /// The result is a IList of IList.
+ /// </remarks>
IList List();
/// <summary>
- /// Adds the specified criteria to the query. The result will be contained in a <see cref="System.Collections.Generic.List{T}"/>
+ /// Adds the specified query to the query. The result will be contained in a <see cref="System.Collections.Generic.List{T}"/>
/// </summary>
/// <param name="resultGenericListType">Return results in a <see cref="System.Collections.Generic.List{resultGenericListType}"/></param>
- /// <param name="criteria">The criteria.</param>
- /// <returns></returns>
- IMultiQuery Add(System.Type resultGenericListType, IQuery criteria);
+ /// <param name="query">The query.</param>
+ /// <returns>The instance for method chain.</returns>
+ IMultiQuery Add(System.Type resultGenericListType, IQuery query);
/// <summary>
/// Add the specified HQL query to the multi query. The result will be contained in a <see cref="System.Collections.Generic.List{T}"/>
/// </summary>
+ /// <param name="query">The query</param>
IMultiQuery Add<T>(IQuery query);
-
+
/// <summary>
- /// Add the specified HQL query to the multi query, and associate it with the given key. The result will be contained in a <see cref="System.Collections.Generic.List{T}"/>
- /// </summary>
- /// <param name="key"></param>
- /// <param name="query"></param>
- /// <returns></returns>
- IMultiQuery Add<T>(string key, IQuery query);
-
- /// <summary>
- /// Add the specified HQL Query to the multi query, and associate it with the given key. The result will be contained in a <see cref="System.Collections.Generic.List{T}"/>
- /// </summary>
- /// <param name="key"></param>
- /// <param name="hql"></param>
- /// <returns></returns>
- IMultiQuery Add<T>(string key, string hql);
+ /// Add the specified HQL query to the multi query, and associate it with the given key. The result will be contained in a <see cref="System.Collections.Generic.List{T}"/>
+ /// </summary>
+ /// <param name="key">The key to get results of the specific query.</param>
+ /// <param name="query">The query</param>
+ /// <returns>The instance for method chain.</returns>
+ /// <seealso cref="GetResult(string)"/>
+ IMultiQuery Add<T>(string key, IQuery query);
- /// <summary>
- /// Add the specified HQL query to the multi query. The result will be contained in a <see cref="System.Collections.Generic.List{T}"/>
- /// </summary>
- IMultiQuery Add<T>(string hql);
+ /// <summary>
+ /// Add the specified HQL Query to the multi query, and associate it with the given key. The result will be contained in a <see cref="System.Collections.Generic.List{T}"/>
+ /// </summary>
+ /// <param name="key">The key to get results of the specific query.</param>
+ /// <param name="hql">The query</param>
+ /// <returns>The instance for method chain.</returns>
+ /// <seealso cref="GetResult(string)"/>
+ IMultiQuery Add<T>(string key, string hql);
- /// <summary>
- /// Add a named query to the multi query. The result will be contained in a <see cref="System.Collections.Generic.List{T}"/>
- /// </summary>
- IMultiQuery AddNamedQuery<T>(string namedQuery);
+ /// <summary>
+ /// Add the specified HQL query to the multi query. The result will be contained in a <see cref="System.Collections.Generic.List{T}"/>
+ /// </summary>
+ /// <param name="hql">The query</param>
+ /// <returns>The instance for method chain.</returns>
+ IMultiQuery Add<T>(string hql);
- /// <summary>
- /// Add a named query to the multi query, and associate it with the given key. The result will be contained in a <see cref="System.Collections.Generic.List{T}"/>
- /// </summary>
- /// <param name="key"></param>
- /// <param name="namedKey"></param>
- /// <returns></returns>
- IMultiQuery AddNamedQuery<T>(string key, string namedKey);
+ /// <summary>
+ /// Add a named query to the multi query. The result will be contained in a <see cref="System.Collections.Generic.List{T}"/>
+ /// </summary>
+ /// <param name="queryName">The query</param>
+ /// <returns>The instance for method chain.</returns>
+ IMultiQuery AddNamedQuery<T>(string queryName);
/// <summary>
+ /// Add a named query to the multi query, and associate it with the given key. The result will be contained in a <see cref="System.Collections.Generic.List{T}"/>
+ /// </summary>
+ /// <param name="key">The key to get results of the specific query.</param>
+ /// <param name="queryName">The query</param>
+ /// <returns>The instance for method chain.</returns>
+ /// <seealso cref="GetResult(string)"/>
+ IMultiQuery AddNamedQuery<T>(string key, string queryName);
+
+ /// <summary>
/// Add the specified HQL query to the multi query, and associate it with the given key
/// </summary>
- /// <param name="key"></param>
- /// <param name="query"></param>
- /// <returns></returns>
+ /// <param name="key">The key to get results of the specific query.</param>
+ /// <param name="query">The query</param>
+ /// <returns>The instance for method chain.</returns>
+ /// <seealso cref="GetResult(string)"/>
IMultiQuery Add(string key, IQuery query);
/// <summary>
- /// Add the specified HQL query to the multi query
+ /// Add the specified HQL query to the multi query
/// </summary>
+ /// <param name="query">The query</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery Add(IQuery query);
/// <summary>
/// Add the specified HQL Query to the multi query, and associate it with the given key
/// </summary>
- /// <param name="key"></param>
- /// <param name="hql"></param>
- /// <returns></returns>
+ /// <param name="key">The key to get results of the specific query.</param>
+ /// <param name="hql">The query</param>
+ /// <returns>The instance for method chain.</returns>
+ /// <seealso cref="GetResult(string)"/>
IMultiQuery Add(string key, string hql);
/// <summary>
/// Add the specified HQL query to the multi query
/// </summary>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery Add(string hql);
/// <summary>
/// Add a named query to the multi query
/// </summary>
- IMultiQuery AddNamedQuery(string namedQuery);
+ /// <param name="queryName">The query</param>
+ /// <returns>The instance for method chain.</returns>
+ IMultiQuery AddNamedQuery(string queryName);
/// <summary>
/// Add a named query to the multi query, and associate it with the given key
/// </summary>
- /// <param name="key"></param>
- /// <param name="namedKey"></param>
- /// <returns></returns>
- IMultiQuery AddNamedQuery(string key, string namedKey);
+ /// <param name="key">The key to get results of the specific query.</param>
+ /// <param name="queryName">The query</param>
+ /// <returns>The instance for method chain.</returns>
+ /// <seealso cref="GetResult(string)"/>
+ IMultiQuery AddNamedQuery(string key, string queryName);
/// <summary>
/// Enable caching of this query result set.
/// </summary>
/// <param name="cacheable">Should the query results be cacheable?</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetCacheable(bool cacheable);
/// Set the name of the cache region.
/// <param name="region">The name of a query cache region, or <see langword="null" />
/// for the default query cache</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetCacheRegion(string region);
/// Should the query force a refresh of the specified query cache region?
@@ -119,12 +140,14 @@
/// based on its knowledge of those events.
/// <param name="forceCacheRefresh">Should the query result in a forcible refresh of
/// the query cache?</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetForceCacheRefresh(bool forceCacheRefresh);
/// <summary>
/// The timeout for the underlying ADO query
/// </summary>
/// <param name="timeout"></param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetTimeout(int timeout);
/// <summary>
@@ -133,6 +156,7 @@
/// <param name="name">The name of the parameter</param>
/// <param name="val">The possibly null parameter value</param>
/// <param name="type">The NHibernate <see cref="IType"/>.</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetParameter(string name, object val, IType type);
@@ -142,6 +166,7 @@
/// </summary>
/// <param name="name">The name of the parameter</param>
/// <param name="val">The non-null parameter value</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetParameter(string name, object val);
/// <summary>
@@ -151,6 +176,7 @@
/// <param name="name">The name of the parameter</param>
/// <param name="vals">A collection of values to list</param>
/// <param name="type">The Hibernate type of the values</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetParameterList(string name, ICollection vals, IType type);
/// <summary>
@@ -160,46 +186,52 @@
/// </summary>
/// <param name="name">The name of the parameter</param>
/// <param name="vals">A collection of values to list</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetParameterList(string name, ICollection vals);
/// <summary>
- /// Bind an instance of a <see cref="String" /> to a named parameter
+ /// Bind an instance of a <see cref="string" /> to a named parameter
/// using an NHibernate <see cref="AnsiStringType"/>.
/// </summary>
/// <param name="name">The name of the parameter</param>
- /// <param name="val">A non-null instance of a <see cref="String"/>.</param>
+ /// <param name="val">A non-null instance of a <see cref="string"/>.</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetAnsiString(string name, string val);
/// <summary>
- /// Bind an instance of a <see cref="Byte" /> array to a named parameter
+ /// Bind an instance of a <see cref="byte" /> array to a named parameter
/// using an NHibernate <see cref="BinaryType"/>.
/// </summary>
/// <param name="name">The name of the parameter</param>
- /// <param name="val">A non-null instance of a <see cref="Byte"/> array.</param>
+ /// <param name="val">A non-null instance of a <see cref="byte"/> array.</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetBinary(string name, byte[] val);
/// <summary>
- /// Bind an instance of a <see cref="Boolean" /> to a named parameter
+ /// Bind an instance of a <see cref="bool" /> to a named parameter
/// using an NHibernate <see cref="BooleanType"/>.
/// </summary>
/// <param name="name">The name of the parameter</param>
- /// <param name="val">A non-null instance of a <see cref="Boolean"/>.</param>
+ /// <param name="val">A non-null instance of a <see cref="bool"/>.</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetBoolean(string name, bool val);
/// <summary>
- /// Bind an instance of a <see cref="Byte" /> to a named parameter
+ /// Bind an instance of a <see cref="byte" /> to a named parameter
/// using an NHibernate <see cref="ByteType"/>.
/// </summary>
/// <param name="name">The name of the parameter</param>
- /// <param name="val">A non-null instance of a <see cref="Byte"/>.</param>
+ /// <param name="val">A non-null instance of a <see cref="byte"/>.</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetByte(string name, byte val);
/// <summary>
- /// Bind an instance of a <see cref="Char" /> to a named parameter
+ /// Bind an instance of a <see cref="char" /> to a named parameter
/// using an NHibernate <see cref="CharType"/>.
/// </summary>
/// <param name="name">The name of the parameter</param>
- /// <param name="val">A non-null instance of a <see cref="Char"/>.</param>
+ /// <param name="val">A non-null instance of a <see cref="char"/>.</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetCharacter(string name, char val);
/// <summary>
@@ -208,6 +240,7 @@
/// </summary>
/// <param name="val">A non-null instance of a <see cref="DateTime"/>.</param>
/// <param name="name">The name of the parameter</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetDateTime(string name, DateTime val);
/// <summary>
@@ -216,6 +249,7 @@
/// </summary>
/// <param name="name">The name of the parameter</param>
/// <param name="val">A non-null instance of a <see cref="Decimal"/>.</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetDecimal(string name, decimal val);
/// <summary>
@@ -224,6 +258,7 @@
/// </summary>
/// <param name="name">The name of the parameter</param>
/// <param name="val">A non-null instance of a <see cref="Double"/>.</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetDouble(string name, double val);
/// <summary>
@@ -231,6 +266,7 @@
/// </summary>
/// <param name="name">The name of the parameter</param>
/// <param name="val">A non-null instance of a persistent class</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetEntity(string name, object val);
/// <summary>
@@ -239,6 +275,7 @@
/// </summary>
/// <param name="name">The name of the parameter</param>
/// <param name="val">A non-null instance of a persistent enumeration</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetEnum(string name, Enum val);
/// <summary>
@@ -247,6 +284,7 @@
/// </summary>
/// <param name="name">The name of the parameter</param>
/// <param name="val">A non-null instance of a <see cref="Int16"/>.</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetInt16(string name, short val);
/// <summary>
@@ -255,6 +293,7 @@
/// </summary>
/// <param name="name">The name of the parameter</param>
/// <param name="val">A non-null instance of a <see cref="Int32"/>.</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetInt32(string name, int val);
/// <summary>
@@ -263,6 +302,7 @@
/// </summary>
/// <param name="name">The name of the parameter</param>
/// <param name="val">A non-null instance of a <see cref="Int64"/>.</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetInt64(string name, long val);
/// <summary>
@@ -271,6 +311,7 @@
/// </summary>
/// <param name="name">The name of the parameter</param>
/// <param name="val">A non-null instance of a <see cref="Single"/>.</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetSingle(string name, float val);
/// <summary>
@@ -279,6 +320,7 @@
/// </summary>
/// <param name="name">The name of the parameter</param>
/// <param name="val">A non-null instance of a <see cref="String"/>.</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetString(string name, string val);
/// <summary>
@@ -287,6 +329,7 @@
/// </summary>
/// <param name="name">The name of the parameter</param>
/// <param name="val">An instance of a <see cref="Guid"/>.</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetGuid(string name, Guid val);
/// <summary>
@@ -295,6 +338,7 @@
/// </summary>
/// <param name="name">The name of the parameter</param>
/// <param name="val">A non-null instance of a <see cref="DateTime"/>.</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetTime(string name, DateTime val);
/// <summary>
@@ -303,11 +347,13 @@
/// </summary>
/// <param name="name">The name of the parameter</param>
/// <param name="val">A non-null instance of a <see cref="DateTime"/>.</param>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetTimestamp(string name, DateTime val);
/// <summary>
/// Override the current session flush mode, just for this query.
/// </summary>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetFlushMode(FlushMode mode);
/// <summary>
@@ -317,13 +363,14 @@
/// <remarks>
/// The <param name="transformer"/> will be applied after the transformer of each single query.
/// </remarks>
+ /// <returns>The instance for method chain.</returns>
IMultiQuery SetResultTransformer(IResultTransformer transformer);
/// <summary>
- /// Returns the result of one of the Criteria based on the key
+ /// Returns the result of one of the query based on the key
/// </summary>
/// <param name="key">The key</param>
- /// <returns></returns>
+ /// <returns>The instance for method chain.</returns>
object GetResult(string key);
}
-}
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/Impl/MultiQueryImpl.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Impl/MultiQueryImpl.cs 2010-08-06 22:29:22 UTC (rev 5119)
+++ trunk/nhibernate/src/NHibernate/Impl/MultiQueryImpl.cs 2010-08-06 23:17:22 UTC (rev 5120)
@@ -2,7 +2,6 @@
using System.Collections;
using System.Data;
using System.Diagnostics;
-using System.Text.RegularExpressions;
using Iesi.Collections;
using log4net;
using NHibernate.Cache;
@@ -302,9 +301,9 @@
return Add<object>(hql);
}
- public IMultiQuery AddNamedQuery(string namedQuery)
+ public IMultiQuery AddNamedQuery(string queryName)
{
- return AddNamedQuery<object>(namedQuery);
+ return AddNamedQuery<object>(queryName);
}
public IMultiQuery AddNamedQuery(string key, string namedQuery)
@@ -336,9 +335,9 @@
return Add<T>(key, ((ISession)session).CreateQuery(hql));
}
- public IMultiQuery AddNamedQuery<T>(string namedQuery)
+ public IMultiQuery AddNamedQuery<T>(string queryName)
{
- return Add<T>(session.GetNamedQuery(namedQuery));
+ return Add<T>(session.GetNamedQuery(queryName));
}
public IMultiQuery SetCacheable(bool cacheable)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-08-07 16:51:56
|
Revision: 5124
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5124&view=rev
Author: fabiomaulo
Date: 2010-08-07 16:51:50 +0000 (Sat, 07 Aug 2010)
Log Message:
-----------
Fix NH-2266
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Persister/Entity/SingleTableEntityPersister.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2266/
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2266/Domain.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2266/Fixture.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2266/Mappings.hbm.xml
Modified: trunk/nhibernate/src/NHibernate/Persister/Entity/SingleTableEntityPersister.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Persister/Entity/SingleTableEntityPersister.cs 2010-08-07 12:58:27 UTC (rev 5123)
+++ trunk/nhibernate/src/NHibernate/Persister/Entity/SingleTableEntityPersister.cs 2010-08-07 16:51:50 UTC (rev 5124)
@@ -527,6 +527,12 @@
private string DiscriminatorFilterFragment(string alias)
{
+ const string abstractClassWithNoSubclassExceptionMessageTemplate =
+@"The class {0} can't be instatiated and does not have mapped subclasses;
+possible solutions:
+- don't map the abstract class
+- map the its subclasses.";
+
if (NeedsDiscriminator)
{
InFragment frag = new InFragment();
@@ -541,13 +547,20 @@
}
string[] subclasses = SubclassClosure;
- for (int i = 0; i < subclasses.Length; i++)
+ int validValuesForInFragment = 0;
+ foreach (string t in subclasses)
{
- IQueryable queryable = (IQueryable)Factory.GetEntityPersister(subclasses[i]);
+ var queryable = (IQueryable) Factory.GetEntityPersister(t);
if (!queryable.IsAbstract)
+ {
frag.AddValue(queryable.DiscriminatorSQLValue);
+ validValuesForInFragment++;
+ }
}
-
+ if(validValuesForInFragment == 0)
+ {
+ throw new NotSupportedException(string.Format(abstractClassWithNoSubclassExceptionMessageTemplate, subclasses[0]));
+ }
StringBuilder buf = new StringBuilder(50).Append(" and ").Append(frag.ToFragmentString().ToString());
return buf.ToString();
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2266/Domain.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2266/Domain.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2266/Domain.cs 2010-08-07 16:51:50 UTC (rev 5124)
@@ -0,0 +1,10 @@
+using System;
+
+namespace NHibernate.Test.NHSpecificTest.NH2266
+{
+ public abstract class Token { public virtual int Id { get; set; } }
+
+ public class SecurityToken : Token { public virtual string Owner { get; set; } }
+
+ public abstract class TemporaryToken : Token { public virtual DateTime ExpiryDate { get; set; } }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2266/Fixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2266/Fixture.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2266/Fixture.cs 2010-08-07 16:51:50 UTC (rev 5124)
@@ -0,0 +1,19 @@
+using System;
+using NHibernate.Cfg;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.NHSpecificTest.NH2266
+{
+ public class Fixture
+ {
+ [Test]
+ public void WhenBuildSessionFactoryThenThrows()
+ {
+ Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration();
+ cfg.AddResource("NHibernate.Test.NHSpecificTest.NH2266.Mappings.hbm.xml", GetType().Assembly);
+ cfg.Executing(c => c.BuildSessionFactory()).Throws<NotSupportedException>()
+ .And.ValueOf.Message.Should().Contain("does not have mapped subclasses").And.Contain(typeof(TemporaryToken).FullName);
+ }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2266/Mappings.hbm.xml
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2266/Mappings.hbm.xml (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2266/Mappings.hbm.xml 2010-08-07 16:51:50 UTC (rev 5124)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
+ assembly="NHibernate.Test"
+ namespace="NHibernate.Test.NHSpecificTest.NH2266">
+
+ <class name="Token" abstract="true">
+ <id name="Id">
+ <generator class="native" />
+ </id>
+ <discriminator/>
+ <subclass name="SecurityToken">
+ <property name="Owner"/>
+ </subclass>
+ <subclass name="TemporaryToken" abstract="true">
+ <property name="ExpiryDate"/>
+ </subclass>
+ </class>
+</hibernate-mapping>
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-08-07 12:58:27 UTC (rev 5123)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-08-07 16:51:50 UTC (rev 5124)
@@ -454,6 +454,8 @@
<Compile Include="NHSpecificTest\NH2148\Domain.cs" />
<Compile Include="NHSpecificTest\NH2245\Fixture.cs" />
<Compile Include="NHSpecificTest\NH2245\Model.cs" />
+ <Compile Include="NHSpecificTest\NH2266\Domain.cs" />
+ <Compile Include="NHSpecificTest\NH2266\Fixture.cs" />
<Compile Include="TypesTest\CharClass.cs" />
<Compile Include="TypesTest\CharClassFixture.cs" />
<Compile Include="TypesTest\DateTimeClass.cs" />
@@ -2240,6 +2242,7 @@
<EmbeddedResource Include="CollectionTest\NullableValueTypeElementMapFixture.hbm.xml" />
<EmbeddedResource Include="DriverTest\EntityForMs2008.hbm.xml" />
<Content Include="DynamicEntity\package.html" />
+ <EmbeddedResource Include="NHSpecificTest\NH2266\Mappings.hbm.xml" />
<EmbeddedResource Include="TypesTest\CharClass.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH1836\Mappings.hbm.xml" />
<EmbeddedResource Include="TypesTest\DateTimeClass.hbm.xml" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-08-07 17:24:56
|
Revision: 5125
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5125&view=rev
Author: fabiomaulo
Date: 2010-08-07 17:24:50 +0000 (Sat, 07 Aug 2010)
Log Message:
-----------
Fix NH-2277
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Linq/Visitors/QuerySourceLocator.cs
trunk/nhibernate/src/NHibernate.Test/Linq/EagerLoadTests.cs
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/QuerySourceLocator.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/QuerySourceLocator.cs 2010-08-07 16:51:50 UTC (rev 5124)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/QuerySourceLocator.cs 2010-08-07 17:24:50 UTC (rev 5125)
@@ -24,7 +24,7 @@
public override void VisitMainFromClause(MainFromClause fromClause, QueryModel queryModel)
{
- if (_type == fromClause.ItemType)
+ if (_type.IsAssignableFrom(fromClause.ItemType))
{
_querySource = fromClause;
}
Modified: trunk/nhibernate/src/NHibernate.Test/Linq/EagerLoadTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Linq/EagerLoadTests.cs 2010-08-07 16:51:50 UTC (rev 5124)
+++ trunk/nhibernate/src/NHibernate.Test/Linq/EagerLoadTests.cs 2010-08-07 17:24:50 UTC (rev 5125)
@@ -1,6 +1,8 @@
using System.Linq;
using NHibernate.Linq;
+using NHibernate.Test.Linq.Entities;
using NUnit.Framework;
+using SharpTestsEx;
namespace NHibernate.Test.Linq
{
@@ -53,5 +55,13 @@
Assert.IsTrue(NHibernateUtil.IsInitialized(x[0].Orders));
Assert.IsTrue(NHibernateUtil.IsInitialized(x[0].Orders.First().OrderLines));
}
+
+ [Test]
+ public void WhenFetchSuperclassCollectionThenNotThrows()
+ {
+ // NH-2277
+ session.Executing(s => s.Query<Lizard>().Fetch(x => x.Children).ToList()).NotThrows();
+ session.Close();
+ }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-08-08 21:40:53
|
Revision: 5127
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5127&view=rev
Author: fabiomaulo
Date: 2010-08-08 21:40:41 +0000 (Sun, 08 Aug 2010)
Log Message:
-----------
Isolated Log4Net stuff (first step to fix NH-1554 and NH-2263)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/AdoNet/AbstractBatcher.cs
trunk/nhibernate/src/NHibernate/AdoNet/ConnectionManager.cs
trunk/nhibernate/src/NHibernate/AdoNet/Util/SqlStatementLogger.cs
trunk/nhibernate/src/NHibernate/AssertionFailure.cs
trunk/nhibernate/src/NHibernate/Bytecode/CodeDom/BytecodeProviderImpl.cs
trunk/nhibernate/src/NHibernate/Cache/CacheFactory.cs
trunk/nhibernate/src/NHibernate/Cache/NoCacheProvider.cs
trunk/nhibernate/src/NHibernate/Cache/NonstrictReadWriteCache.cs
trunk/nhibernate/src/NHibernate/Cache/ReadOnlyCache.cs
trunk/nhibernate/src/NHibernate/Cache/ReadWriteCache.cs
trunk/nhibernate/src/NHibernate/Cache/StandardQueryCache.cs
trunk/nhibernate/src/NHibernate/Cache/UpdateTimestampsCache.cs
trunk/nhibernate/src/NHibernate/Cfg/Configuration.cs
trunk/nhibernate/src/NHibernate/Cfg/ConfigurationSchema/HibernateConfiguration.cs
trunk/nhibernate/src/NHibernate/Cfg/ConfigurationSchema/SessionFactoryConfiguration.cs
trunk/nhibernate/src/NHibernate/Cfg/Environment.cs
trunk/nhibernate/src/NHibernate/Cfg/Mappings.cs
trunk/nhibernate/src/NHibernate/Cfg/SettingsFactory.cs
trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/Binder.cs
trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/FilterDefinitionFactory.cs
trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/MappingLogExtensions.cs
trunk/nhibernate/src/NHibernate/Collection/PersistentArrayHolder.cs
trunk/nhibernate/src/NHibernate/Connection/ConnectionProvider.cs
trunk/nhibernate/src/NHibernate/Connection/ConnectionProviderFactory.cs
trunk/nhibernate/src/NHibernate/Connection/DriverConnectionProvider.cs
trunk/nhibernate/src/NHibernate/Connection/UserSuppliedConnectionProvider.cs
trunk/nhibernate/src/NHibernate/Context/ThreadLocalSessionContext.cs
trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs
trunk/nhibernate/src/NHibernate/Dialect/Lock/UpdateLockingStrategy.cs
trunk/nhibernate/src/NHibernate/Dialect/Schema/AbstractTableMetadata.cs
trunk/nhibernate/src/NHibernate/Driver/DriverBase.cs
trunk/nhibernate/src/NHibernate/Driver/NHybridDataReader.cs
trunk/nhibernate/src/NHibernate/Engine/ActionQueue.cs
trunk/nhibernate/src/NHibernate/Engine/Cascade.cs
trunk/nhibernate/src/NHibernate/Engine/CascadingAction.cs
trunk/nhibernate/src/NHibernate/Engine/CollectionEntry.cs
trunk/nhibernate/src/NHibernate/Engine/Collections.cs
trunk/nhibernate/src/NHibernate/Engine/ForeignKeys.cs
trunk/nhibernate/src/NHibernate/Engine/IdentifierValue.cs
trunk/nhibernate/src/NHibernate/Engine/Loading/CollectionLoadContext.cs
trunk/nhibernate/src/NHibernate/Engine/Loading/LoadContexts.cs
trunk/nhibernate/src/NHibernate/Engine/Query/HQLQueryPlan.cs
trunk/nhibernate/src/NHibernate/Engine/Query/NativeSQLQueryPlan.cs
trunk/nhibernate/src/NHibernate/Engine/Query/QueryPlanCache.cs
trunk/nhibernate/src/NHibernate/Engine/QueryParameters.cs
trunk/nhibernate/src/NHibernate/Engine/StatefulPersistenceContext.cs
trunk/nhibernate/src/NHibernate/Engine/Transaction/Isolater.cs
trunk/nhibernate/src/NHibernate/Engine/TwoPhaseLoad.cs
trunk/nhibernate/src/NHibernate/Engine/VersionValue.cs
trunk/nhibernate/src/NHibernate/Engine/Versioning.cs
trunk/nhibernate/src/NHibernate/Event/Default/AbstractFlushingEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/AbstractLockUpgradeEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/AbstractReassociateEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/AbstractSaveEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultAutoFlushEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultDeleteEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultDirtyCheckEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultEvictEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultFlushEntityEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultInitializeCollectionEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultLoadEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultMergeEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultPersistEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultRefreshEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultReplicateEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultSaveOrUpdateEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/EvictVisitor.cs
trunk/nhibernate/src/NHibernate/Event/Default/ReattachVisitor.cs
trunk/nhibernate/src/NHibernate/Event/Default/WrapVisitor.cs
trunk/nhibernate/src/NHibernate/Exceptions/SQLExceptionConverterFactory.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/ErrorCounter.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/AbstractStatementExecutor.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/BasicExecutor.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/MultiTableDeleteExecutor.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/MultiTableUpdateExecutor.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlParser.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/QueryTranslatorImpl.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/AbstractRestrictableStatement.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/DeleteStatement.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/DotNode.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/FromClause.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/FromElement.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/FromElementFactory.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/FromElementType.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/FromReferenceNode.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/IndexNode.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/MethodNode.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/QueryNode.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/UpdateStatement.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Util/JoinProcessor.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Util/LiteralProcessor.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Util/PathHelper.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Util/SyntheticAndFactory.cs
trunk/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs
trunk/nhibernate/src/NHibernate/Hql/QuerySplitter.cs
trunk/nhibernate/src/NHibernate/Id/Enhanced/OptimizerFactory.cs
trunk/nhibernate/src/NHibernate/Id/Enhanced/SequenceStructure.cs
trunk/nhibernate/src/NHibernate/Id/Enhanced/SequenceStyleGenerator.cs
trunk/nhibernate/src/NHibernate/Id/Enhanced/TableStructure.cs
trunk/nhibernate/src/NHibernate/Id/IdentifierGeneratorFactory.cs
trunk/nhibernate/src/NHibernate/Id/IncrementGenerator.cs
trunk/nhibernate/src/NHibernate/Id/NativeGuidGenerator.cs
trunk/nhibernate/src/NHibernate/Id/SequenceGenerator.cs
trunk/nhibernate/src/NHibernate/Id/SequenceHiLoGenerator.cs
trunk/nhibernate/src/NHibernate/Id/TableGenerator.cs
trunk/nhibernate/src/NHibernate/Id/TableHiLoGenerator.cs
trunk/nhibernate/src/NHibernate/Impl/AbstractSessionImpl.cs
trunk/nhibernate/src/NHibernate/Impl/EnumerableImpl.cs
trunk/nhibernate/src/NHibernate/Impl/MultiCriteriaImpl.cs
trunk/nhibernate/src/NHibernate/Impl/MultiQueryImpl.cs
trunk/nhibernate/src/NHibernate/Impl/Printer.cs
trunk/nhibernate/src/NHibernate/Impl/SessionFactoryImpl.cs
trunk/nhibernate/src/NHibernate/Impl/SessionFactoryObjectFactory.cs
trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs
trunk/nhibernate/src/NHibernate/Impl/StatelessSessionImpl.cs
trunk/nhibernate/src/NHibernate/LazyInitializationException.cs
trunk/nhibernate/src/NHibernate/Linq/Functions/LinqToHqlGeneratorsRegistryFactory.cs
trunk/nhibernate/src/NHibernate/Loader/Collection/BasicCollectionLoader.cs
trunk/nhibernate/src/NHibernate/Loader/Collection/OneToManyLoader.cs
trunk/nhibernate/src/NHibernate/Loader/Criteria/CriteriaJoinWalker.cs
trunk/nhibernate/src/NHibernate/Loader/Criteria/CriteriaQueryTranslator.cs
trunk/nhibernate/src/NHibernate/Loader/Custom/Sql/SQLCustomQuery.cs
trunk/nhibernate/src/NHibernate/Loader/Custom/Sql/SQLQueryReturnProcessor.cs
trunk/nhibernate/src/NHibernate/Loader/Entity/AbstractEntityLoader.cs
trunk/nhibernate/src/NHibernate/Loader/Entity/CollectionElementLoader.cs
trunk/nhibernate/src/NHibernate/Loader/Loader.cs
trunk/nhibernate/src/NHibernate/Mapping/RootClass.cs
trunk/nhibernate/src/NHibernate/NHibernate.csproj
trunk/nhibernate/src/NHibernate/NonUniqueResultException.cs
trunk/nhibernate/src/NHibernate/Persister/Collection/AbstractCollectionPersister.cs
trunk/nhibernate/src/NHibernate/Persister/Collection/NamedQueryCollectionInitializer.cs
trunk/nhibernate/src/NHibernate/Persister/Entity/AbstractEntityPersister.cs
trunk/nhibernate/src/NHibernate/Persister/Entity/NamedQueryLoader.cs
trunk/nhibernate/src/NHibernate/SqlCommand/InsertSelect.cs
trunk/nhibernate/src/NHibernate/SqlCommand/SqlDeleteBuilder.cs
trunk/nhibernate/src/NHibernate/SqlCommand/SqlInsertBuilder.cs
trunk/nhibernate/src/NHibernate/SqlCommand/SqlSelectBuilder.cs
trunk/nhibernate/src/NHibernate/SqlCommand/SqlUpdateBuilder.cs
trunk/nhibernate/src/NHibernate/Stat/StatisticsImpl.cs
trunk/nhibernate/src/NHibernate/Tool/hbm2ddl/DatabaseMetadata.cs
trunk/nhibernate/src/NHibernate/Tool/hbm2ddl/SchemaExport.cs
trunk/nhibernate/src/NHibernate/Tool/hbm2ddl/SchemaUpdate.cs
trunk/nhibernate/src/NHibernate/Tool/hbm2ddl/SchemaValidator.cs
trunk/nhibernate/src/NHibernate/Transaction/AdoNetTransactionFactory.cs
trunk/nhibernate/src/NHibernate/Transaction/AdoNetWithDistributedTransactionFactory.cs
trunk/nhibernate/src/NHibernate/Transaction/AdoTransaction.cs
trunk/nhibernate/src/NHibernate/Transform/DistinctRootEntityResultTransformer.cs
trunk/nhibernate/src/NHibernate/Tuple/Component/AbstractComponentTuplizer.cs
trunk/nhibernate/src/NHibernate/Tuple/Entity/AbstractEntityTuplizer.cs
trunk/nhibernate/src/NHibernate/Tuple/Entity/DynamicMapEntityTuplizer.cs
trunk/nhibernate/src/NHibernate/Tuple/Entity/EntityMetamodel.cs
trunk/nhibernate/src/NHibernate/Tuple/Entity/PocoEntityTuplizer.cs
trunk/nhibernate/src/NHibernate/Tuple/PocoInstantiator.cs
trunk/nhibernate/src/NHibernate/Type/CompositeCustomType.cs
trunk/nhibernate/src/NHibernate/Type/CustomType.cs
trunk/nhibernate/src/NHibernate/Type/DbTimestampType.cs
trunk/nhibernate/src/NHibernate/Type/NullableType.cs
trunk/nhibernate/src/NHibernate/Util/ADOExceptionReporter.cs
trunk/nhibernate/src/NHibernate/Util/IdentityMap.cs
trunk/nhibernate/src/NHibernate/Util/JoinedEnumerable.cs
trunk/nhibernate/src/NHibernate/Util/ReflectHelper.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate/Logging.cs
trunk/nhibernate/src/NHibernate.Test/Logging/
trunk/nhibernate/src/NHibernate.Test/Logging/Log4NetLoggerTest.cs
trunk/nhibernate/src/NHibernate.Test/Logging/LogggerProviderTest.cs
Modified: trunk/nhibernate/src/NHibernate/AdoNet/AbstractBatcher.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/AdoNet/AbstractBatcher.cs 2010-08-07 17:35:36 UTC (rev 5126)
+++ trunk/nhibernate/src/NHibernate/AdoNet/AbstractBatcher.cs 2010-08-08 21:40:41 UTC (rev 5127)
@@ -1,7 +1,7 @@
using System;
using System.Data;
using Iesi.Collections.Generic;
-using log4net;
+
using NHibernate.Driver;
using NHibernate.Engine;
using NHibernate.Exceptions;
@@ -21,7 +21,7 @@
/// </summary>
public abstract class AbstractBatcher : IBatcher
{
- protected static readonly ILog log = LogManager.GetLogger(typeof(AbstractBatcher));
+ protected static readonly ILogger log = LogggerProvider.LoggerFor(typeof(AbstractBatcher));
private static int openCommandCount;
private static int openReaderCount;
Modified: trunk/nhibernate/src/NHibernate/AdoNet/ConnectionManager.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/AdoNet/ConnectionManager.cs 2010-08-07 17:35:36 UTC (rev 5126)
+++ trunk/nhibernate/src/NHibernate/AdoNet/ConnectionManager.cs 2010-08-08 21:40:41 UTC (rev 5127)
@@ -2,7 +2,7 @@
using System.Data;
using System.Runtime.Serialization;
using System.Security.Permissions;
-using log4net;
+
using NHibernate.Engine;
namespace NHibernate.AdoNet
@@ -17,7 +17,7 @@
[Serializable]
public class ConnectionManager : ISerializable, IDeserializationCallback
{
- private static readonly ILog log = LogManager.GetLogger(typeof(ConnectionManager));
+ private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(ConnectionManager));
public interface Callback
{
Modified: trunk/nhibernate/src/NHibernate/AdoNet/Util/SqlStatementLogger.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/AdoNet/Util/SqlStatementLogger.cs 2010-08-07 17:35:36 UTC (rev 5126)
+++ trunk/nhibernate/src/NHibernate/AdoNet/Util/SqlStatementLogger.cs 2010-08-08 21:40:41 UTC (rev 5127)
@@ -1,14 +1,14 @@
using System;
using System.Data;
using System.Text;
-using log4net;
+
namespace NHibernate.AdoNet.Util
{
/// <summary> Centralize logging handling for SQL statements. </summary>
public class SqlStatementLogger
{
- private static readonly ILog log = LogManager.GetLogger("NHibernate.SQL");
+ private static readonly ILogger log = LogggerProvider.LoggerFor("NHibernate.SQL");
/// <summary> Constructs a new SqlStatementLogger instance.</summary>
public SqlStatementLogger() : this(false, false) { }
Modified: trunk/nhibernate/src/NHibernate/AssertionFailure.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/AssertionFailure.cs 2010-08-07 17:35:36 UTC (rev 5126)
+++ trunk/nhibernate/src/NHibernate/AssertionFailure.cs 2010-08-08 21:40:41 UTC (rev 5127)
@@ -1,7 +1,7 @@
using System;
using System.Runtime.Serialization;
-using log4net;
+
namespace NHibernate
{
/// <summary>
@@ -17,7 +17,7 @@
/// </summary>
public AssertionFailure() : base(String.Empty)
{
- LogManager.GetLogger(typeof(AssertionFailure)).Error(DefaultMessage);
+ LogggerProvider.LoggerFor(typeof(AssertionFailure)).Error(DefaultMessage);
}
/// <summary>
@@ -26,7 +26,7 @@
/// <param name="message">The message that describes the error. </param>
public AssertionFailure(string message) : base(message)
{
- LogManager.GetLogger(typeof(AssertionFailure)).Error(DefaultMessage, this);
+ LogggerProvider.LoggerFor(typeof(AssertionFailure)).Error(DefaultMessage, this);
}
/// <summary>
@@ -40,7 +40,7 @@
/// </param>
public AssertionFailure(string message, Exception innerException) : base(message, innerException)
{
- LogManager.GetLogger(typeof(AssertionFailure)).Error(DefaultMessage, innerException);
+ LogggerProvider.LoggerFor(typeof(AssertionFailure)).Error(DefaultMessage, innerException);
}
/// <summary>
Modified: trunk/nhibernate/src/NHibernate/Bytecode/CodeDom/BytecodeProviderImpl.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Bytecode/CodeDom/BytecodeProviderImpl.cs 2010-08-07 17:35:36 UTC (rev 5126)
+++ trunk/nhibernate/src/NHibernate/Bytecode/CodeDom/BytecodeProviderImpl.cs 2010-08-08 21:40:41 UTC (rev 5127)
@@ -2,7 +2,7 @@
using System.CodeDom.Compiler;
using System.Reflection;
using System.Text;
-using log4net;
+
using Microsoft.CSharp;
using NHibernate.Properties;
@@ -13,7 +13,7 @@
/// </summary>
public class BytecodeProviderImpl : AbstractBytecodeProvider
{
- private static readonly ILog log = LogManager.GetLogger(typeof (BytecodeProviderImpl));
+ private static readonly ILogger log = LogggerProvider.LoggerFor(typeof (BytecodeProviderImpl));
#region IBytecodeProvider Members
Modified: trunk/nhibernate/src/NHibernate/Cache/CacheFactory.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cache/CacheFactory.cs 2010-08-07 17:35:36 UTC (rev 5126)
+++ trunk/nhibernate/src/NHibernate/Cache/CacheFactory.cs 2010-08-08 21:40:41 UTC (rev 5127)
@@ -1,4 +1,4 @@
-using log4net;
+
using NHibernate.Cfg;
using System.Collections.Generic;
@@ -9,7 +9,7 @@
/// </summary>
public static class CacheFactory
{
- private static readonly ILog log = LogManager.GetLogger(typeof(CacheFactory));
+ private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(CacheFactory));
public const string ReadOnly = "read-only";
public const string ReadWrite = "read-write";
Modified: trunk/nhibernate/src/NHibernate/Cache/NoCacheProvider.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cache/NoCacheProvider.cs 2010-08-07 17:35:36 UTC (rev 5126)
+++ trunk/nhibernate/src/NHibernate/Cache/NoCacheProvider.cs 2010-08-08 21:40:41 UTC (rev 5127)
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
-using log4net;
+
namespace NHibernate.Cache
{
/// <summary>
@@ -9,7 +9,7 @@
/// </summary>
public class NoCacheProvider : ICacheProvider
{
- private static readonly ILog log = LogManager.GetLogger(typeof(NoCacheProvider));
+ private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(NoCacheProvider));
public const string WarnMessage = "Second-level cache is enabled in a class, but no cache provider was selected. Fake cache used.";
Modified: trunk/nhibernate/src/NHibernate/Cache/NonstrictReadWriteCache.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cache/NonstrictReadWriteCache.cs 2010-08-07 17:35:36 UTC (rev 5126)
+++ trunk/nhibernate/src/NHibernate/Cache/NonstrictReadWriteCache.cs 2010-08-08 21:40:41 UTC (rev 5127)
@@ -1,7 +1,7 @@
using System;
using System.Collections;
-using log4net;
+
namespace NHibernate.Cache
{
/// <summary>
@@ -16,7 +16,7 @@
{
private ICache cache;
- private static readonly ILog log = LogManager.GetLogger(typeof(NonstrictReadWriteCache));
+ private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(NonstrictReadWriteCache));
/// <summary>
/// Gets the cache region name.
Modified: trunk/nhibernate/src/NHibernate/Cache/ReadOnlyCache.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cache/ReadOnlyCache.cs 2010-08-07 17:35:36 UTC (rev 5126)
+++ trunk/nhibernate/src/NHibernate/Cache/ReadOnlyCache.cs 2010-08-08 21:40:41 UTC (rev 5127)
@@ -1,7 +1,7 @@
using System;
using System.Collections;
-using log4net;
+
namespace NHibernate.Cache
{
/// <summary>
@@ -10,7 +10,7 @@
public class ReadOnlyCache : ICacheConcurrencyStrategy
{
private ICache cache;
- private static readonly ILog log = LogManager.GetLogger(typeof(ReadOnlyCache));
+ private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(ReadOnlyCache));
/// <summary>
/// Gets the cache region name.
Modified: trunk/nhibernate/src/NHibernate/Cache/ReadWriteCache.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cache/ReadWriteCache.cs 2010-08-07 17:35:36 UTC (rev 5126)
+++ trunk/nhibernate/src/NHibernate/Cache/ReadWriteCache.cs 2010-08-08 21:40:41 UTC (rev 5127)
@@ -1,7 +1,7 @@
using System;
using System.Collections;
-using log4net;
+
namespace NHibernate.Cache
{
/// <summary>
@@ -30,7 +30,7 @@
bool IsPuttable(long txTimestamp, object newVersion, IComparer comparator);
}
- private static readonly ILog log = LogManager.GetLogger(typeof(ReadWriteCache));
+ private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(ReadWriteCache));
private readonly object _lockObject = new object();
private ICache cache;
Modified: trunk/nhibernate/src/NHibernate/Cache/StandardQueryCache.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cache/StandardQueryCache.cs 2010-08-07 17:35:36 UTC (rev 5126)
+++ trunk/nhibernate/src/NHibernate/Cache/StandardQueryCache.cs 2010-08-08 21:40:41 UTC (rev 5127)
@@ -2,7 +2,7 @@
using System.Collections;
using System.Collections.Generic;
using Iesi.Collections.Generic;
-using log4net;
+
using NHibernate.Cfg;
using NHibernate.Engine;
using NHibernate.Type;
@@ -18,7 +18,7 @@
/// </summary>
public class StandardQueryCache : IQueryCache
{
- private static readonly ILog log = LogManager.GetLogger(typeof (StandardQueryCache));
+ private static readonly ILogger log = LogggerProvider.LoggerFor(typeof (StandardQueryCache));
private readonly ICache queryCache;
private readonly string regionName;
private readonly UpdateTimestampsCache updateTimestampsCache;
Modified: trunk/nhibernate/src/NHibernate/Cache/UpdateTimestampsCache.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cache/UpdateTimestampsCache.cs 2010-08-07 17:35:36 UTC (rev 5126)
+++ trunk/nhibernate/src/NHibernate/Cache/UpdateTimestampsCache.cs 2010-08-08 21:40:41 UTC (rev 5127)
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Iesi.Collections.Generic;
-using log4net;
+
using NHibernate.Cfg;
namespace NHibernate.Cache
@@ -16,7 +16,7 @@
/// </summary>
public class UpdateTimestampsCache
{
- private static readonly ILog log = LogManager.GetLogger(typeof(UpdateTimestampsCache));
+ private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(UpdateTimestampsCache));
private ICache updateTimestamps;
private readonly string regionName = typeof(UpdateTimestampsCache).Name;
Modified: trunk/nhibernate/src/NHibernate/Cfg/Configuration.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/Configuration.cs 2010-08-07 17:35:36 UTC (rev 5126)
+++ trunk/nhibernate/src/NHibernate/Cfg/Configuration.cs 2010-08-08 21:40:41 UTC (rev 5127)
@@ -10,7 +10,7 @@
using System.Xml.Schema;
using Iesi.Collections;
using Iesi.Collections.Generic;
-using log4net;
+
using NHibernate.Bytecode;
using NHibernate.Cfg.ConfigurationSchema;
using NHibernate.Cfg.MappingSchema;
@@ -75,7 +75,7 @@
protected IDictionary<string, Mappings.TableDescription> tableNameBinding;
protected IDictionary<Table, Mappings.ColumnNames> columnNameBindingPerTable;
- private static readonly ILog log = LogManager.GetLogger(typeof(Configuration));
+ private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(Configuration));
protected internal SettingsFactory settingsFactory;
Modified: trunk/nhibernate/src/NHibernate/Cfg/ConfigurationSchema/HibernateConfiguration.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/ConfigurationSchema/HibernateConfiguration.cs 2010-08-07 17:35:36 UTC (rev 5126)
+++ trunk/nhibernate/src/NHibernate/Cfg/ConfigurationSchema/HibernateConfiguration.cs 2010-08-08 21:40:41 UTC (rev 5127)
@@ -1,8 +1,8 @@
using System;
using System.Xml;
using System.Xml.XPath;
-using log4net;
+
namespace NHibernate.Cfg.ConfigurationSchema
{
/// <summary>
@@ -23,7 +23,7 @@
/// </summary>
public class HibernateConfiguration : IHibernateConfiguration
{
- private static readonly ILog log = LogManager.GetLogger(typeof(HibernateConfiguration));
+ private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(HibernateConfiguration));
/// <summary>
/// Initializes a new instance of the <see cref="HibernateConfiguration"/> class.
Modified: trunk/nhibernate/src/NHibernate/Cfg/ConfigurationSchema/SessionFactoryConfiguration.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/ConfigurationSchema/SessionFactoryConfiguration.cs 2010-08-07 17:35:36 UTC (rev 5126)
+++ trunk/nhibernate/src/NHibernate/Cfg/ConfigurationSchema/SessionFactoryConfiguration.cs 2010-08-08 21:40:41 UTC (rev 5127)
@@ -8,7 +8,7 @@
/// </summary>
public class SessionFactoryConfiguration : SessionFactoryConfigurationBase
{
- //private static readonly ILog log = LogManager.GetLogger(typeof(SessionFactoryConfiguration));
+ //private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(SessionFactoryConfiguration));
internal SessionFactoryConfiguration(XPathNavigator hbConfigurationSection)
{
Modified: trunk/nhibernate/src/NHibernate/Cfg/Environment.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/Environment.cs 2010-08-07 17:35:36 UTC (rev 5126)
+++ trunk/nhibernate/src/NHibernate/Cfg/Environment.cs 2010-08-08 21:40:41 UTC (rev 5127)
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Configuration;
using System.Reflection;
-using log4net;
+
using NHibernate.Bytecode;
using NHibernate.Cfg.ConfigurationSchema;
using NHibernate.Util;
@@ -167,7 +167,7 @@
private static IBytecodeProvider BytecodeProviderInstance;
private static bool EnableReflectionOptimizer;
- private static readonly ILog log = LogManager.GetLogger(typeof (Environment));
+ private static readonly ILogger log = LogggerProvider.LoggerFor(typeof (Environment));
/// <summary>
/// Issue warnings to user when any obsolete property names are used.
Modified: trunk/nhibernate/src/NHibernate/Cfg/Mappings.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/Mappings.cs 2010-08-07 17:35:36 UTC (rev 5126)
+++ trunk/nhibernate/src/NHibernate/Cfg/Mappings.cs 2010-08-08 21:40:41 UTC (rev 5127)
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Text;
using Iesi.Collections.Generic;
-using log4net;
+
using NHibernate.Engine;
using NHibernate.Mapping;
@@ -47,7 +47,7 @@
#endregion
- private static readonly ILog log = LogManager.GetLogger(typeof(Mappings));
+ private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(Mappings));
private readonly IDictionary<string, PersistentClass> classes;
private readonly IDictionary<string, Mapping.Collection> collections;
Modified: trunk/nhibernate/src/NHibernate/Cfg/SettingsFactory.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/SettingsFactory.cs 2010-08-07 17:35:36 UTC (rev 5126)
+++ trunk/nhibernate/src/NHibernate/Cfg/SettingsFactory.cs 2010-08-08 21:40:41 UTC (rev 5127)
@@ -2,7 +2,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Data;
-using log4net;
+
using NHibernate.AdoNet;
using NHibernate.AdoNet.Util;
using NHibernate.Cache;
@@ -22,7 +22,7 @@
[Serializable]
public sealed class SettingsFactory
{
- private static readonly ILog log = LogManager.GetLogger(typeof(SettingsFactory));
+ private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(SettingsFactory));
private static readonly string DefaultCacheProvider = typeof(NoCacheProvider).AssemblyQualifiedName;
public Settings BuildSettings(IDictionary<string, string> properties)
Modified: trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/Binder.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/Binder.cs 2010-08-07 17:35:36 UTC (rev 5126)
+++ trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/Binder.cs 2010-08-08 21:40:41 UTC (rev 5127)
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using log4net;
+
using NHibernate.Mapping;
using NHibernate.Type;
using NHibernate.Util;
@@ -10,7 +10,7 @@
{
public abstract class Binder
{
- protected static readonly ILog log = LogManager.GetLogger(typeof (Binder));
+ protected static readonly ILogger log = LogggerProvider.LoggerFor(typeof (Binder));
protected static readonly IDictionary<string, MetaAttribute> EmptyMeta =
new CollectionHelper.EmptyMapClass<string, MetaAttribute>();
Modified: trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/FilterDefinitionFactory.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/FilterDefinitionFactory.cs 2010-08-07 17:35:36 UTC (rev 5126)
+++ trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/FilterDefinitionFactory.cs 2010-08-08 21:40:41 UTC (rev 5127)
@@ -1,5 +1,5 @@
using System.Collections.Generic;
-using log4net;
+
using NHibernate.Cfg.MappingSchema;
using NHibernate.Engine;
using NHibernate.Type;
@@ -8,7 +8,7 @@
{
public class FilterDefinitionFactory
{
- private static readonly ILog log = LogManager.GetLogger(typeof (FilterDefinitionFactory));
+ private static readonly ILogger log = LogggerProvider.LoggerFor(typeof (FilterDefinitionFactory));
public static FilterDefinition CreateFilterDefinition(HbmFilterDef filterDefSchema)
{
Modified: trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/MappingLogExtensions.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/MappingLogExtensions.cs 2010-08-07 17:35:36 UTC (rev 5126)
+++ trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/MappingLogExtensions.cs 2010-08-08 21:40:41 UTC (rev 5127)
@@ -1,11 +1,11 @@
using System.Linq;
-using log4net;
+
namespace NHibernate.Cfg.XmlHbmBinding
{
public static class MappingLogExtensions
...
[truncated message content] |
|
From: <fab...@us...> - 2010-08-09 11:33:26
|
Revision: 5129
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5129&view=rev
Author: fabiomaulo
Date: 2010-08-09 11:33:20 +0000 (Mon, 09 Aug 2010)
Log Message:
-----------
bye bye log4net reference :(
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Logging.cs
trunk/nhibernate/src/NHibernate/NHibernate.build
trunk/nhibernate/src/NHibernate/NHibernate.csproj
Modified: trunk/nhibernate/src/NHibernate/Logging.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Logging.cs 2010-08-08 23:08:04 UTC (rev 5128)
+++ trunk/nhibernate/src/NHibernate/Logging.cs 2010-08-09 11:33:20 UTC (rev 5129)
@@ -1,6 +1,5 @@
using System;
using System.Linq.Expressions;
-using log4net;
namespace NHibernate
{
@@ -31,38 +30,73 @@
void WarnFormat(string format, params object[] args);
}
+ public interface ILoggerFactory
+ {
+ ILogger LoggerFor(string keyName);
+ ILogger LoggerFor(System.Type type);
+ }
+
public class LogggerProvider
{
- private readonly Func<string, ILogger> loggerByKeyGetter;
- private readonly Func<System.Type, ILogger> loggerByTypeGetter;
+ private readonly ILoggerFactory loggerFactory;
private static LogggerProvider instance;
+
static LogggerProvider()
{
- SetLoggersFactoryDelegates(key => new Log4NetLogger(LogManager.GetLogger(key)), type => new Log4NetLogger(LogManager.GetLogger(type)));
+ SetLoggersFactory(new Log4NetLoggerFactory());
}
- public static void SetLoggersFactoryDelegates(Func<string, ILogger> loggerByKeyGetter, Func<System.Type, ILogger> loggerByTypeGetter)
+ public static void SetLoggersFactory(ILoggerFactory loggerFactory)
{
- instance = new LogggerProvider(loggerByKeyGetter, loggerByTypeGetter);
+ instance = new LogggerProvider(loggerFactory);
}
- private LogggerProvider(Func<string, ILogger> loggerByKeyGetter, Func<System.Type, ILogger> loggerByTypeGetter)
+ private LogggerProvider(ILoggerFactory loggerFactory)
{
- this.loggerByKeyGetter = loggerByKeyGetter;
- this.loggerByTypeGetter = loggerByTypeGetter;
+ this.loggerFactory = loggerFactory;
}
public static ILogger LoggerFor(string keyName)
{
- return instance.loggerByKeyGetter(keyName);
+ return instance.loggerFactory.LoggerFor(keyName);
}
public static ILogger LoggerFor(System.Type type)
{
- return instance.loggerByTypeGetter(type);
+ return instance.loggerFactory.LoggerFor(type);
}
}
+ public class Log4NetLoggerFactory: ILoggerFactory
+ {
+ private static readonly System.Type LogManagerType = System.Type.GetType("log4net.LogManager, log4net");
+ private static readonly Func<string, object> GetLoggerByNameDelegate;
+ private static readonly Func<System.Type, object> GetLoggerByTypeDelegate;
+ static Log4NetLoggerFactory()
+ {
+ GetLoggerByNameDelegate = GetGetLoggerMethodCall<string>();
+ GetLoggerByTypeDelegate = GetGetLoggerMethodCall<System.Type>();
+ }
+ public ILogger LoggerFor(string keyName)
+ {
+ return new Log4NetLogger(GetLoggerByNameDelegate(keyName));
+ }
+
+ public ILogger LoggerFor(System.Type type)
+ {
+ return new Log4NetLogger(GetLoggerByTypeDelegate(type));
+ }
+
+ private static Func<TParameter, object> GetGetLoggerMethodCall<TParameter>()
+ {
+ var method = LogManagerType.GetMethod("GetLogger", new[] { typeof(TParameter) });
+ ParameterExpression resultValue;
+ ParameterExpression keyParam = Expression.Parameter(typeof(TParameter), "key");
+ MethodCallExpression methodCall = Expression.Call(null, method, new Expression[] { resultValue = keyParam });
+ return Expression.Lambda<Func<TParameter, object>>(methodCall, new[] { resultValue }).Compile();
+ }
+ }
+
public class Log4NetLogger: ILogger
{
private static readonly System.Type ILogType = System.Type.GetType("log4net.ILog, log4net");
Modified: trunk/nhibernate/src/NHibernate/NHibernate.build
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernate.build 2010-08-08 23:08:04 UTC (rev 5128)
+++ trunk/nhibernate/src/NHibernate/NHibernate.build 2010-08-09 11:33:20 UTC (rev 5129)
@@ -23,7 +23,6 @@
<include name="System.Data.OracleClient" />
<include name="System.Web.dll" />
<include name="Iesi.Collections.dll" />
- <include name="log4net.dll" />
<include name="Antlr3.Runtime.dll" />
<include name="Remotion.dll" />
<include name="Remotion.Data.Linq.dll" />
Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2010-08-08 23:08:04 UTC (rev 5128)
+++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2010-08-09 11:33:20 UTC (rev 5129)
@@ -62,10 +62,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\net\3.5\Iesi.Collections.dll</HintPath>
</Reference>
- <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\net\3.5\log4net.dll</HintPath>
- </Reference>
<Reference Include="Remotion.Data.Linq, Version=1.13.41.2, Culture=neutral, PublicKeyToken=cab60358ab4081ea">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\net\3.5\Remotion.Data.Linq.dll</HintPath>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-08-09 11:41:51
|
Revision: 5130
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5130&view=rev
Author: fabiomaulo
Date: 2010-08-09 11:41:40 +0000 (Mon, 09 Aug 2010)
Log Message:
-----------
Fixed TYPO
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/AdoNet/AbstractBatcher.cs
trunk/nhibernate/src/NHibernate/AdoNet/ConnectionManager.cs
trunk/nhibernate/src/NHibernate/AdoNet/Util/SqlStatementLogger.cs
trunk/nhibernate/src/NHibernate/AssertionFailure.cs
trunk/nhibernate/src/NHibernate/Bytecode/CodeDom/BytecodeProviderImpl.cs
trunk/nhibernate/src/NHibernate/Cache/CacheFactory.cs
trunk/nhibernate/src/NHibernate/Cache/NoCacheProvider.cs
trunk/nhibernate/src/NHibernate/Cache/NonstrictReadWriteCache.cs
trunk/nhibernate/src/NHibernate/Cache/ReadOnlyCache.cs
trunk/nhibernate/src/NHibernate/Cache/ReadWriteCache.cs
trunk/nhibernate/src/NHibernate/Cache/StandardQueryCache.cs
trunk/nhibernate/src/NHibernate/Cache/UpdateTimestampsCache.cs
trunk/nhibernate/src/NHibernate/Cfg/Configuration.cs
trunk/nhibernate/src/NHibernate/Cfg/ConfigurationSchema/HibernateConfiguration.cs
trunk/nhibernate/src/NHibernate/Cfg/ConfigurationSchema/SessionFactoryConfiguration.cs
trunk/nhibernate/src/NHibernate/Cfg/Environment.cs
trunk/nhibernate/src/NHibernate/Cfg/Mappings.cs
trunk/nhibernate/src/NHibernate/Cfg/SettingsFactory.cs
trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/Binder.cs
trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/FilterDefinitionFactory.cs
trunk/nhibernate/src/NHibernate/Collection/PersistentArrayHolder.cs
trunk/nhibernate/src/NHibernate/Connection/ConnectionProvider.cs
trunk/nhibernate/src/NHibernate/Connection/ConnectionProviderFactory.cs
trunk/nhibernate/src/NHibernate/Connection/DriverConnectionProvider.cs
trunk/nhibernate/src/NHibernate/Connection/UserSuppliedConnectionProvider.cs
trunk/nhibernate/src/NHibernate/Context/ThreadLocalSessionContext.cs
trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs
trunk/nhibernate/src/NHibernate/Dialect/Lock/UpdateLockingStrategy.cs
trunk/nhibernate/src/NHibernate/Dialect/Schema/AbstractTableMetadata.cs
trunk/nhibernate/src/NHibernate/Driver/DriverBase.cs
trunk/nhibernate/src/NHibernate/Driver/NHybridDataReader.cs
trunk/nhibernate/src/NHibernate/Engine/ActionQueue.cs
trunk/nhibernate/src/NHibernate/Engine/Cascade.cs
trunk/nhibernate/src/NHibernate/Engine/CascadingAction.cs
trunk/nhibernate/src/NHibernate/Engine/CollectionEntry.cs
trunk/nhibernate/src/NHibernate/Engine/Collections.cs
trunk/nhibernate/src/NHibernate/Engine/ForeignKeys.cs
trunk/nhibernate/src/NHibernate/Engine/IdentifierValue.cs
trunk/nhibernate/src/NHibernate/Engine/Loading/CollectionLoadContext.cs
trunk/nhibernate/src/NHibernate/Engine/Loading/LoadContexts.cs
trunk/nhibernate/src/NHibernate/Engine/Query/HQLQueryPlan.cs
trunk/nhibernate/src/NHibernate/Engine/Query/NativeSQLQueryPlan.cs
trunk/nhibernate/src/NHibernate/Engine/Query/QueryPlanCache.cs
trunk/nhibernate/src/NHibernate/Engine/QueryParameters.cs
trunk/nhibernate/src/NHibernate/Engine/StatefulPersistenceContext.cs
trunk/nhibernate/src/NHibernate/Engine/Transaction/Isolater.cs
trunk/nhibernate/src/NHibernate/Engine/TwoPhaseLoad.cs
trunk/nhibernate/src/NHibernate/Engine/VersionValue.cs
trunk/nhibernate/src/NHibernate/Engine/Versioning.cs
trunk/nhibernate/src/NHibernate/Event/Default/AbstractFlushingEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/AbstractLockUpgradeEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/AbstractReassociateEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/AbstractSaveEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultAutoFlushEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultDeleteEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultDirtyCheckEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultEvictEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultFlushEntityEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultInitializeCollectionEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultLoadEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultMergeEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultPersistEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultRefreshEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultReplicateEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultSaveOrUpdateEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/EvictVisitor.cs
trunk/nhibernate/src/NHibernate/Event/Default/ReattachVisitor.cs
trunk/nhibernate/src/NHibernate/Event/Default/WrapVisitor.cs
trunk/nhibernate/src/NHibernate/Exceptions/SQLExceptionConverterFactory.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/ErrorCounter.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/BasicExecutor.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/MultiTableDeleteExecutor.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/MultiTableUpdateExecutor.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlParser.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/QueryTranslatorImpl.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/DeleteStatement.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/DotNode.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/FromClause.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/FromElement.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/FromElementFactory.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/FromElementType.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/FromReferenceNode.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/IndexNode.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/MethodNode.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/QueryNode.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/UpdateStatement.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Util/JoinProcessor.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Util/LiteralProcessor.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Util/PathHelper.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Util/SyntheticAndFactory.cs
trunk/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs
trunk/nhibernate/src/NHibernate/Hql/QuerySplitter.cs
trunk/nhibernate/src/NHibernate/Id/Enhanced/OptimizerFactory.cs
trunk/nhibernate/src/NHibernate/Id/Enhanced/SequenceStructure.cs
trunk/nhibernate/src/NHibernate/Id/Enhanced/SequenceStyleGenerator.cs
trunk/nhibernate/src/NHibernate/Id/Enhanced/TableStructure.cs
trunk/nhibernate/src/NHibernate/Id/IdentifierGeneratorFactory.cs
trunk/nhibernate/src/NHibernate/Id/IncrementGenerator.cs
trunk/nhibernate/src/NHibernate/Id/NativeGuidGenerator.cs
trunk/nhibernate/src/NHibernate/Id/SequenceGenerator.cs
trunk/nhibernate/src/NHibernate/Id/SequenceHiLoGenerator.cs
trunk/nhibernate/src/NHibernate/Id/TableGenerator.cs
trunk/nhibernate/src/NHibernate/Id/TableHiLoGenerator.cs
trunk/nhibernate/src/NHibernate/Impl/AbstractSessionImpl.cs
trunk/nhibernate/src/NHibernate/Impl/EnumerableImpl.cs
trunk/nhibernate/src/NHibernate/Impl/MultiCriteriaImpl.cs
trunk/nhibernate/src/NHibernate/Impl/MultiQueryImpl.cs
trunk/nhibernate/src/NHibernate/Impl/Printer.cs
trunk/nhibernate/src/NHibernate/Impl/SessionFactoryImpl.cs
trunk/nhibernate/src/NHibernate/Impl/SessionFactoryObjectFactory.cs
trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs
trunk/nhibernate/src/NHibernate/Impl/StatelessSessionImpl.cs
trunk/nhibernate/src/NHibernate/LazyInitializationException.cs
trunk/nhibernate/src/NHibernate/Linq/Functions/LinqToHqlGeneratorsRegistryFactory.cs
trunk/nhibernate/src/NHibernate/Loader/Collection/BasicCollectionLoader.cs
trunk/nhibernate/src/NHibernate/Loader/Collection/OneToManyLoader.cs
trunk/nhibernate/src/NHibernate/Loader/Criteria/CriteriaJoinWalker.cs
trunk/nhibernate/src/NHibernate/Loader/Criteria/CriteriaQueryTranslator.cs
trunk/nhibernate/src/NHibernate/Loader/Custom/Sql/SQLCustomQuery.cs
trunk/nhibernate/src/NHibernate/Loader/Custom/Sql/SQLQueryReturnProcessor.cs
trunk/nhibernate/src/NHibernate/Loader/Entity/AbstractEntityLoader.cs
trunk/nhibernate/src/NHibernate/Loader/Entity/CollectionElementLoader.cs
trunk/nhibernate/src/NHibernate/Loader/Loader.cs
trunk/nhibernate/src/NHibernate/Logging.cs
trunk/nhibernate/src/NHibernate/Mapping/RootClass.cs
trunk/nhibernate/src/NHibernate/NonUniqueResultException.cs
trunk/nhibernate/src/NHibernate/Persister/Collection/AbstractCollectionPersister.cs
trunk/nhibernate/src/NHibernate/Persister/Collection/NamedQueryCollectionInitializer.cs
trunk/nhibernate/src/NHibernate/Persister/Entity/AbstractEntityPersister.cs
trunk/nhibernate/src/NHibernate/Persister/Entity/NamedQueryLoader.cs
trunk/nhibernate/src/NHibernate/SqlCommand/InsertSelect.cs
trunk/nhibernate/src/NHibernate/SqlCommand/SqlDeleteBuilder.cs
trunk/nhibernate/src/NHibernate/SqlCommand/SqlInsertBuilder.cs
trunk/nhibernate/src/NHibernate/SqlCommand/SqlSelectBuilder.cs
trunk/nhibernate/src/NHibernate/SqlCommand/SqlUpdateBuilder.cs
trunk/nhibernate/src/NHibernate/Stat/StatisticsImpl.cs
trunk/nhibernate/src/NHibernate/Tool/hbm2ddl/DatabaseMetadata.cs
trunk/nhibernate/src/NHibernate/Tool/hbm2ddl/SchemaExport.cs
trunk/nhibernate/src/NHibernate/Tool/hbm2ddl/SchemaUpdate.cs
trunk/nhibernate/src/NHibernate/Tool/hbm2ddl/SchemaValidator.cs
trunk/nhibernate/src/NHibernate/Transaction/AdoNetTransactionFactory.cs
trunk/nhibernate/src/NHibernate/Transaction/AdoNetWithDistributedTransactionFactory.cs
trunk/nhibernate/src/NHibernate/Transaction/AdoTransaction.cs
trunk/nhibernate/src/NHibernate/Transform/DistinctRootEntityResultTransformer.cs
trunk/nhibernate/src/NHibernate/Tuple/Component/AbstractComponentTuplizer.cs
trunk/nhibernate/src/NHibernate/Tuple/Entity/AbstractEntityTuplizer.cs
trunk/nhibernate/src/NHibernate/Tuple/Entity/DynamicMapEntityTuplizer.cs
trunk/nhibernate/src/NHibernate/Tuple/Entity/EntityMetamodel.cs
trunk/nhibernate/src/NHibernate/Tuple/Entity/PocoEntityTuplizer.cs
trunk/nhibernate/src/NHibernate/Tuple/PocoInstantiator.cs
trunk/nhibernate/src/NHibernate/Type/CompositeCustomType.cs
trunk/nhibernate/src/NHibernate/Type/CustomType.cs
trunk/nhibernate/src/NHibernate/Type/DbTimestampType.cs
trunk/nhibernate/src/NHibernate/Type/NullableType.cs
trunk/nhibernate/src/NHibernate/Util/ADOExceptionReporter.cs
trunk/nhibernate/src/NHibernate/Util/IdentityMap.cs
trunk/nhibernate/src/NHibernate/Util/JoinedEnumerable.cs
trunk/nhibernate/src/NHibernate/Util/ReflectHelper.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/Logging/LoggerProviderTest.cs
Removed Paths:
-------------
trunk/nhibernate/src/NHibernate.Test/Logging/LogggerProviderTest.cs
Modified: trunk/nhibernate/src/NHibernate/AdoNet/AbstractBatcher.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/AdoNet/AbstractBatcher.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/AdoNet/AbstractBatcher.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -21,7 +21,7 @@
/// </summary>
public abstract class AbstractBatcher : IBatcher
{
- protected static readonly ILogger log = LogggerProvider.LoggerFor(typeof(AbstractBatcher));
+ protected static readonly ILogger log = LoggerProvider.LoggerFor(typeof(AbstractBatcher));
private static int openCommandCount;
private static int openReaderCount;
Modified: trunk/nhibernate/src/NHibernate/AdoNet/ConnectionManager.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/AdoNet/ConnectionManager.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/AdoNet/ConnectionManager.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -17,7 +17,7 @@
[Serializable]
public class ConnectionManager : ISerializable, IDeserializationCallback
{
- private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(ConnectionManager));
+ private static readonly ILogger log = LoggerProvider.LoggerFor(typeof(ConnectionManager));
public interface Callback
{
Modified: trunk/nhibernate/src/NHibernate/AdoNet/Util/SqlStatementLogger.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/AdoNet/Util/SqlStatementLogger.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/AdoNet/Util/SqlStatementLogger.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -8,7 +8,7 @@
/// <summary> Centralize logging handling for SQL statements. </summary>
public class SqlStatementLogger
{
- private static readonly ILogger log = LogggerProvider.LoggerFor("NHibernate.SQL");
+ private static readonly ILogger log = LoggerProvider.LoggerFor("NHibernate.SQL");
/// <summary> Constructs a new SqlStatementLogger instance.</summary>
public SqlStatementLogger() : this(false, false) { }
Modified: trunk/nhibernate/src/NHibernate/AssertionFailure.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/AssertionFailure.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/AssertionFailure.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -17,7 +17,7 @@
/// </summary>
public AssertionFailure() : base(String.Empty)
{
- LogggerProvider.LoggerFor(typeof(AssertionFailure)).Error(DefaultMessage);
+ LoggerProvider.LoggerFor(typeof(AssertionFailure)).Error(DefaultMessage);
}
/// <summary>
@@ -26,7 +26,7 @@
/// <param name="message">The message that describes the error. </param>
public AssertionFailure(string message) : base(message)
{
- LogggerProvider.LoggerFor(typeof(AssertionFailure)).Error(DefaultMessage, this);
+ LoggerProvider.LoggerFor(typeof(AssertionFailure)).Error(DefaultMessage, this);
}
/// <summary>
@@ -40,7 +40,7 @@
/// </param>
public AssertionFailure(string message, Exception innerException) : base(message, innerException)
{
- LogggerProvider.LoggerFor(typeof(AssertionFailure)).Error(DefaultMessage, innerException);
+ LoggerProvider.LoggerFor(typeof(AssertionFailure)).Error(DefaultMessage, innerException);
}
/// <summary>
Modified: trunk/nhibernate/src/NHibernate/Bytecode/CodeDom/BytecodeProviderImpl.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Bytecode/CodeDom/BytecodeProviderImpl.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/Bytecode/CodeDom/BytecodeProviderImpl.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -13,7 +13,7 @@
/// </summary>
public class BytecodeProviderImpl : AbstractBytecodeProvider
{
- private static readonly ILogger log = LogggerProvider.LoggerFor(typeof (BytecodeProviderImpl));
+ private static readonly ILogger log = LoggerProvider.LoggerFor(typeof (BytecodeProviderImpl));
#region IBytecodeProvider Members
Modified: trunk/nhibernate/src/NHibernate/Cache/CacheFactory.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cache/CacheFactory.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/Cache/CacheFactory.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -9,7 +9,7 @@
/// </summary>
public static class CacheFactory
{
- private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(CacheFactory));
+ private static readonly ILogger log = LoggerProvider.LoggerFor(typeof(CacheFactory));
public const string ReadOnly = "read-only";
public const string ReadWrite = "read-write";
Modified: trunk/nhibernate/src/NHibernate/Cache/NoCacheProvider.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cache/NoCacheProvider.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/Cache/NoCacheProvider.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -9,7 +9,7 @@
/// </summary>
public class NoCacheProvider : ICacheProvider
{
- private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(NoCacheProvider));
+ private static readonly ILogger log = LoggerProvider.LoggerFor(typeof(NoCacheProvider));
public const string WarnMessage = "Second-level cache is enabled in a class, but no cache provider was selected. Fake cache used.";
Modified: trunk/nhibernate/src/NHibernate/Cache/NonstrictReadWriteCache.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cache/NonstrictReadWriteCache.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/Cache/NonstrictReadWriteCache.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -16,7 +16,7 @@
{
private ICache cache;
- private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(NonstrictReadWriteCache));
+ private static readonly ILogger log = LoggerProvider.LoggerFor(typeof(NonstrictReadWriteCache));
/// <summary>
/// Gets the cache region name.
Modified: trunk/nhibernate/src/NHibernate/Cache/ReadOnlyCache.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cache/ReadOnlyCache.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/Cache/ReadOnlyCache.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -10,7 +10,7 @@
public class ReadOnlyCache : ICacheConcurrencyStrategy
{
private ICache cache;
- private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(ReadOnlyCache));
+ private static readonly ILogger log = LoggerProvider.LoggerFor(typeof(ReadOnlyCache));
/// <summary>
/// Gets the cache region name.
Modified: trunk/nhibernate/src/NHibernate/Cache/ReadWriteCache.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cache/ReadWriteCache.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/Cache/ReadWriteCache.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -30,7 +30,7 @@
bool IsPuttable(long txTimestamp, object newVersion, IComparer comparator);
}
- private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(ReadWriteCache));
+ private static readonly ILogger log = LoggerProvider.LoggerFor(typeof(ReadWriteCache));
private readonly object _lockObject = new object();
private ICache cache;
Modified: trunk/nhibernate/src/NHibernate/Cache/StandardQueryCache.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cache/StandardQueryCache.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/Cache/StandardQueryCache.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -18,7 +18,7 @@
/// </summary>
public class StandardQueryCache : IQueryCache
{
- private static readonly ILogger log = LogggerProvider.LoggerFor(typeof (StandardQueryCache));
+ private static readonly ILogger log = LoggerProvider.LoggerFor(typeof (StandardQueryCache));
private readonly ICache queryCache;
private readonly string regionName;
private readonly UpdateTimestampsCache updateTimestampsCache;
Modified: trunk/nhibernate/src/NHibernate/Cache/UpdateTimestampsCache.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cache/UpdateTimestampsCache.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/Cache/UpdateTimestampsCache.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -16,7 +16,7 @@
/// </summary>
public class UpdateTimestampsCache
{
- private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(UpdateTimestampsCache));
+ private static readonly ILogger log = LoggerProvider.LoggerFor(typeof(UpdateTimestampsCache));
private ICache updateTimestamps;
private readonly string regionName = typeof(UpdateTimestampsCache).Name;
Modified: trunk/nhibernate/src/NHibernate/Cfg/Configuration.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/Configuration.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/Cfg/Configuration.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -75,7 +75,7 @@
protected IDictionary<string, Mappings.TableDescription> tableNameBinding;
protected IDictionary<Table, Mappings.ColumnNames> columnNameBindingPerTable;
- private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(Configuration));
+ private static readonly ILogger log = LoggerProvider.LoggerFor(typeof(Configuration));
protected internal SettingsFactory settingsFactory;
Modified: trunk/nhibernate/src/NHibernate/Cfg/ConfigurationSchema/HibernateConfiguration.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/ConfigurationSchema/HibernateConfiguration.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/Cfg/ConfigurationSchema/HibernateConfiguration.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -23,7 +23,7 @@
/// </summary>
public class HibernateConfiguration : IHibernateConfiguration
{
- private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(HibernateConfiguration));
+ private static readonly ILogger log = LoggerProvider.LoggerFor(typeof(HibernateConfiguration));
/// <summary>
/// Initializes a new instance of the <see cref="HibernateConfiguration"/> class.
Modified: trunk/nhibernate/src/NHibernate/Cfg/ConfigurationSchema/SessionFactoryConfiguration.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/ConfigurationSchema/SessionFactoryConfiguration.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/Cfg/ConfigurationSchema/SessionFactoryConfiguration.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -8,7 +8,7 @@
/// </summary>
public class SessionFactoryConfiguration : SessionFactoryConfigurationBase
{
- //private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(SessionFactoryConfiguration));
+ //private static readonly ILogger log = LoggerProvider.LoggerFor(typeof(SessionFactoryConfiguration));
internal SessionFactoryConfiguration(XPathNavigator hbConfigurationSection)
{
Modified: trunk/nhibernate/src/NHibernate/Cfg/Environment.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/Environment.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/Cfg/Environment.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -167,7 +167,7 @@
private static IBytecodeProvider BytecodeProviderInstance;
private static bool EnableReflectionOptimizer;
- private static readonly ILogger log = LogggerProvider.LoggerFor(typeof (Environment));
+ private static readonly ILogger log = LoggerProvider.LoggerFor(typeof (Environment));
/// <summary>
/// Issue warnings to user when any obsolete property names are used.
Modified: trunk/nhibernate/src/NHibernate/Cfg/Mappings.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/Mappings.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/Cfg/Mappings.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -47,7 +47,7 @@
#endregion
- private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(Mappings));
+ private static readonly ILogger log = LoggerProvider.LoggerFor(typeof(Mappings));
private readonly IDictionary<string, PersistentClass> classes;
private readonly IDictionary<string, Mapping.Collection> collections;
Modified: trunk/nhibernate/src/NHibernate/Cfg/SettingsFactory.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/SettingsFactory.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/Cfg/SettingsFactory.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -22,7 +22,7 @@
[Serializable]
public sealed class SettingsFactory
{
- private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(SettingsFactory));
+ private static readonly ILogger log = LoggerProvider.LoggerFor(typeof(SettingsFactory));
private static readonly string DefaultCacheProvider = typeof(NoCacheProvider).AssemblyQualifiedName;
public Settings BuildSettings(IDictionary<string, string> properties)
Modified: trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/Binder.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/Binder.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/Binder.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -10,7 +10,7 @@
{
public abstract class Binder
{
- protected static readonly ILogger log = LogggerProvider.LoggerFor(typeof (Binder));
+ protected static readonly ILogger log = LoggerProvider.LoggerFor(typeof (Binder));
protected static readonly IDictionary<string, MetaAttribute> EmptyMeta =
new CollectionHelper.EmptyMapClass<string, MetaAttribute>();
Modified: trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/FilterDefinitionFactory.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/FilterDefinitionFactory.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/FilterDefinitionFactory.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -8,7 +8,7 @@
{
public class FilterDefinitionFactory
{
- private static readonly ILogger log = LogggerProvider.LoggerFor(typeof (FilterDefinitionFactory));
+ private static readonly ILogger log = LoggerProvider.LoggerFor(typeof (FilterDefinitionFactory));
public static FilterDefinition CreateFilterDefinition(HbmFilterDef filterDefSchema)
{
Modified: trunk/nhibernate/src/NHibernate/Collection/PersistentArrayHolder.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Collection/PersistentArrayHolder.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/Collection/PersistentArrayHolder.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -20,7 +20,7 @@
[DebuggerTypeProxy(typeof (CollectionProxy))]
public class PersistentArrayHolder : AbstractPersistentCollection, ICollection
{
- private static readonly ILogger log = LogggerProvider.LoggerFor(typeof (PersistentArrayHolder));
+ private static readonly ILogger log = LoggerProvider.LoggerFor(typeof (PersistentArrayHolder));
private Array array;
Modified: trunk/nhibernate/src/NHibernate/Connection/ConnectionProvider.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Connection/ConnectionProvider.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/Connection/ConnectionProvider.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -15,7 +15,7 @@
/// </summary>
public abstract class ConnectionProvider : IConnectionProvider
{
- private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(ConnectionProvider));
+ private static readonly ILogger log = LoggerProvider.LoggerFor(typeof(ConnectionProvider));
private string connString;
private IDriver driver;
Modified: trunk/nhibernate/src/NHibernate/Connection/ConnectionProviderFactory.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Connection/ConnectionProviderFactory.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/Connection/ConnectionProviderFactory.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -11,7 +11,7 @@
/// </summary>
public sealed class ConnectionProviderFactory
{
- private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(ConnectionProviderFactory));
+ private static readonly ILogger log = LoggerProvider.LoggerFor(typeof(ConnectionProviderFactory));
// cannot be instantiated
private ConnectionProviderFactory()
Modified: trunk/nhibernate/src/NHibernate/Connection/DriverConnectionProvider.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Connection/DriverConnectionProvider.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/Connection/DriverConnectionProvider.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -9,7 +9,7 @@
/// </summary>
public class DriverConnectionProvider : ConnectionProvider
{
- private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(DriverConnectionProvider));
+ private static readonly ILogger log = LoggerProvider.LoggerFor(typeof(DriverConnectionProvider));
/// <summary>
/// Closes and Disposes of the <see cref="IDbConnection"/>.
Modified: trunk/nhibernate/src/NHibernate/Connection/UserSuppliedConnectionProvider.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Connection/UserSuppliedConnectionProvider.cs 2010-08-09 11:33:20 UTC (rev 5129)
+++ trunk/nhibernate/src/NHibernate/Connection/UserSuppliedConnectionProvider.cs 2010-08-09 11:41:40 UTC (rev 5130)
@@ -14,7 +14,7 @@
/// </remarks>
public class UserSuppliedConnectionProvider : ConnectionProvider
{
- private static readonly ILogger log = LogggerProvider.LoggerFor(typeof(UserSuppliedConnectionProvider));
+ private static readonly ILogger log = LoggerProvider.LoggerFor(typeof(UserSuppliedConnectionProvider));
/// <summary>
/// Throws an <see cref="InvalidOperationException"/> if this method is called
Modified: trunk/nhibernate/src/NHibernate/Context/ThreadLocalSessionContext.cs
=======...
[truncated message content] |
|
From: <fab...@us...> - 2010-08-09 13:03:42
|
Revision: 5132
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5132&view=rev
Author: fabiomaulo
Date: 2010-08-09 13:03:36 +0000 (Mon, 09 Aug 2010)
Log Message:
-----------
End logging abstraction : fix NH-1554
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Logging.cs
trunk/nhibernate/src/NHibernate.Test/Logging/LoggerProviderTest.cs
Modified: trunk/nhibernate/src/NHibernate/Logging.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Logging.cs 2010-08-09 11:43:36 UTC (rev 5131)
+++ trunk/nhibernate/src/NHibernate/Logging.cs 2010-08-09 13:03:36 UTC (rev 5132)
@@ -1,4 +1,7 @@
using System;
+using System.Configuration;
+using System.IO;
+using System.Linq;
using System.Linq.Expressions;
namespace NHibernate
@@ -38,14 +41,64 @@
public class LoggerProvider
{
+ private const string NhibernateLoggerConfKey = "nhibernate-logger";
private readonly ILoggerFactory loggerFactory;
private static LoggerProvider instance;
static LoggerProvider()
{
- SetLoggersFactory(new Log4NetLoggerFactory());
+ string nhibernateLoggerClass = GetNhibernateLoggerClass();
+ ILoggerFactory loggerFactory = string.IsNullOrEmpty(nhibernateLoggerClass) ? new NoLoggingLoggerFactory() : GetLoggerFactory(nhibernateLoggerClass);
+ SetLoggersFactory(loggerFactory);
}
+ private static ILoggerFactory GetLoggerFactory(string nhibernateLoggerClass)
+ {
+ ILoggerFactory loggerFactory;
+ var loggerFactoryType = System.Type.GetType(nhibernateLoggerClass);
+ try
+ {
+ loggerFactory = (ILoggerFactory) Activator.CreateInstance(loggerFactoryType);
+ }
+ catch (MissingMethodException ex)
+ {
+ throw new ApplicationException("Public constructor was not found for " + loggerFactoryType, ex);
+ }
+ catch (InvalidCastException ex)
+ {
+ throw new ApplicationException(loggerFactoryType + "Type does not implement " + typeof (ILoggerFactory), ex);
+ }
+ catch (Exception ex)
+ {
+ throw new ApplicationException("Unable to instantiate: " + loggerFactoryType, ex);
+ }
+ return loggerFactory;
+ }
+
+ private static string GetNhibernateLoggerClass()
+ {
+ var nhibernateLogger = ConfigurationManager.AppSettings.Keys.Cast<string>().FirstOrDefault(k => NhibernateLoggerConfKey.Equals(k.ToLowerInvariant()));
+ string nhibernateLoggerClass = null;
+ if (string.IsNullOrEmpty(nhibernateLogger))
+ {
+ // look for log4net.dll
+ string baseDir = AppDomain.CurrentDomain.BaseDirectory;
+ string relativeSearchPath = AppDomain.CurrentDomain.RelativeSearchPath;
+ string binPath = relativeSearchPath == null ? baseDir : Path.Combine(baseDir, relativeSearchPath);
+ var log4NetDllPath = Path.Combine(binPath, "log4net.dll");
+
+ if (File.Exists(log4NetDllPath))
+ {
+ nhibernateLoggerClass = typeof (Log4NetLoggerFactory).AssemblyQualifiedName;
+ }
+ }
+ else
+ {
+ nhibernateLoggerClass = ConfigurationManager.AppSettings[nhibernateLogger];
+ }
+ return nhibernateLoggerClass;
+ }
+
public static void SetLoggersFactory(ILoggerFactory loggerFactory)
{
instance = new LoggerProvider(loggerFactory);
@@ -67,6 +120,104 @@
}
}
+ public class NoLoggingLoggerFactory: ILoggerFactory
+ {
+ private static readonly ILogger Nologging = new NoLoggingLogger();
+ public ILogger LoggerFor(string keyName)
+ {
+ return Nologging;
+ }
+
+ public ILogger LoggerFor(System.Type type)
+ {
+ return Nologging;
+ }
+ }
+
+ public class NoLoggingLogger: ILogger
+ {
+ public bool IsErrorEnabled
+ {
+ get { return false;}
+ }
+
+ public bool IsFatalEnabled
+ {
+ get { return false; }
+ }
+
+ public bool IsDebugEnabled
+ {
+ get { return false; }
+ }
+
+ public bool IsInfoEnabled
+ {
+ get { return false; }
+ }
+
+ public bool IsWarnEnabled
+ {
+ get { return false; }
+ }
+
+ public void Error(object message)
+ {
+ }
+
+ public void Error(object message, Exception exception)
+ {
+ }
+
+ public void ErrorFormat(string format, params object[] args)
+ {
+ }
+
+ public void Fatal(object message)
+ {
+ }
+
+ public void Fatal(object message, Exception exception)
+ {
+ }
+
+ public void Debug(object message)
+ {
+ }
+
+ public void Debug(object message, Exception exception)
+ {
+ }
+
+ public void DebugFormat(string format, params object[] args)
+ {
+ }
+
+ public void Info(object message)
+ {
+ }
+
+ public void Info(object message, Exception exception)
+ {
+ }
+
+ public void InfoFormat(string format, params object[] args)
+ {
+ }
+
+ public void Warn(object message)
+ {
+ }
+
+ public void Warn(object message, Exception exception)
+ {
+ }
+
+ public void WarnFormat(string format, params object[] args)
+ {
+ }
+ }
+
public class Log4NetLoggerFactory: ILoggerFactory
{
private static readonly System.Type LogManagerType = System.Type.GetType("log4net.LogManager, log4net");
Modified: trunk/nhibernate/src/NHibernate.Test/Logging/LoggerProviderTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Logging/LoggerProviderTest.cs 2010-08-09 11:43:36 UTC (rev 5131)
+++ trunk/nhibernate/src/NHibernate.Test/Logging/LoggerProviderTest.cs 2010-08-09 13:03:36 UTC (rev 5132)
@@ -9,7 +9,13 @@
public void LoggerProviderCanCreateLoggers()
{
LoggerProvider.LoggerFor("pizza").Should().Not.Be.Null();
- LoggerProvider.LoggerFor(typeof(LoggerProviderTest)).Should().Not.Be.Null();
+ LoggerProvider.LoggerFor(typeof (LoggerProviderTest)).Should().Not.Be.Null();
}
+
+ [Test]
+ public void WhenNotConfiguredAndLog4NetExistsThenUseLog4NetFactory()
+ {
+ LoggerProvider.LoggerFor("pizza").Should().Be.InstanceOf<Log4NetLogger>();
+ }
}
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-08-14 16:00:05
|
Revision: 5141
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5141&view=rev
Author: fabiomaulo
Date: 2010-08-14 15:59:58 +0000 (Sat, 14 Aug 2010)
Log Message:
-----------
Refactoring
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Driver/ReflectionBasedDriver.cs
trunk/nhibernate/src/NHibernate/NHibernate.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate/Driver/IDriveConnectionCommandProvider.cs
trunk/nhibernate/src/NHibernate/Driver/ReflectionDriveConnectionCommandProvider.cs
Added: trunk/nhibernate/src/NHibernate/Driver/IDriveConnectionCommandProvider.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Driver/IDriveConnectionCommandProvider.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/Driver/IDriveConnectionCommandProvider.cs 2010-08-14 15:59:58 UTC (rev 5141)
@@ -0,0 +1,10 @@
+using System.Data;
+
+namespace NHibernate.Driver
+{
+ public interface IDriveConnectionCommandProvider
+ {
+ IDbConnection CreateConnection();
+ IDbCommand CreateCommand();
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/Driver/ReflectionBasedDriver.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Driver/ReflectionBasedDriver.cs 2010-08-11 16:08:53 UTC (rev 5140)
+++ trunk/nhibernate/src/NHibernate/Driver/ReflectionBasedDriver.cs 2010-08-14 15:59:58 UTC (rev 5141)
@@ -5,8 +5,7 @@
{
public abstract class ReflectionBasedDriver : DriverBase
{
- private readonly System.Type connectionType;
- private readonly System.Type commandType;
+ private readonly IDriveConnectionCommandProvider connectionCommandProvider;
/// <summary>
/// Initializes a new instance of <see cref="ReflectionBasedDriver" /> with
@@ -18,8 +17,8 @@
protected ReflectionBasedDriver(string driverAssemblyName, string connectionTypeName, string commandTypeName)
{
// Try to get the types from an already loaded assembly
- connectionType = ReflectHelper.TypeFromAssembly(connectionTypeName, driverAssemblyName, false);
- commandType = ReflectHelper.TypeFromAssembly(commandTypeName, driverAssemblyName, false);
+ var connectionType = ReflectHelper.TypeFromAssembly(connectionTypeName, driverAssemblyName, false);
+ var commandType = ReflectHelper.TypeFromAssembly(commandTypeName, driverAssemblyName, false);
if (connectionType == null || commandType == null)
{
@@ -31,16 +30,17 @@
+ "application configuration file to specify the full name of the assembly.",
driverAssemblyName));
}
+ connectionCommandProvider = new ReflectionDriveConnectionCommandProvider(connectionType, commandType);
}
public override IDbConnection CreateConnection()
{
- return (IDbConnection) Cfg.Environment.BytecodeProvider.ObjectsFactory.CreateInstance(connectionType);
+ return connectionCommandProvider.CreateConnection();
}
public override IDbCommand CreateCommand()
{
- return (IDbCommand) Cfg.Environment.BytecodeProvider.ObjectsFactory.CreateInstance(commandType);
+ return connectionCommandProvider.CreateCommand();
}
}
}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate/Driver/ReflectionDriveConnectionCommandProvider.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Driver/ReflectionDriveConnectionCommandProvider.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/Driver/ReflectionDriveConnectionCommandProvider.cs 2010-08-14 15:59:58 UTC (rev 5141)
@@ -0,0 +1,40 @@
+using System;
+using System.Data;
+using Environment = NHibernate.Cfg.Environment;
+
+namespace NHibernate.Driver
+{
+ public class ReflectionDriveConnectionCommandProvider : IDriveConnectionCommandProvider
+ {
+ private readonly System.Type commandType;
+ private readonly System.Type connectionType;
+
+ public ReflectionDriveConnectionCommandProvider(System.Type connectionType, System.Type commandType)
+ {
+ if (connectionType == null)
+ {
+ throw new ArgumentNullException("connectionType");
+ }
+ if (commandType == null)
+ {
+ throw new ArgumentNullException("commandType");
+ }
+ this.connectionType = connectionType;
+ this.commandType = commandType;
+ }
+
+ #region IDriveConnectionCommandProvider Members
+
+ public IDbConnection CreateConnection()
+ {
+ return (IDbConnection) Environment.BytecodeProvider.ObjectsFactory.CreateInstance(connectionType);
+ }
+
+ public IDbCommand CreateCommand()
+ {
+ return (IDbCommand) Environment.BytecodeProvider.ObjectsFactory.CreateInstance(commandType);
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2010-08-11 16:08:53 UTC (rev 5140)
+++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2010-08-14 15:59:58 UTC (rev 5141)
@@ -593,8 +593,10 @@
<Compile Include="Dialect\SybaseASA10Dialect.cs" />
<Compile Include="Dialect\SybaseASA9Dialect.cs" />
<Compile Include="Driver\CsharpSqliteDriver.cs" />
+ <Compile Include="Driver\IDriveConnectionCommandProvider.cs" />
<Compile Include="Driver\IfxDriver.cs" />
<Compile Include="Driver\OracleLiteDataClientDriver.cs" />
+ <Compile Include="Driver\ReflectionDriveConnectionCommandProvider.cs" />
<Compile Include="Engine\Query\CallableParser.cs" />
<Compile Include="Engine\Query\HQLExpressionQueryPlan.cs" />
<Compile Include="Engine\Query\HQLStringQueryPlan.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-08-14 16:53:05
|
Revision: 5142
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5142&view=rev
Author: fabiomaulo
Date: 2010-08-14 16:52:58 +0000 (Sat, 14 Aug 2010)
Log Message:
-----------
DbProviderFactoryDriveConnectionCommandProvider
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/NHibernate.csproj
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate/Driver/DbProviderFactoryDriveConnectionCommandProvider.cs
trunk/nhibernate/src/NHibernate.Test/DriverTest/DbProviderFactoryDriveConnectionCommandProviderTest.cs
Added: trunk/nhibernate/src/NHibernate/Driver/DbProviderFactoryDriveConnectionCommandProvider.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Driver/DbProviderFactoryDriveConnectionCommandProvider.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/Driver/DbProviderFactoryDriveConnectionCommandProvider.cs 2010-08-14 16:52:58 UTC (rev 5142)
@@ -0,0 +1,30 @@
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace NHibernate.Driver
+{
+ public class DbProviderFactoryDriveConnectionCommandProvider : IDriveConnectionCommandProvider
+ {
+ private readonly DbProviderFactory dbProviderFactory;
+
+ public DbProviderFactoryDriveConnectionCommandProvider(DbProviderFactory dbProviderFactory)
+ {
+ if (dbProviderFactory == null)
+ {
+ throw new ArgumentNullException("dbProviderFactory");
+ }
+ this.dbProviderFactory = dbProviderFactory;
+ }
+
+ public IDbConnection CreateConnection()
+ {
+ return dbProviderFactory.CreateConnection();
+ }
+
+ public IDbCommand CreateCommand()
+ {
+ return dbProviderFactory.CreateCommand();
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2010-08-14 15:59:58 UTC (rev 5141)
+++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2010-08-14 16:52:58 UTC (rev 5142)
@@ -593,6 +593,7 @@
<Compile Include="Dialect\SybaseASA10Dialect.cs" />
<Compile Include="Dialect\SybaseASA9Dialect.cs" />
<Compile Include="Driver\CsharpSqliteDriver.cs" />
+ <Compile Include="Driver\DbProviderFactoryDriveConnectionCommandProvider.cs" />
<Compile Include="Driver\IDriveConnectionCommandProvider.cs" />
<Compile Include="Driver\IfxDriver.cs" />
<Compile Include="Driver\OracleLiteDataClientDriver.cs" />
Added: trunk/nhibernate/src/NHibernate.Test/DriverTest/DbProviderFactoryDriveConnectionCommandProviderTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/DriverTest/DbProviderFactoryDriveConnectionCommandProviderTest.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/DriverTest/DbProviderFactoryDriveConnectionCommandProviderTest.cs 2010-08-14 16:52:58 UTC (rev 5142)
@@ -0,0 +1,39 @@
+using System;
+using System.Data.Common;
+using NHibernate.Driver;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.DriverTest
+{
+ public class DbProviderFactoryDriveConnectionCommandProviderTest
+ {
+ [Test]
+ public void WhenCreatedWithNullDbFactoryThenThrows()
+ {
+ Executing.This(() => new DbProviderFactoryDriveConnectionCommandProvider(null)).Should().Throw<ArgumentNullException>();
+ }
+
+ [Test]
+ public void WhenCreatedWithDbFactoryThenCanReturnConnection()
+ {
+ var factory = DbProviderFactories.GetFactory("System.Data.OracleClient");
+ var provider = new DbProviderFactoryDriveConnectionCommandProvider(factory);
+ using(var connection =provider.CreateConnection())
+ {
+ connection.Should().Not.Be.Null();
+ }
+ }
+
+ [Test]
+ public void WhenCreatedWithDbFactoryThenCanReturnCommand()
+ {
+ var factory = DbProviderFactories.GetFactory("System.Data.OracleClient");
+ var provider = new DbProviderFactoryDriveConnectionCommandProvider(factory);
+ using (var command = provider.CreateCommand())
+ {
+ command.Should().Not.Be.Null();
+ }
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-08-14 15:59:58 UTC (rev 5141)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-08-14 16:52:58 UTC (rev 5142)
@@ -181,6 +181,7 @@
<Compile Include="Criteria\ProjectionsTest.cs" />
<Compile Include="Criteria\Reptile.cs" />
<Compile Include="DialectTest\MsSqlCe40DialectFixture.cs" />
+ <Compile Include="DriverTest\DbProviderFactoryDriveConnectionCommandProviderTest.cs" />
<Compile Include="DriverTest\Sql2008DateTime2Test.cs" />
<Compile Include="DriverTest\SqlClientDriverFixture.cs" />
<Compile Include="DriverTest\SqlServerCeDriverFixture.cs" />
@@ -2578,7 +2579,6 @@
<EmbeddedResource Include="DynamicEntity\Tuplizer\Customer.hbm.xml" />
</ItemGroup>
<ItemGroup>
- <Folder Include="NHSpecificTest\NH2224" />
<Folder Include="Properties\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-08-14 17:37:19
|
Revision: 5144
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5144&view=rev
Author: fabiomaulo
Date: 2010-08-14 17:37:12 +0000 (Sat, 14 Aug 2010)
Log Message:
-----------
Refactoring of ReflectionBasedDriver in order to use DbProviderFactories
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Driver/ReflectionBasedDriver.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/DriverTest/ReflectionBasedDriverTest.cs
Modified: trunk/nhibernate/src/NHibernate/Driver/ReflectionBasedDriver.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Driver/ReflectionBasedDriver.cs 2010-08-14 16:58:49 UTC (rev 5143)
+++ trunk/nhibernate/src/NHibernate/Driver/ReflectionBasedDriver.cs 2010-08-14 17:37:12 UTC (rev 5144)
@@ -1,4 +1,5 @@
using System.Data;
+using System.Data.Common;
using NHibernate.Util;
namespace NHibernate.Driver
@@ -20,16 +21,38 @@
/// <param name="connectionTypeName">Connection type name.</param>
/// <param name="commandTypeName">Command type name.</param>
protected ReflectionBasedDriver(string driverAssemblyName, string connectionTypeName, string commandTypeName)
+ : this(null, driverAssemblyName, connectionTypeName, commandTypeName)
{
+ }
+
+ /// <summary>
+ /// Initializes a new instance of <see cref="ReflectionBasedDriver" /> with
+ /// type names that are loaded from the specified assembly.
+ /// </summary>
+ /// <param name="providerInvariantName">The Invariant name of a provider.</param>
+ /// <param name="driverAssemblyName">Assembly to load the types from.</param>
+ /// <param name="connectionTypeName">Connection type name.</param>
+ /// <param name="commandTypeName">Command type name.</param>
+ /// <seealso cref="DbProviderFactories.GetFactory(string)"/>
+ protected ReflectionBasedDriver(string providerInvariantName, string driverAssemblyName, string connectionTypeName, string commandTypeName)
+ {
// Try to get the types from an already loaded assembly
var connectionType = ReflectHelper.TypeFromAssembly(connectionTypeName, driverAssemblyName, false);
var commandType = ReflectHelper.TypeFromAssembly(commandTypeName, driverAssemblyName, false);
if (connectionType == null || commandType == null)
{
- throw new HibernateException(string.Format(ReflectionTypedProviderExceptionMessageTemplate, driverAssemblyName));
+ if (string.IsNullOrEmpty(providerInvariantName))
+ {
+ throw new HibernateException(string.Format(ReflectionTypedProviderExceptionMessageTemplate, driverAssemblyName));
+ }
+ var factory = DbProviderFactories.GetFactory(providerInvariantName);
+ connectionCommandProvider = new DbProviderFactoryDriveConnectionCommandProvider(factory);
}
- connectionCommandProvider = new ReflectionDriveConnectionCommandProvider(connectionType, commandType);
+ else
+ {
+ connectionCommandProvider = new ReflectionDriveConnectionCommandProvider(connectionType, commandType);
+ }
}
public override IDbConnection CreateConnection()
Added: trunk/nhibernate/src/NHibernate.Test/DriverTest/ReflectionBasedDriverTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/DriverTest/ReflectionBasedDriverTest.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/DriverTest/ReflectionBasedDriverTest.cs 2010-08-14 17:37:12 UTC (rev 5144)
@@ -0,0 +1,118 @@
+using System;
+using NHibernate.Driver;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.DriverTest
+{
+ public class ReflectionBasedDriverTest
+ {
+ private class MyDriverWithWrongClassesAndGoodDbProviderFactory : ReflectionBasedDriver
+ {
+ public MyDriverWithWrongClassesAndGoodDbProviderFactory()
+ : base("System.Data.OracleClient", "pizza1", "pizza2", "pizza3")
+ {
+ }
+ public MyDriverWithWrongClassesAndGoodDbProviderFactory(string assemblyName)
+ : base("System.Data.OracleClient", assemblyName, "pizza2", "pizza3")
+ {
+ }
+
+ public override bool UseNamedPrefixInSql
+ {
+ get { throw new NotImplementedException(); }
+ }
+
+ public override bool UseNamedPrefixInParameter
+ {
+ get { throw new NotImplementedException(); }
+ }
+
+ public override string NamedPrefix
+ {
+ get { throw new NotImplementedException(); }
+ }
+ }
+ private class MyDriverWithNoDbProviderFactory : ReflectionBasedDriver
+ {
+ public MyDriverWithNoDbProviderFactory():
+ base(null,
+ "System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
+ "System.Data.OracleClient.OracleConnection",
+ "System.Data.OracleClient.OracleCommand") { }
+
+ public override bool UseNamedPrefixInSql
+ {
+ get { throw new NotImplementedException(); }
+ }
+
+ public override bool UseNamedPrefixInParameter
+ {
+ get { throw new NotImplementedException(); }
+ }
+
+ public override string NamedPrefix
+ {
+ get { throw new NotImplementedException(); }
+ }
+ }
+
+ [Test]
+ public void WhenCreatedWithGoodDbProviderThenNotThrows()
+ {
+ Executing.This(()=> new MyDriverWithWrongClassesAndGoodDbProviderFactory()).Should().NotThrow();
+ }
+
+ [Test]
+ public void WhenCreatedWithNullAssemblyAndGoodDbProviderThenNotThrows()
+ {
+ Executing.This(() => new MyDriverWithWrongClassesAndGoodDbProviderFactory(null)).Should().NotThrow();
+ }
+
+ [Test]
+ public void WhenCreatedWithDbFactoryThenCanReturnConnection()
+ {
+ var provider = new MyDriverWithWrongClassesAndGoodDbProviderFactory();
+ using (var connection = provider.CreateConnection())
+ {
+ connection.Should().Not.Be.Null();
+ }
+ }
+
+ [Test]
+ public void WhenCreatedWithDbFactoryThenCanReturnCommand()
+ {
+ var provider = new MyDriverWithWrongClassesAndGoodDbProviderFactory();
+ using (var command = provider.CreateCommand())
+ {
+ command.Should().Not.Be.Null();
+ }
+ }
+
+ [Test]
+ public void WhenCreatedWithNoDbProviderThenNotThrows()
+ {
+ Executing.This(() => new MyDriverWithNoDbProviderFactory()).Should().NotThrow();
+ }
+
+ [Test]
+ public void WhenCreatedWithNoDbFactoryThenCanReturnConnection()
+ {
+ var provider = new MyDriverWithNoDbProviderFactory();
+ using (var connection = provider.CreateConnection())
+ {
+ connection.Should().Not.Be.Null();
+ }
+ }
+
+ [Test]
+ public void WhenCreatedNoWithDbFactoryThenCanReturnCommand()
+ {
+ var provider = new MyDriverWithNoDbProviderFactory();
+ using (var command = provider.CreateCommand())
+ {
+ command.Should().Not.Be.Null();
+ }
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-08-14 16:58:49 UTC (rev 5143)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-08-14 17:37:12 UTC (rev 5144)
@@ -182,6 +182,7 @@
<Compile Include="Criteria\Reptile.cs" />
<Compile Include="DialectTest\MsSqlCe40DialectFixture.cs" />
<Compile Include="DriverTest\DbProviderFactoryDriveConnectionCommandProviderTest.cs" />
+ <Compile Include="DriverTest\ReflectionBasedDriverTest.cs" />
<Compile Include="DriverTest\Sql2008DateTime2Test.cs" />
<Compile Include="DriverTest\SqlClientDriverFixture.cs" />
<Compile Include="DriverTest\SqlServerCeDriverFixture.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ric...@us...> - 2010-08-14 22:03:13
|
Revision: 5156
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5156&view=rev
Author: ricbrown
Date: 2010-08-14 22:03:06 +0000 (Sat, 14 Aug 2010)
Log Message:
-----------
Fix NH-2255 (MsSql2005Dialect resets parameters' positions(for paging parameters) when lock in use)
Thanks for patch supplied by Nikita Govorov.
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs
trunk/nhibernate/src/NHibernate.Test/Pagination/PaginationFixture.cs
Modified: trunk/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs 2010-08-14 21:04:51 UTC (rev 5155)
+++ trunk/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs 2010-08-14 22:03:06 UTC (rev 5156)
@@ -426,7 +426,7 @@
{
if (part == Parameter.Placeholder)
{
- result.AddParameter();
+ result.Add((Parameter)part);
continue;
}
Modified: trunk/nhibernate/src/NHibernate.Test/Pagination/PaginationFixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Pagination/PaginationFixture.cs 2010-08-14 21:04:51 UTC (rev 5155)
+++ trunk/nhibernate/src/NHibernate.Test/Pagination/PaginationFixture.cs 2010-08-14 22:03:06 UTC (rev 5156)
@@ -72,5 +72,43 @@
t.Commit();
}
}
+
+ [Test]
+ public void PagingWithLock_NH2255()
+ {
+ using (ISession s = OpenSession())
+ using (ITransaction t = s.BeginTransaction())
+ {
+ s.Save(new DataPoint() { X = 4 });
+ s.Save(new DataPoint() { X = 5 });
+ s.Save(new DataPoint() { X = 6 });
+ s.Save(new DataPoint() { X = 7 });
+ s.Save(new DataPoint() { X = 8 });
+ t.Commit();
+ }
+
+ using (ISession s = OpenSession())
+ {
+ var points =
+ s.CreateCriteria<DataPoint>()
+ .Add(Restrictions.Gt("X", 4.1d))
+ .AddOrder(Order.Asc("X"))
+ .SetLockMode(LockMode.Upgrade)
+ .SetFirstResult(1)
+ .SetMaxResults(2)
+ .List<DataPoint>();
+
+ Assert.That(points.Count, Is.EqualTo(2));
+ Assert.That(points[0].X, Is.EqualTo(6d));
+ Assert.That(points[1].X, Is.EqualTo(7d));
+ }
+
+ using (ISession s = OpenSession())
+ using (ITransaction t = s.BeginTransaction())
+ {
+ s.CreateQuery("delete from DataPoint").ExecuteUpdate();
+ t.Commit();
+ }
+ }
}
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jul...@us...> - 2010-08-15 13:31:30
|
Revision: 5157
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5157&view=rev
Author: julian-maughan
Date: 2010-08-15 13:31:20 +0000 (Sun, 15 Aug 2010)
Log Message:
-----------
Changed dialect to preserve parameter indices in Order By statement (NH-2133, NH-1424)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs
trunk/nhibernate/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs
trunk/nhibernate/src/NHibernate.Test/DialectTest/MsSql2005DialectFixture.cs
Modified: trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs 2010-08-14 22:03:06 UTC (rev 5156)
+++ trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs 2010-08-15 13:31:20 UTC (rev 5157)
@@ -159,63 +159,65 @@
columnsOrAliases = new List<SqlString>();
aliasToColumn = new Dictionary<SqlString, SqlString>();
- IList<string> tokens = new QuotedAndParenthesisStringTokenizer(select.ToString()).GetTokens();
+ IList<SqlString> tokens = new QuotedAndParenthesisStringTokenizer(select).GetTokens();
int index = 0;
while (index < tokens.Count)
{
- string token = tokens[index];
- index += 1;
+ SqlString token = tokens[index];
+
+ int nextTokenIndex = index += 1;
+
+ if (token.StartsWithCaseInsensitive("select"))
+ continue;
- if ("select".Equals(token, StringComparison.InvariantCultureIgnoreCase))
- {
+ if (token.StartsWithCaseInsensitive("distinct"))
continue;
- }
- if ("distinct".Equals(token, StringComparison.InvariantCultureIgnoreCase))
- {
+
+ if (token.StartsWithCaseInsensitive(","))
continue;
- }
- if ("," == token)
- {
- continue;
- }
- if ("from".Equals(token, StringComparison.InvariantCultureIgnoreCase))
- {
+ if (token.StartsWithCaseInsensitive("from"))
break;
- }
- //handle composite expressions like 2 * 4 as foo
- while (index < tokens.Count && "as".Equals(tokens[index], StringComparison.InvariantCultureIgnoreCase) == false
- && "," != tokens[index])
+ // handle composite expressions like "2 * 4 as foo"
+ while ((nextTokenIndex < tokens.Count) && (tokens[nextTokenIndex].StartsWithCaseInsensitive("as") == false && tokens[nextTokenIndex].StartsWithCaseInsensitive(",") == false))
{
- token = token + " " + tokens[index];
- index += 1;
+ SqlString nextToken = tokens[nextTokenIndex];
+ token = token.Append(nextToken);
+ nextTokenIndex = index += 1;
}
- string alias = token;
+ // if there is no alias, the token and the alias will be the same
+ SqlString alias = token;
- bool isFunctionCallOrQuotedString = token.Contains("'") || token.Contains("(");
+ bool isFunctionCallOrQuotedString = token.IndexOfCaseInsensitive("'") >= 0 || token.IndexOfCaseInsensitive("(") >= 0;
+
// this is heuristic guess, if the expression contains ' or (, it is probably
// not appropriate to just slice parts off of it
if (isFunctionCallOrQuotedString == false)
{
- int dot = token.IndexOf('.');
+ // its a simple column reference, so lets set the alias to the
+ // column name minus the table qualifier if it exists
+ int dot = token.IndexOfCaseInsensitive(".");
if (dot != -1)
- {
alias = token.Substring(dot + 1);
- }
}
// notice! we are checking here the existence of "as" "alias", two
// tokens from the current one
- if (index + 1 < tokens.Count && "as".Equals(tokens[index], StringComparison.InvariantCultureIgnoreCase))
+ if (nextTokenIndex + 1 < tokens.Count)
{
- alias = tokens[index + 1];
- index += 2; //skip the "as" and the alias \
+ SqlString nextToken = tokens[nextTokenIndex];
+ if (nextToken.IndexOfCaseInsensitive("as") >= 0)
+ {
+ SqlString tokenAfterNext = tokens[nextTokenIndex + 1];
+ alias = tokenAfterNext;
+ index += 2; //skip the "as" and the alias
+ }
}
- columnsOrAliases.Add(new SqlString(alias));
- aliasToColumn[SqlString.Parse(alias)] = SqlString.Parse(token);
+ columnsOrAliases.Add(alias);
+ aliasToColumn[alias] = token;
}
}
@@ -313,137 +315,144 @@
/// Notice that we aren't differenciating between [ ) and ( ] on purpose, it would complicate
/// the code and it is not legal at any rate.
/// </summary>
- public class QuotedAndParenthesisStringTokenizer : IEnumerable<String>
+ public class QuotedAndParenthesisStringTokenizer : IEnumerable<SqlString>
{
- private readonly string original;
+ private readonly SqlString original;
- public QuotedAndParenthesisStringTokenizer(string original)
+ public QuotedAndParenthesisStringTokenizer(SqlString original)
{
this.original = original;
}
- IEnumerator<string> IEnumerable<string>.GetEnumerator()
+ IEnumerator<SqlString> IEnumerable<SqlString>.GetEnumerator()
{
- StringBuilder currentToken = new StringBuilder();
TokenizerState state = TokenizerState.WhiteSpace;
int parenthesisCount = 0;
bool escapeQuote = false;
- for (int i = 0; i < original.Length; i++)
+ int tokenStart = 0;
+ int tokenLength = 0;
+ string originalString = original.ToString();
+
+ for (int i = 0; i < originalString.Length; i++)
{
- char ch = original[i];
+ char ch = originalString[i];
switch (state)
{
case TokenizerState.WhiteSpace:
if (ch == '\'')
{
state = TokenizerState.Quoted;
- currentToken.Append(ch);
+ tokenLength += 1;
}
else if (ch == ',')
{
- yield return ",";
+ yield return new SqlString(",");
+ //tokenLength += 1?
}
else if (ch == '(' || ch == '[')
{
state = TokenizerState.InParenthesis;
- currentToken.Append(ch);
+ tokenLength += 1;
parenthesisCount = 1;
}
else if (char.IsWhiteSpace(ch) == false)
{
state = TokenizerState.Token;
- currentToken.Append(ch);
+ tokenLength += 1;
}
break;
case TokenizerState.Quoted:
if (escapeQuote)
{
escapeQuote = false;
- currentToken.Append(ch);
+ tokenLength += 1;
}
// handle escaping of ' by using '' or \'
- else if (ch == '\\' || (ch == '\'' && i + 1 < original.Length && original[i + 1] == '\''))
+ else if (ch == '\\' || (ch == '\'' && i + 1 < originalString.Length && originalString[i + 1] == '\''))
{
escapeQuote = true;
- currentToken.Append(ch);
+ tokenLength += 1;
}
else if (ch == '\'')
{
- currentToken.Append(ch);
- yield return currentToken.ToString();
+ yield return original.Substring(tokenStart, tokenLength);
+ tokenStart += tokenLength + 1;
+ tokenLength = 0;
state = TokenizerState.WhiteSpace;
- currentToken.Length = 0;
}
else
{
- currentToken.Append(ch);
+ tokenLength += 1;
}
break;
case TokenizerState.InParenthesis:
if (ch == ')' || ch == ']')
{
- currentToken.Append(ch);
+ tokenLength += 1;
parenthesisCount -= 1;
if (parenthesisCount == 0)
{
- yield return currentToken.ToString();
- currentToken.Length = 0;
+ yield return original.Substring(tokenStart, tokenLength);
+ tokenStart += tokenLength + 1;
+ tokenLength = 0;
state = TokenizerState.WhiteSpace;
}
}
else if (ch == '(' || ch == '[')
{
- currentToken.Append(ch);
+ tokenLength += 1;
parenthesisCount += 1;
}
else
{
- currentToken.Append(ch);
+ tokenLength += 1;
}
break;
case TokenizerState.Token:
if (char.IsWhiteSpace(ch))
{
- yield return currentToken.ToString();
- currentToken.Length = 0;
+ yield return original.Substring(tokenStart, tokenLength);
+ tokenStart += tokenLength + 1;
+ tokenLength = 0;
state = TokenizerState.WhiteSpace;
}
else if (ch == ',') // stop current token, and send the , as well
{
- yield return currentToken.ToString();
- currentToken.Length = 0;
- yield return ",";
+ yield return original.Substring(tokenStart, tokenLength);
+ yield return new SqlString(",");
+ tokenStart += tokenLength + 2;
+ tokenLength = 0;
state = TokenizerState.WhiteSpace;
}
else if (ch == '(' || ch == '[')
{
state = TokenizerState.InParenthesis;
parenthesisCount = 1;
- currentToken.Append(ch);
+ tokenLength += 1;
}
else if (ch == '\'')
{
state = TokenizerState.Quoted;
- currentToken.Append(ch);
+ tokenLength += 1;
}
else
{
- currentToken.Append(ch);
+ tokenLength += 1;
}
break;
default:
throw new InvalidExpressionException("Could not understand the string " + original);
}
}
- if (currentToken.Length > 0)
+ if (tokenLength > 0)
{
- yield return currentToken.ToString();
+ yield return original.Substring(tokenStart, tokenLength);
}
}
public IEnumerator GetEnumerator()
{
- return ((IEnumerable<string>)this).GetEnumerator();
+ return ((IEnumerable<SqlString>)this).GetEnumerator();
}
public enum TokenizerState
@@ -454,9 +463,9 @@
Token
}
- public IList<string> GetTokens()
+ public IList<SqlString> GetTokens()
{
- return new List<string>(this);
+ return new List<SqlString>(this);
}
}
}
Modified: trunk/nhibernate/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs 2010-08-14 22:03:06 UTC (rev 5156)
+++ trunk/nhibernate/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs 2010-08-15 13:31:20 UTC (rev 5157)
@@ -1,5 +1,6 @@
using System;
using System.Collections;
+using System.Collections.Generic;
using NHibernate.Dialect;
using NHibernate.Criterion;
using NHibernate.SqlCommand;
@@ -10,8 +11,6 @@
namespace NHibernate.Test.Criteria
{
- using System.Collections.Generic;
-
[TestFixture]
public class CriteriaQueryTest : TestCase
{
@@ -127,32 +126,32 @@
}
}
- [Test]
- public void TestSubcriteriaBeingNull()
- {
- ISession session = OpenSession();
- ITransaction t = session.BeginTransaction();
+ [Test]
+ public void TestSubcriteriaBeingNull()
+ {
+ ISession session = OpenSession();
+ ITransaction t = session.BeginTransaction();
- Course hibernateCourse = new Course();
- hibernateCourse.CourseCode = "HIB";
- hibernateCourse.Description = "Hibernate Training";
- session.Save(hibernateCourse);
+ Course hibernateCourse = new Course();
+ hibernateCourse.CourseCode = "HIB";
+ hibernateCourse.Description = "Hibernate Training";
+ session.Save(hibernateCourse);
- DetachedCriteria subcriteria = DetachedCriteria.For<Enrolment>("e");
- subcriteria.Add(Expression.EqProperty("e.CourseCode", "c.CourseCode"));
- subcriteria.SetProjection(Projections.Avg("Semester"));
+ DetachedCriteria subcriteria = DetachedCriteria.For<Enrolment>("e");
+ subcriteria.Add(Expression.EqProperty("e.CourseCode", "c.CourseCode"));
+ subcriteria.SetProjection(Projections.Avg("Semester"));
- DetachedCriteria criteria = DetachedCriteria.For<Course>("c");
- criteria.SetProjection(Projections.Count("id"));
- criteria.Add(Expression.Or(Subqueries.Le(5, subcriteria), Subqueries.IsNull(subcriteria)));
+ DetachedCriteria criteria = DetachedCriteria.For<Course>("c");
+ criteria.SetProjection(Projections.Count("id"));
+ criteria.Add(Expression.Or(Subqueries.Le(5, subcriteria), Subqueries.IsNull(subcriteria)));
- object o = criteria.GetExecutableCriteria(session).UniqueResult();
- Assert.AreEqual(1, o);
+ object o = criteria.GetExecutableCriteria(session).UniqueResult();
+ Assert.AreEqual(1, o);
- session.Delete(hibernateCourse);
- t.Commit();
- session.Close();
- }
+ session.Delete(hibernateCourse);
+ t.Commit();
+ session.Close();
+ }
[Test]
public void Subselect()
@@ -571,7 +570,6 @@
//it should not be already loaded
Enrolment shouldNotBeLoaded = (Enrolment)s.Load(typeof(Enrolment), key);
Assert.IsFalse(NHibernateUtil.IsInitialized(shouldNotBeLoaded));
-
}
using (ISession s = OpenSession())
@@ -1567,7 +1565,6 @@
}
}
-
[Test]
public void DetachedCriteriaInspection()
{
@@ -1645,15 +1642,16 @@
.SetMaxResults(3)
.List();
- Assert.AreEqual(2, result.Count);
- Assert.IsInstanceOfType(typeof(Student), result[0]);
- Assert.IsInstanceOfType(typeof(Student), result[1]);
+ Assert.That(result.Count, Is.EqualTo(2));
+ Assert.That(result[0], Is.InstanceOf(typeof(Student)));
+ Assert.That(result[1], Is.InstanceOf(typeof(Student)));
session.Delete(gavin);
session.Delete(bizarroGavin);
t.Commit();
session.Close();
}
+
[Test]
public void CacheDetachedCriteria()
{
@@ -1681,8 +1679,8 @@
Assert.That(sessions.Statistics.QueryCacheHitCount, Is.EqualTo(1));
sessions.Statistics.IsStatisticsEnabled = false;
}
-
}
+
[Test]
public void PropertyWithFormulaAndPagingTest()
{
@@ -1749,7 +1747,6 @@
}
}
-
[Test]
public void TransformToRowCountTest()
{
@@ -1776,19 +1773,68 @@
{
ICriteria criteria = session.CreateCriteria(typeof(Student), "c");
- criteria
- .AddOrder(Order.Asc(
- Projections.Conditional(
- Restrictions.Eq("StudentNumber", (long)1),
- Projections.Constant(0),
- Projections.Constant(1)
- )));
+ criteria.AddOrder(
+ Order.Asc(
+ Projections.Conditional(
+ Restrictions.Eq("StudentNumber", (long)1),
+ Projections.Constant(0),
+ Projections.Constant(1))));
criteria.List();
}
}
[Test]
+ public void OrderProjectionAliasedTest()
+ {
+ ISession session = OpenSession();
+ ITransaction t = session.BeginTransaction();
+
+ Course courseA = new Course();
+ courseA.CourseCode = "HIB-A";
+ courseA.Description = "Hibernate Training A";
+ session.Save(courseA);
+
+ Student gavin = new Student();
+ gavin.Name = "Gavin King";
+ gavin.StudentNumber = 232;
+ gavin.PreferredCourse = courseA;
+ session.Save(gavin);
+
+ Student leonardo = new Student();
+ leonardo.Name = "Leonardo Quijano";
+ leonardo.StudentNumber = 233;
+ leonardo.PreferredCourse = courseA;
+ session.Save(leonardo);
+
+ Student johnDoe = new Student();
+ johnDoe.Name = "John Doe";
+ johnDoe.StudentNumber = 235;
+ johnDoe.PreferredCourse = null;
+ session.Save(johnDoe);
+
+ IProjection conditional =
+ Projections.Conditional(
+ Restrictions.Eq("Name", "Gavin King"),
+ Projections.Constant("Name"),
+ Projections.Constant("AnotherName"));
+
+ ICriteria criteria = session.CreateCriteria(typeof(Student));
+ criteria.SetMaxResults(1);
+ criteria.SetFirstResult(1);
+ IList result = criteria.SetProjection(Projections.Alias(conditional, "CheckName"))
+ .AddOrder(Order.Asc("CheckName"))
+ .List();
+
+ session.Delete(gavin);
+ session.Delete(leonardo);
+ session.Delete(johnDoe);
+ session.Delete(courseA);
+ t.Commit();
+ session.Close();
+ }
+
+ [Test]
public void LikeProjectionTest()
{
Student john = new Student { Name = "John" };
@@ -1798,7 +1844,6 @@
session.Flush();
}
-
using (ISession session = this.OpenSession())
{
ICriteria criteria = session.CreateCriteria(typeof(Student), "c");
@@ -1850,7 +1895,6 @@
}
}
-
[Test]
public void AliasJoinCriterion()
{
@@ -1956,4 +2000,4 @@
}
}
}
-}
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/DialectTest/MsSql2005DialectFixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/DialectTest/MsSql2005DialectFixture.cs 2010-08-14 22:03:06 UTC (rev 5156)
+++ trunk/nhibernate/src/NHibernate.Test/DialectTest/MsSql2005DialectFixture.cs 2010-08-15 13:31:20 UTC (rev 5157)
@@ -112,7 +112,7 @@
{
MsSql2005Dialect.QuotedAndParenthesisStringTokenizer tokenizier =
new MsSql2005Dialect.QuotedAndParenthesisStringTokenizer(
- "select concat(a.Description,', ', a.Description) from Animal a");
+ new SqlString("select concat(a.Description,', ', a.Description) from Animal a"));
string[] expected = new string[]
{
"select",
@@ -122,9 +122,9 @@
"a"
};
int current = 0;
- foreach (string token in tokenizier)
+ foreach (SqlString token in tokenizier)
{
- Assert.AreEqual(expected[current], token);
+ Assert.AreEqual(expected[current], token.ToString());
current += 1;
}
Assert.AreEqual(current, expected.Length);
@@ -135,7 +135,7 @@
{
MsSql2005Dialect.QuotedAndParenthesisStringTokenizer tokenizier =
new MsSql2005Dialect.QuotedAndParenthesisStringTokenizer(
- "SELECT fish.id, cast('astring, with,comma' as string) as bar, f FROM fish");
+ new SqlString("SELECT fish.id, cast('astring, with,comma' as string) as bar, f FROM fish"));
string[] expected = new string[]
{
"SELECT",
@@ -150,10 +150,10 @@
"fish"
};
int current = 0;
- IList<string> tokens = tokenizier.GetTokens();
- foreach (string token in tokens)
+ IList<SqlString> tokens = tokenizier.GetTokens();
+ foreach (SqlString token in tokens)
{
- Assert.AreEqual(expected[current], token);
+ Assert.AreEqual(expected[current], token.ToString());
current += 1;
}
Assert.AreEqual(current, expected.Length);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-08-15 15:25:24
|
Revision: 5158
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5158&view=rev
Author: fabiomaulo
Date: 2010-08-15 15:25:18 +0000 (Sun, 15 Aug 2010)
Log Message:
-----------
Fix NH-2287 (by Jose Romaniello)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlParser.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2287/
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2287/Domain.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2287/Fixture.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2287/Mappings.hbm.xml
Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlParser.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlParser.cs 2010-08-15 13:31:20 UTC (rev 5157)
+++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlParser.cs 2010-08-15 15:25:18 UTC (rev 5158)
@@ -323,8 +323,8 @@
if (input.LA(1) == DOT && input.LA(2) != IDENT)
{
// See if the second lookahed token can be an identifier.
- HqlToken t = (HqlToken)input.LT(2);
- if (t.PossibleId)
+ HqlToken t = input.LT(2) as HqlToken;
+ if (t != null && t.PossibleId)
{
// Set it!
input.LT(2).Type = IDENT;
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2287/Domain.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2287/Domain.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2287/Domain.cs 2010-08-15 15:25:18 UTC (rev 5158)
@@ -0,0 +1,7 @@
+namespace NHibernate.Test.NHSpecificTest.NH2287
+{
+ public class Foo
+ {
+ public string Bar { get; set; }
+ }
+}
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2287/Fixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2287/Fixture.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2287/Fixture.cs 2010-08-15 15:25:18 UTC (rev 5158)
@@ -0,0 +1,20 @@
+using System;
+using NHibernate.Hql.Ast.ANTLR;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.NHSpecificTest.NH2287
+{
+ public class Fixture: BugTestCase
+ {
+ [Test]
+ public void DotInStringLiteralsConstant()
+ {
+ using (ISession session = OpenSession())
+ {
+ var query = string.Format("from Foo f {0}where f.", Environment.NewLine);
+ session.Executing(s => s.CreateQuery(query).List()).Throws<QuerySyntaxException>();
+ }
+ }
+ }
+}
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2287/Mappings.hbm.xml
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2287/Mappings.hbm.xml (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2287/Mappings.hbm.xml 2010-08-15 15:25:18 UTC (rev 5158)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
+ assembly="NHibernate.Test"
+ namespace="NHibernate.Test.NHSpecificTest.NH2287"
+ default-lazy="false">
+
+ <class name="Foo">
+ <id type="int">
+ <generator class="native" />
+ </id>
+ <property name="Bar" />
+ </class>
+</hibernate-mapping>
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-08-15 13:31:20 UTC (rev 5157)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-08-15 15:25:18 UTC (rev 5158)
@@ -463,6 +463,8 @@
<Compile Include="NHSpecificTest\NH2245\Model.cs" />
<Compile Include="NHSpecificTest\NH2266\Domain.cs" />
<Compile Include="NHSpecificTest\NH2266\Fixture.cs" />
+ <Compile Include="NHSpecificTest\NH2287\Domain.cs" />
+ <Compile Include="NHSpecificTest\NH2287\Fixture.cs" />
<Compile Include="TypesTest\CharClass.cs" />
<Compile Include="TypesTest\CharClassFixture.cs" />
<Compile Include="TypesTest\DateTimeClass.cs" />
@@ -2250,6 +2252,7 @@
<EmbeddedResource Include="CollectionTest\NullableValueTypeElementMapFixture.hbm.xml" />
<EmbeddedResource Include="DriverTest\EntityForMs2008.hbm.xml" />
<Content Include="DynamicEntity\package.html" />
+ <EmbeddedResource Include="NHSpecificTest\NH2287\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2266\Mappings.hbm.xml" />
<EmbeddedResource Include="TypesTest\CharClass.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH1836\Mappings.hbm.xml" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jul...@us...> - 2010-08-16 14:02:07
|
Revision: 5161
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5161&view=rev
Author: julian-maughan
Date: 2010-08-16 14:02:01 +0000 (Mon, 16 Aug 2010)
Log Message:
-----------
Apply NH-2284 (by Diego Mijelshon). Removes members that were marked obsolete in previous versions.
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Event/AbstractPreDatabaseOperationEvent.cs
trunk/nhibernate/src/NHibernate/ISession.cs
trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs
trunk/nhibernate/src/NHibernate/NHibernateUtil.cs
Modified: trunk/nhibernate/src/NHibernate/Event/AbstractPreDatabaseOperationEvent.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Event/AbstractPreDatabaseOperationEvent.cs 2010-08-15 16:31:51 UTC (rev 5160)
+++ trunk/nhibernate/src/NHibernate/Event/AbstractPreDatabaseOperationEvent.cs 2010-08-16 14:02:01 UTC (rev 5161)
@@ -33,11 +33,5 @@
/// The persister for the <see cref="Entity"/>.
/// </summary>
public IEntityPersister Persister { get; private set; }
-
- [Obsolete("Use Session property instead")]
- public ISessionImplementor Source
- {
- get { return Session; }
- }
}
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/ISession.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/ISession.cs 2010-08-15 16:31:51 UTC (rev 5160)
+++ trunk/nhibernate/src/NHibernate/ISession.cs 2010-08-16 14:02:01 UTC (rev 5161)
@@ -489,146 +489,6 @@
void Delete(string entityName, object obj);
/// <summary>
- /// Execute a query
- /// </summary>
- /// <param name="query">A query expressed in Hibernate's query language</param>
- /// <returns>A distinct list of instances</returns>
- /// <remarks>See <see cref="IQuery.List()"/> for implications of <c>cache</c> usage.</remarks>
- [Obsolete("Use ISession.CreateQuery().List()")]
- IList Find(string query);
-
- /// <summary>
- /// Execute a query, binding a value to a "?" parameter in the query string.
- /// </summary>
- /// <param name="query">The query string</param>
- /// <param name="value">A value to be bound to a "?" placeholder</param>
- /// <param name="type">The Hibernate type of the value</param>
- /// <returns>A distinct list of instances</returns>
- /// <remarks>See <see cref="IQuery.List()"/> for implications of <c>cache</c> usage.</remarks>
- [Obsolete("Use ISession.CreateQuery().SetXYZ().List()")]
- IList Find(string query, object value, IType type);
-
- /// <summary>
- /// Execute a query, binding an array of values to a "?" parameters in the query string.
- /// </summary>
- /// <param name="query">The query string</param>
- /// <param name="values">An array of values to be bound to the "?" placeholders</param>
- /// <param name="types">An array of Hibernate types of the values</param>
- /// <returns>A distinct list of instances</returns>
- /// <remarks>See <see cref="IQuery.List()"/> for implications of <c>cache</c> usage.</remarks>
- [Obsolete("Use ISession.CreateQuery().SetXYZ().List()")]
- IList Find(string query, object[] values, IType[] types);
-
- /// <summary>
- /// Execute a query and return the results in an interator.
- /// </summary>
- /// <remarks>
- /// <para>
- /// If the query has multiple return values, values will be returned in an array of
- /// type <c>object[]</c>.
- /// </para>
- /// <para>
- /// Entities returned as results are initialized on demand. The first SQL query returns
- /// identifiers only. So <c>Enumerator()</c> is usually a less efficient way to retrieve
- /// object than <c>List()</c>.
- /// </para>
- /// </remarks>
- /// <param name="query">The query string</param>
- /// <returns>An enumerator</returns>
- [Obsolete("Use ISession.CreateQuery().Enumerable()")]
- IEnumerable Enumerable(string query);
-
- /// <summary>
- /// Execute a query and return the results in an interator,
- /// binding a value to a "?" parameter in the query string.
- /// </summary>
- /// <remarks>
- /// <para>
- /// If the query has multiple return values, values will be returned in an array of
- /// type <c>object[]</c>.
- /// </para>
- /// <para>
- /// Entities returned as results are initialized on demand. The first SQL query returns
- /// identifiers only. So <c>Enumerator()</c> is usually a less efficient way to retrieve
- /// object than <c>List()</c>.
- /// </para>
- /// </remarks>
- /// <param name="query">The query string</param>
- /// <param name="value">A value to be written to a "?" placeholder in the query string</param>
- /// <param name="type">The hibernate type of the value</param>
- /// <returns>An enumerator</returns>
- [Obsolete("Use ISession.CreateQuery().SetXYZ().Enumerable()")]
- IEnumerable Enumerable(string query, object value, IType type);
-
- /// <summary>
- /// Execute a query and return the results in an interator,
- /// binding the values to "?"s parameters in the query string.
- /// </summary>
- /// <remarks>
- /// <para>
- /// If the query has multiple return values, values will be returned in an array of
- /// type <c>object[]</c>.
- /// </para>
- /// <para>
- /// Entities returned as results are initialized on demand. The first SQL query returns
- /// identifiers only. So <c>Enumerator()</c> is usually a less efficient way to retrieve
- /// object than <c>List()</c>.
- /// </para>
- /// </remarks>
- /// <param name="query">The query string</param>
- /// <param name="values">A list of values to be written to "?" placeholders in the query</param>
- /// <param name="types">A list of hibernate types of the values</param>
- /// <returns>An enumerator</returns>
- [Obsolete("Use ISession.CreateQuery().SetXYZ().Enumerable()")]
- IEnumerable Enumerable(string query, object[] values, IType[] types);
-
- /// <summary>
- /// Apply a filter to a persistent collection.
- /// </summary>
- /// <remarks>
- /// A filter is a Hibernate query that may refer to <c>this</c>, the collection element.
- /// Filters allow efficient access to very large lazy collections. (Executing the filter
- /// does not initialize the collection.)
- /// </remarks>
- /// <param name="collection">A persistent collection to filter</param>
- /// <param name="filter">A filter query string</param>
- /// <returns>The resulting collection</returns>
- [Obsolete("Use ISession.CreateFilter().List()")]
- ICollection Filter(object collection, string filter);
-
- /// <summary>
- /// Apply a filter to a persistent collection, binding the given parameter to a "?" placeholder
- /// </summary>
- /// <remarks>
- /// A filter is a Hibernate query that may refer to <c>this</c>, the collection element.
- /// Filters allow efficient access to very large lazy collections. (Executing the filter
- /// does not initialize the collection.)
- /// </remarks>
- /// <param name="collection">A persistent collection to filter</param>
- /// <param name="filter">A filter query string</param>
- /// <param name="value">A value to be written to a "?" placeholder in the query</param>
- /// <param name="type">The hibernate type of value</param>
- /// <returns>A collection</returns>
- [Obsolete("Use ISession.CreateFilter().SetXYZ().List()")]
- ICollection Filter(object collection, string filter, object value, IType type);
-
- /// <summary>
- /// Apply a filter to a persistent collection, binding the given parameters to "?" placeholders.
- /// </summary>
- /// <remarks>
- /// A filter is a Hibernate query that may refer to <c>this</c>, the collection element.
- /// Filters allow efficient access to very large lazy collections. (Executing the filter
- /// does not initialize the collection.)
- /// </remarks>
- /// <param name="collection">A persistent collection to filter</param>
- /// <param name="filter">A filter query string</param>
- /// <param name="values">The values to be written to "?" placeholders in the query</param>
- /// <param name="types">The hibernate types of the values</param>
- /// <returns>A collection</returns>
- [Obsolete("Use ISession.CreateFilter().SetXYZ().List()")]
- ICollection Filter(object collection, string filter, object[] values, IType[] types);
-
- /// <summary>
/// Delete all objects returned by the query.
/// </summary>
/// <param name="query">The query string</param>
@@ -831,26 +691,6 @@
IQuery GetNamedQuery(string queryName);
/// <summary>
- /// Create a new instance of <c>IQuery</c> for the given SQL string.
- /// </summary>
- /// <param name="sql">a query expressed in SQL</param>
- /// <param name="returnAlias">a table alias that appears inside <c>{}</c> in the SQL string</param>
- /// <param name="returnClass">the returned persistent class</param>
- /// <returns>An <see cref="IQuery"/> from the SQL string</returns>
- [Obsolete("Use CreateSQLQuery().AddEntity()")]
- IQuery CreateSQLQuery(string sql, string returnAlias, System.Type returnClass);
-
- /// <summary>
- /// Create a new instance of <see cref="IQuery" /> for the given SQL string.
- /// </summary>
- /// <param name="sql">a query expressed in SQL</param>
- /// <param name="returnAliases">an array of table aliases that appear inside <c>{}</c> in the SQL string</param>
- /// <param name="returnClasses">the returned persistent classes</param>
- /// <returns>An <see cref="IQuery"/> from the SQL string</returns>
- [Obsolete("Use CreateSQLQuery().AddEntity()")]
- IQuery CreateSQLQuery(string sql, string[] returnAliases, System.Type[] returnClasses);
-
- /// <summary>
/// Create a new instance of <see cref="ISQLQuery" /> for the given SQL query string.
/// </summary>
/// <param name="queryString">a query expressed in SQL</param>
Modified: trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs 2010-08-15 16:31:51 UTC (rev 5160)
+++ trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs 2010-08-16 14:02:01 UTC (rev 5161)
@@ -559,31 +559,10 @@
private static readonly object[] NoArgs = new object[0];
private static readonly IType[] NoTypes = new IType[0];
- /// <summary>
- /// Retrieve a list of persistent objects using a Hibernate query
- /// </summary>
- /// <param name="query"></param>
- /// <returns></returns>
- public IList Find(string query)
+ IList Find(string query, object[] values, IType[] types)
{
using (new SessionIdLoggingContext(SessionId))
{
- return List(query, new QueryParameters());
- }
- }
-
- public IList Find(string query, object value, IType type)
- {
- using (new SessionIdLoggingContext(SessionId))
- {
- return List(query, new QueryParameters(type, value));
- }
- }
-
- public IList Find(string query, object[] values, IType[] types)
- {
- using (new SessionIdLoggingContext(SessionId))
- {
return List(query, new QueryParameters(types, values));
}
}
@@ -700,30 +679,6 @@
}
}
- public IEnumerable Enumerable(string query)
- {
- using (new SessionIdLoggingContext(SessionId))
- {
- return Enumerable(query, NoArgs, NoTypes);
- }
- }
-
- public IEnumerable Enumerable(string query, object value, IType type)
- {
- using (new SessionIdLoggingContext(SessionId))
- {
- return Enumerable(query, new[] { value }, new[] { type });
- }
- }
-
- public IEnumerable Enumerable(string query, object[] values, IType[] types)
- {
- using (new SessionIdLoggingContext(SessionId))
- {
- return Enumerable(query, new QueryParameters(types, values));
- }
- }
-
public override IEnumerable<T> Enumerable<T>(string query, QueryParameters queryParameters)
{
using (new SessionIdLoggingContext(SessionId))
@@ -1760,39 +1715,6 @@
#endregion
- public ICollection Filter(object collection, string filter)
- {
- using (new SessionIdLoggingContext(SessionId))
- {
- QueryParameters qp = new QueryParameters(new IType[1], new object[1]);
- return ListFilter(collection, filter, qp);
- }
- }
-
- public ICollection Filter(object collection, string filter, object value, IType type)
- {
- using (new SessionIdLoggingContext(SessionId))
- {
- QueryParameters qp = new QueryParameters(new IType[] { null, type }, new object[] { null, value });
- return ListFilter(collection, filter, qp);
- }
- }
-
- public ICollection Filter(object collection, string filter, object[] values, IType[] types)
- {
- using (new SessionIdLoggingContext(SessionId))
- {
- CheckAndUpdateSessionStatus();
-
- object[] vals = new object[values.Length + 1];
- IType[] typs = new IType[values.Length + 1];
- Array.Copy(values, 0, vals, 1, values.Length);
- Array.Copy(types, 0, typs, 1, types.Length);
- QueryParameters qp = new QueryParameters(typs, vals);
- return ListFilter(collection, filter, qp);
- }
- }
-
private void Filter(object collection, string filter, QueryParameters queryParameters, IList results)
{
using (new SessionIdLoggingContext(SessionId))
@@ -2083,26 +2005,6 @@
}
}
- public IQuery CreateSQLQuery(string sql, string returnAlias, System.Type returnClass)
- {
- using (new SessionIdLoggingContext(SessionId))
- {
- CheckAndUpdateSessionStatus();
- return new SqlQueryImpl(sql, new[] { returnAlias }, new[] { returnClass }, this,
- Factory.QueryPlanCache.GetSQLParameterMetadata(sql));
- }
- }
-
- public IQuery CreateSQLQuery(string sql, string[] returnAliases, System.Type[] returnClasses)
- {
- using (new SessionIdLoggingContext(SessionId))
- {
- CheckAndUpdateSessionStatus();
- return new SqlQueryImpl(sql, returnAliases, returnClasses, this,
- Factory.QueryPlanCache.GetSQLParameterMetadata(sql));
- }
- }
-
public override IList List(NativeSQLQuerySpecification spec, QueryParameters queryParameters)
{
using (new SessionIdLoggingContext(SessionId))
Modified: trunk/nhibernate/src/NHibernate/NHibernateUtil.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernateUtil.cs 2010-08-15 16:31:51 UTC (rev 5160)
+++ trunk/nhibernate/src/NHibernate/NHibernateUtil.cs 2010-08-16 14:02:01 UTC (rev 5161)
@@ -317,18 +317,6 @@
/// </summary>
/// <param name="persistentClass">a mapped entity class</param>
/// <returns></returns>
- [Obsolete("use NHibernate.Entity instead")]
- public static IType Association(System.Type persistentClass)
- {
- // not really a many-to-one association *necessarily*
- return new ManyToOneType(persistentClass.FullName);
- }
-
- /// <summary>
- /// A NHibernate persistent object (entity) type
- /// </summary>
- /// <param name="persistentClass">a mapped entity class</param>
- /// <returns></returns>
public static IType Entity(System.Type persistentClass)
{
// not really a many-to-one association *necessarily*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-08-24 21:37:23
|
Revision: 5166
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5166&view=rev
Author: fabiomaulo
Date: 2010-08-24 21:37:17 +0000 (Tue, 24 Aug 2010)
Log Message:
-----------
Applied NH-2293
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlParser.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2293/
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2293/Fixture.cs
Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlParser.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlParser.cs 2010-08-24 21:28:41 UTC (rev 5165)
+++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlParser.cs 2010-08-24 21:37:17 UTC (rev 5166)
@@ -134,8 +134,8 @@
// Case 2: The current token is after FROM and before '.'.
if (t != IDENT && input.LA(-1) == FROM && ((input.LA(2) == DOT) || (input.LA(2) == IDENT) || (input.LA(2) == -1)))
{
- HqlToken hqlToken = (HqlToken)input.LT(1);
- if (hqlToken.PossibleId)
+ HqlToken hqlToken = input.LT(1) as HqlToken;
+ if (hqlToken != null && hqlToken.PossibleId)
{
hqlToken.Type = IDENT;
if (log.IsDebugEnabled)
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2293/Fixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2293/Fixture.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2293/Fixture.cs 2010-08-24 21:37:17 UTC (rev 5166)
@@ -0,0 +1,27 @@
+using System.Linq;
+using NHibernate.Hql.Ast.ANTLR;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.NHSpecificTest.NH2293
+{
+ public class Fixture : BugTestCase
+ {
+ protected override System.Collections.IList Mappings
+ {
+ get
+ {
+ return Enumerable.Empty<object>().ToList();
+ }
+ }
+
+ [Test]
+ public void WhenQueryHasJustAfromThenThrowQuerySyntaxException()
+ {
+ using (ISession session = OpenSession())
+ {
+ session.Executing(s => s.CreateQuery("from").List()).Throws<QuerySyntaxException>();
+ }
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-08-24 21:28:41 UTC (rev 5165)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-08-24 21:37:17 UTC (rev 5166)
@@ -465,6 +465,7 @@
<Compile Include="NHSpecificTest\NH2266\Fixture.cs" />
<Compile Include="NHSpecificTest\NH2287\Domain.cs" />
<Compile Include="NHSpecificTest\NH2287\Fixture.cs" />
+ <Compile Include="NHSpecificTest\NH2293\Fixture.cs" />
<Compile Include="NHSpecificTest\NH2294\Fixture.cs" />
<Compile Include="TypesTest\CharClass.cs" />
<Compile Include="TypesTest\CharClassFixture.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-08-31 18:08:19
|
Revision: 5172
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5172&view=rev
Author: fabiomaulo
Date: 2010-08-31 18:08:13 +0000 (Tue, 31 Aug 2010)
Log Message:
-----------
Fix NH-2303
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Cfg/ClassExtractor.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2303/
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2303/Fixture.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2303/Mappings.hbm.xml
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2303/Model.cs
Modified: trunk/nhibernate/src/NHibernate/Cfg/ClassExtractor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/ClassExtractor.cs 2010-08-31 16:30:50 UTC (rev 5171)
+++ trunk/nhibernate/src/NHibernate/Cfg/ClassExtractor.cs 2010-08-31 18:08:13 UTC (rev 5172)
@@ -1,5 +1,4 @@
using System.Xml;
-using System.Linq;
using NHibernate.Util;
using System.Collections.Generic;
using NHibernate.Cfg.MappingSchema;
@@ -95,12 +94,77 @@
string assembly = document.assembly;
string @namespace = document.@namespace;
- classEntries.UnionWith(document.RootClasses.Select(c=> new ClassEntry(null, c.Name, c.EntityName, assembly, @namespace)));
- classEntries.UnionWith(document.SubClasses.Select(c => new ClassEntry(c.extends, c.Name, c.EntityName, assembly, @namespace)));
- classEntries.UnionWith(document.JoinedSubclasses.Select(c => new ClassEntry(c.extends, c.Name, c.EntityName, assembly, @namespace)));
- classEntries.UnionWith(document.UnionSubclasses.Select(c => new ClassEntry(c.extends, c.Name, c.EntityName, assembly, @namespace)));
+ classEntries.UnionWith(GetRootClassesEntries(assembly, @namespace, document.RootClasses));
+ classEntries.UnionWith(GetSubclassesEntries(assembly, @namespace, null, document.SubClasses));
+ classEntries.UnionWith(GetJoinedSubclassesEntries(assembly, @namespace, null, document.JoinedSubclasses));
+ classEntries.UnionWith(GetUnionSubclassesEntries(assembly, @namespace, null, document.UnionSubclasses));
return classEntries;
}
+
+ private static IEnumerable<ClassEntry> GetRootClassesEntries(string assembly, string @namespace,IEnumerable<HbmClass> rootClasses)
+ {
+ foreach (var rootClass in rootClasses)
+ {
+ string entityName = rootClass.EntityName;
+ yield return new ClassEntry(null, rootClass.Name, entityName, assembly, @namespace);
+ foreach (var classEntry in GetSubclassesEntries(assembly, @namespace, entityName, rootClass.Subclasses))
+ {
+ yield return classEntry;
+ }
+ foreach (var classEntry in GetJoinedSubclassesEntries(assembly, @namespace, entityName, rootClass.JoinedSubclasses))
+ {
+ yield return classEntry;
+ }
+ foreach (var classEntry in GetUnionSubclassesEntries(assembly, @namespace, entityName, rootClass.UnionSubclasses))
+ {
+ yield return classEntry;
+ }
+ }
+ }
+
+ private static IEnumerable<ClassEntry> GetSubclassesEntries(string assembly, string @namespace, string defaultExtends,
+ IEnumerable<HbmSubclass> hbmSubclasses)
+ {
+ foreach (HbmSubclass subclass in hbmSubclasses)
+ {
+ string extends = subclass.extends ?? defaultExtends;
+ yield return new ClassEntry(extends, subclass.Name, subclass.EntityName, assembly, @namespace);
+ foreach (ClassEntry classEntry in GetSubclassesEntries(assembly, @namespace, subclass.EntityName,subclass.Subclasses))
+ {
+ yield return classEntry;
+ }
+ }
+ }
+
+ private static IEnumerable<ClassEntry> GetJoinedSubclassesEntries(string assembly, string @namespace,
+ string defaultExtends,
+ IEnumerable<HbmJoinedSubclass> hbmJoinedSubclasses)
+ {
+ foreach (HbmJoinedSubclass subclass in hbmJoinedSubclasses)
+ {
+ string extends = subclass.extends ?? defaultExtends;
+ yield return new ClassEntry(extends, subclass.Name, subclass.EntityName, assembly, @namespace);
+ foreach (ClassEntry classEntry in GetJoinedSubclassesEntries(assembly, @namespace, subclass.EntityName, subclass.JoinedSubclasses))
+ {
+ yield return classEntry;
+ }
+ }
+ }
+
+ private static IEnumerable<ClassEntry> GetUnionSubclassesEntries(string assembly, string @namespace,
+ string defaultExtends,
+ IEnumerable<HbmUnionSubclass> hbmUnionSubclasses)
+ {
+ foreach (HbmUnionSubclass subclass in hbmUnionSubclasses)
+ {
+ string extends = subclass.extends ?? defaultExtends;
+ yield return new ClassEntry(extends, subclass.Name, subclass.EntityName, assembly, @namespace);
+ foreach (ClassEntry classEntry in GetUnionSubclassesEntries(assembly, @namespace, subclass.EntityName,subclass.UnionSubclasses))
+ {
+ yield return classEntry;
+ }
+ }
+ }
}
}
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2303/Fixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2303/Fixture.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2303/Fixture.cs 2010-08-31 18:08:13 UTC (rev 5172)
@@ -0,0 +1,19 @@
+using NHibernate.Cfg;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.NHSpecificTest.NH2303
+{
+ public class Fixture
+ {
+ [Test]
+ public void IndependentSubclassElementCanExtendSubclass()
+ {
+ Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration();
+ cfg.Executing(c => c.AddResource("NHibernate.Test.NHSpecificTest.NH2303.Mappings.hbm.xml", GetType().Assembly)).
+ NotThrows();
+ cfg.BuildSessionFactory();
+ cfg.Executing(c => c.BuildSessionFactory()).NotThrows();
+ }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2303/Mappings.hbm.xml
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2303/Mappings.hbm.xml (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2303/Mappings.hbm.xml 2010-08-31 18:08:13 UTC (rev 5172)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
+ assembly="NHibernate.Test"
+ namespace="NHibernate.Test.NHSpecificTest.NH2303">
+
+ <class name="Actor" table="actors">
+ <id name="Id" column="person_id">
+ <generator class="increment" />
+ </id>
+ <discriminator column="actor-type" />
+
+ <subclass name="Person" discriminator-value="P" />
+
+ <subclass name="Role" discriminator-value="R">
+ <many-to-one name="Performer" class="Person" column="performer" />
+ </subclass>
+ </class>
+
+ <subclass name="Developer" extends="Role" discriminator-value="R-DEV" />
+</hibernate-mapping>
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2303/Model.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2303/Model.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2303/Model.cs 2010-08-31 18:08:13 UTC (rev 5172)
@@ -0,0 +1,20 @@
+namespace NHibernate.Test.NHSpecificTest.NH2303
+{
+ public abstract class Actor
+ {
+ public virtual int Id { get; set; }
+ }
+
+ public class Person : Actor
+ {
+ }
+
+ public abstract class Role : Actor
+ {
+ public virtual Person Performer { get; set; }
+ }
+
+ public class Developer : Role
+ {
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-08-31 16:30:50 UTC (rev 5171)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-08-31 18:08:13 UTC (rev 5172)
@@ -467,6 +467,8 @@
<Compile Include="NHSpecificTest\NH2287\Fixture.cs" />
<Compile Include="NHSpecificTest\NH2293\Fixture.cs" />
<Compile Include="NHSpecificTest\NH2294\Fixture.cs" />
+ <Compile Include="NHSpecificTest\NH2303\Fixture.cs" />
+ <Compile Include="NHSpecificTest\NH2303\Model.cs" />
<Compile Include="TypesTest\CharClass.cs" />
<Compile Include="TypesTest\CharClassFixture.cs" />
<Compile Include="TypesTest\DateTimeClass.cs" />
@@ -2254,6 +2256,7 @@
<EmbeddedResource Include="CollectionTest\NullableValueTypeElementMapFixture.hbm.xml" />
<EmbeddedResource Include="DriverTest\EntityForMs2008.hbm.xml" />
<Content Include="DynamicEntity\package.html" />
+ <EmbeddedResource Include="NHSpecificTest\NH2303\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2287\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2266\Mappings.hbm.xml" />
<EmbeddedResource Include="TypesTest\CharClass.hbm.xml" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jul...@us...> - 2010-09-01 17:08:18
|
Revision: 5173
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5173&view=rev
Author: julian-maughan
Date: 2010-09-01 17:08:11 +0000 (Wed, 01 Sep 2010)
Log Message:
-----------
Fixes incorrect tracking of identifiers when performing add/insert/remove operations on PersistentIdentifierBag collection. Thanks go to Patrick Earl for this one (ref. NH2279, NH2111)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Collection/Generic/PersistentGenericIdentifierBag.cs
trunk/nhibernate/src/NHibernate/Collection/PersistentIdentifierBag.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2279/
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2279/B.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2279/C.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2279/Fixture.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2279/Mappings.hbm.xml
Modified: trunk/nhibernate/src/NHibernate/Collection/Generic/PersistentGenericIdentifierBag.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Collection/Generic/PersistentGenericIdentifierBag.cs 2010-08-31 18:08:13 UTC (rev 5172)
+++ trunk/nhibernate/src/NHibernate/Collection/Generic/PersistentGenericIdentifierBag.cs 2010-09-01 17:08:11 UTC (rev 5173)
@@ -78,7 +78,7 @@
void IList<T>.Insert(int index, T item)
{
Write();
- BeforeAdd(index);
+ BeforeInsert(index);
gvalues.Insert(index, item);
}
Modified: trunk/nhibernate/src/NHibernate/Collection/PersistentIdentifierBag.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Collection/PersistentIdentifierBag.cs 2010-08-31 18:08:13 UTC (rev 5172)
+++ trunk/nhibernate/src/NHibernate/Collection/PersistentIdentifierBag.cs 2010-09-01 17:08:11 UTC (rev 5173)
@@ -77,7 +77,7 @@
private object GetIdentifier(int index)
{
// NH specific : To emulate IDictionary behavior but using Dictionary<int, object> (without boxing/unboxing for index)
- object result;
+ object result = null;
identifiers.TryGetValue(index, out result);
return result;
}
@@ -217,16 +217,14 @@
return old != null && elemType.IsDirty(old, entry, Session);
}
- public override object ReadFrom(IDataReader reader, ICollectionPersister persister, ICollectionAliases descriptor,
- object owner)
+ public override object ReadFrom(IDataReader reader, ICollectionPersister persister, ICollectionAliases descriptor, object owner)
{
object element = persister.ReadElement(reader, owner, descriptor.SuffixedElementAliases, Session);
- object tempObject = GetIdentifier(values.Count);
- identifiers[values.Count] = persister.ReadIdentifier(reader, descriptor.SuffixedIdentifierAlias, Session);
- object old = tempObject;
- if (old == null)
+ object id = persister.ReadIdentifier(reader, descriptor.SuffixedIdentifierAlias, Session);
+ if (!identifiers.ContainsValue(id))
{
- values.Add(element); //maintain correct duplication if loaded in a cartesian product
+ identifiers[values.Count] = id;
+ values.Add(element);
}
return element;
}
@@ -290,11 +288,6 @@
protected void BeforeRemove(int index)
{
- if (!identifiers.ContainsKey(index))
- return; // index not previously persisted, nothing to do
-
- // Move the identifier being removed to the end of the list (i.e. it isn't actually removed).
- object removedId = identifiers[index];
int last = values.Count - 1;
for (int i = index; i < last; i++)
{
@@ -308,14 +301,22 @@
identifiers[i] = id;
}
}
- identifiers[last] = removedId;
+ identifiers.Remove(last);
}
- protected void BeforeAdd(int index)
+ protected void BeforeInsert(int index)
{
- for (int i = index; i < values.Count; i++)
+ for (int i = values.Count - 1; i >= index; i--)
{
- identifiers[i + 1] = identifiers[i];
+ object id = GetIdentifier(i);
+ if (id == null)
+ {
+ identifiers.Remove(i + 1);
+ }
+ else
+ {
+ identifiers[i + 1] = id;
+ }
}
identifiers.Remove(index);
}
@@ -354,6 +355,7 @@
set
{
Write();
+ identifiers.Remove(index);
values[index] = value;
}
}
@@ -361,7 +363,7 @@
public void Insert(int index, object value)
{
Write();
- BeforeAdd(index);
+ BeforeInsert(index);
values.Insert(index, value);
}
@@ -425,7 +427,7 @@
public object SyncRoot
{
- get { return values.SyncRoot; }
+ get { return this; }
}
#endregion
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2279/B.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2279/B.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2279/B.cs 2010-09-01 17:08:11 UTC (rev 5173)
@@ -0,0 +1,40 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+namespace NHibernate.Test.NHSpecificTest.NH2279
+{
+ public class B
+ {
+ private int? _id;
+ private string _name;
+ private IList<C> _cs = new List<C>();
+
+ public B()
+ {
+ }
+
+ public B(string name)
+ {
+ Name = name;
+ }
+
+ public int? Id
+ {
+ get { return _id; }
+ set { _id = value; }
+ }
+
+ public string Name
+ {
+ get { return _name; }
+ set { _name = value; }
+ }
+
+ public IList<C> Cs
+ {
+ get { return _cs; }
+ set { _cs = value; }
+ }
+ }
+}
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2279/C.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2279/C.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2279/C.cs 2010-09-01 17:08:11 UTC (rev 5173)
@@ -0,0 +1,32 @@
+using System;
+using System.Collections;
+
+namespace NHibernate.Test.NHSpecificTest.NH2279
+{
+ public class C
+ {
+ private int? _id;
+ private string _name;
+
+ public C()
+ {
+ }
+
+ public C(string name)
+ {
+ Name = name;
+ }
+
+ public int? Id
+ {
+ get { return _id; }
+ set { _id = value; }
+ }
+
+ public string Name
+ {
+ get { return _name; }
+ set { _name = value; }
+ }
+ }
+}
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2279/Fixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2279/Fixture.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2279/Fixture.cs 2010-09-01 17:08:11 UTC (rev 5173)
@@ -0,0 +1,159 @@
+using System.Collections.Generic;
+using System.Linq;
+using System.Collections;
+
+using NUnit.Framework;
+
+namespace NHibernate.Test.NHSpecificTest.NH2279
+{
+ [TestFixture]
+ public class Fixture : BugTestCase
+ {
+ protected override void OnTearDown()
+ {
+ using( ISession s = sessions.OpenSession() )
+ {
+ s.Delete( "from A" );
+ s.Flush();
+ }
+ }
+
+ [Test]
+ public void IdBagIndexTracking()
+ {
+ A a = new A("a");
+ a.Name = "first generic type";
+ a.Items.Add("a");
+ a.Items.Add("b");
+ a.Items.Add("c");
+
+ ISession s = OpenSession();
+ s.SaveOrUpdate(a);
+ s.Flush();
+ s.Close();
+
+ s = OpenSession();
+ a = (A)s.Load(typeof(A), a.Id);
+ CollectionAssert.AreEquivalent(new[] {"a", "b", "c"}, a.Items);
+
+ // Add and remove a "transient" item.
+ a.Items.Add("d");
+ a.Items.Remove("d");
+
+ // Remove persisted items and then insert a transient item.
+ a.Items.Remove("b");
+ a.Items.Remove("a");
+ a.Items.Insert(0, "e");
+
+ // Add a couple transient items and insert another transient item between them.
+ a.Items.Add("f");
+ a.Items.Add("g");
+ a.Items.Insert(3, "h");
+
+ // Save and then see if we get what we expect.
+ s.SaveOrUpdate(a);
+ s.Flush();
+ s.Close();
+
+ s = OpenSession();
+ a = (A)s.Load(typeof(A), a.Id);
+ CollectionAssert.AreEquivalent(new [] {"c", "e", "f", "g", "h"}, a.Items);
+
+ // Test changing a value by index directly.
+ a.Items[2] = "i";
+
+ string[] expected = a.Items.Cast<string>().ToArray();
+
+ s.SaveOrUpdate(a);
+ s.Flush();
+ s.Close();
+
+ s = OpenSession();
+ a = (A)s.Load(typeof(A), a.Id);
+ CollectionAssert.AreEquivalent(expected, a.Items);
+
+ s.Flush();
+ s.Close();
+ }
+
+ [Test]
+ public void CartesianProduct()
+ {
+ A a1 = new A("a1");
+ A a2 = new A("a2");
+ B b1 = new B("b1");
+ B b2 = new B("b2");
+ B b3 = new B("b3");
+ B b4 = new B("b4");
+ C c1 = new C("c1");
+ C c2 = new C("c2");
+ C c3 = new C("c3");
+ C c4 = new C("c4");
+ C c5 = new C("c5");
+ C c6 = new C("c6");
+
+ a1.Bs.Add(b1);
+ a2.Bs.Add(b2);
+ a2.Bs.Add(b2);
+
+ a1.Bs.Add(b3);
+ a2.Bs.Add(b3);
+
+ a1.Bs.Add(b4);
+ a2.Bs.Add(b4);
+ a1.Bs.Add(b4);
+ a2.Bs.Add(b4);
+
+ b1.Cs.Add(c1);
+ b2.Cs.Add(c2);
+ b2.Cs.Add(c2);
+ b3.Cs.Add(c3);
+ b3.Cs.Add(c3);
+ b3.Cs.Add(c3);
+ b4.Cs.Add(c4);
+ b4.Cs.Add(c4);
+ b4.Cs.Add(c4);
+ b4.Cs.Add(c4);
+
+ b1.Cs.Add(c5);
+ b2.Cs.Add(c5);
+ b3.Cs.Add(c5);
+ b4.Cs.Add(c5);
+
+ b1.Cs.Add(c6);
+ b2.Cs.Add(c6);
+ b3.Cs.Add(c6);
+ b4.Cs.Add(c6);
+ b1.Cs.Add(c6);
+ b2.Cs.Add(c6);
+ b3.Cs.Add(c6);
+ b4.Cs.Add(c6);
+
+ ISession s = OpenSession();
+ s.Save(a1);
+ s.Save(a2);
+ s.Flush();
+ s.Close();
+
+ s = OpenSession();
+ IList<A> results = s.CreateQuery("from A a join fetch a.Bs b join fetch b.Cs").List<A>().Distinct().ToList();
+
+ Assert.That(results, Has.Count.EqualTo(2));
+ A ta1 = results.Single(a => a.Name == "a1");
+ A ta2 = results.Single(a => a.Name == "a2");
+
+ Assert.That(ta1.Bs.Select(b => b.Name).ToArray(), Is.EquivalentTo(new[] { "b1", "b3", "b4", "b4" }));
+ Assert.That(ta2.Bs.Select(b => b.Name).ToArray(), Is.EquivalentTo(new[] { "b2", "b2", "b3", "b4", "b4" }));
+ B tb1 = ta1.Bs.First(b => b.Name == "b1");
+ B tb2 = ta2.Bs.First(b => b.Name == "b2");
+ B tb3 = ta1.Bs.First(b => b.Name == "b3");
+ B tb4 = ta1.Bs.First(b => b.Name == "b4");
+
+ Assert.That(tb1.Cs.Select(c => c.Name).ToArray(), Is.EquivalentTo(new[] { "c1", "c5", "c6", "c6" }));
+ Assert.That(tb2.Cs.Select(c => c.Name).ToArray(), Is.EquivalentTo(new[] { "c2", "c2", "c5", "c6", "c6" }));
+ Assert.That(tb3.Cs.Select(c => c.Name).ToArray(), Is.EquivalentTo(new[] { "c3", "c3", "c3", "c5", "c6", "c6" }));
+ Assert.That(tb4.Cs.Select(c => c.Name).ToArray(), Is.EquivalentTo(new[] { "c4", "c4", "c4", "c4", "c5", "c6", "c6" }));
+ s.Close();
+ }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2279/Mappings.hbm.xml
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2279/Mappings.hbm.xml (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2279/Mappings.hbm.xml 2010-09-01 17:08:11 UTC (rev 5173)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-mapping
+ xmlns="urn:nhibernate-mapping-2.2"
+ assembly="NHibernate.Test"
+ namespace="NHibernate.Test.NHSpecificTest.NH2279">
+
+ <class name="A" table="a" lazy="false">
+ <id name="Id" column="id" unsaved-value="null">
+ <generator class="native" />
+ </id>
+ <property name="Name" column="name" />
+ <idbag name="Items" cascade="all-delete-orphan">
+ <collection-id type="Int32" column="item_id">
+ <generator class="increment" />
+ </collection-id>
+ <key column="a_id" />
+ <element type="string" />
+ </idbag>
+ <idbag name="Bs" cascade="all-delete-orphan">
+ <collection-id type="Int32" column="item_id">
+ <generator class="increment" />
+ </collection-id>
+ <key column="a_id" />
+ <many-to-many class="B" column="b_id" />
+ </idbag>
+ </class>
+
+ <class name="B" table="b" lazy="false">
+ <id name="Id" column="id" unsaved-value="null">
+ <generator class="native" />
+ </id>
+ <property name="Name" column="name" />
+ <idbag name="Cs" cascade="all-delete-orphan">
+ <collection-id type="Int32" column="item_id">
+ <generator class="increment" />
+ </collection-id>
+ <key column="b_id" />
+ <many-to-many class="C" column="c_id" />
+ </idbag>
+ </class>
+
+ <class name="C" table="c" lazy="false">
+ <id name="Id" column="id" unsaved-value="null">
+ <generator class="native" />
+ </id>
+ <property name="Name" column="name" />
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-08-31 18:08:13 UTC (rev 5172)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-09-01 17:08:11 UTC (rev 5173)
@@ -463,6 +463,10 @@
<Compile Include="NHSpecificTest\NH2245\Model.cs" />
<Compile Include="NHSpecificTest\NH2266\Domain.cs" />
<Compile Include="NHSpecificTest\NH2266\Fixture.cs" />
+ <Compile Include="NHSpecificTest\NH2279\A.cs" />
+ <Compile Include="NHSpecificTest\NH2279\B.cs" />
+ <Compile Include="NHSpecificTest\NH2279\C.cs" />
+ <Compile Include="NHSpecificTest\NH2279\Fixture.cs" />
<Compile Include="NHSpecificTest\NH2287\Domain.cs" />
<Compile Include="NHSpecificTest\NH2287\Fixture.cs" />
<Compile Include="NHSpecificTest\NH2293\Fixture.cs" />
@@ -1745,6 +1749,7 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<EmbeddedResource Include="NHSpecificTest\NH2224\Mappings.hbm.xml" />
+ <EmbeddedResource Include="NHSpecificTest\NH2279\Mappings.hbm.xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NHibernate.ByteCode.Castle\NHibernate.ByteCode.Castle.csproj">
@@ -2588,6 +2593,7 @@
<EmbeddedResource Include="DynamicEntity\Tuplizer\Customer.hbm.xml" />
</ItemGroup>
<ItemGroup>
+ <Folder Include="NHSpecificTest\NH2279" />
<Folder Include="Properties\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ric...@us...> - 2010-09-04 23:33:08
|
Revision: 5180
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5180&view=rev
Author: ricbrown
Date: 2010-09-04 23:33:02 +0000 (Sat, 04 Sep 2010)
Log Message:
-----------
Fix NH-2258 (Paging params in subquery breaks query execution)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Criterion/SubqueryExpression.cs
trunk/nhibernate/src/NHibernate/Loader/Loader.cs
trunk/nhibernate/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs
Modified: trunk/nhibernate/src/NHibernate/Criterion/SubqueryExpression.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Criterion/SubqueryExpression.cs 2010-09-03 05:07:46 UTC (rev 5179)
+++ trunk/nhibernate/src/NHibernate/Criterion/SubqueryExpression.cs 2010-09-04 23:33:02 UTC (rev 5180)
@@ -68,8 +68,9 @@
if (criteriaImpl.FirstResult != 0 || criteriaImpl.MaxResults != RowSelection.NoValue)
{
+ int maxResults = (criteriaImpl.MaxResults != RowSelection.NoValue) ? criteriaImpl.MaxResults : int.MaxValue;
int? offsetParameterIndex = criteriaQuery.CreatePagingParameter(criteriaImpl.FirstResult);
- int? limitParameterIndex = criteriaQuery.CreatePagingParameter(criteriaImpl.MaxResults);
+ int? limitParameterIndex = criteriaQuery.CreatePagingParameter(maxResults);
sql = factory.Dialect.GetLimitString(sql, criteriaImpl.FirstResult, criteriaImpl.MaxResults, offsetParameterIndex, limitParameterIndex);
}
Modified: trunk/nhibernate/src/NHibernate/Loader/Loader.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Loader/Loader.cs 2010-09-03 05:07:46 UTC (rev 5179)
+++ trunk/nhibernate/src/NHibernate/Loader/Loader.cs 2010-09-04 23:33:02 UTC (rev 5180)
@@ -1058,6 +1058,11 @@
return selection != null && selection.MaxRows != RowSelection.NoValue;
}
+ private static bool HasOffset(RowSelection selection)
+ {
+ return selection != null && selection.MaxRows != RowSelection.NoValue;
+ }
+
internal static int GetFirstRow(RowSelection selection)
{
if (selection == null || !selection.DefinesLimits)
@@ -1079,7 +1084,7 @@
/// <returns></returns>
internal static bool UseLimit(RowSelection selection, Dialect.Dialect dialect)
{
- return dialect.SupportsLimit && HasMaxRows(selection);
+ return dialect.SupportsLimit && (HasMaxRows(selection) || HasOffset(selection));
}
/// <summary>
@@ -1202,6 +1207,9 @@
int firstRow = GetFirstRow(selection);
int lastRow = selection.MaxRows;
+ if (lastRow == RowSelection.NoValue)
+ return int.MaxValue;
+
if (dialect.UseMaxForLimit)
{
return lastRow + firstRow;
@@ -1230,10 +1238,7 @@
{
return 0;
}
- if (!HasMaxRows(selection))
- {
- throw new AssertionFailure("max results not set");
- }
+
int firstRow = GetFirstRow(selection);
int lastRow = GetMaxOrLimit(dialect, selection);
Modified: trunk/nhibernate/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs 2010-09-03 05:07:46 UTC (rev 5179)
+++ trunk/nhibernate/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs 2010-09-04 23:33:02 UTC (rev 5180)
@@ -312,6 +312,90 @@
}
[Test]
+ public void SubqueryPaginationOnlyWithFirst()
+ {
+ using (ISession session = OpenSession())
+ using (ITransaction t = session.BeginTransaction())
+ {
+ session.Save(new Student { Name = "Mengano", StudentNumber = 232 });
+ session.Save(new Student { Name = "Ayende", StudentNumber = 999 });
+ session.Save(new Student { Name = "Fabio", StudentNumber = 123 });
+ session.Save(new Student { Name = "Merlo", StudentNumber = 456 });
+ session.Save(new Student { Name = "Fulano", StudentNumber = 0 });
+
+ t.Commit();
+ }
+
+ using (ISession session = OpenSession())
+ using (ITransaction t = session.BeginTransaction())
+ {
+ DetachedCriteria dc = DetachedCriteria.For(typeof(Student))
+ .Add(Property.ForName("StudentNumber").Gt(0L))
+ .SetFirstResult(1)
+ .AddOrder(Order.Asc("StudentNumber"))
+ .SetProjection(Property.ForName("Name"));
+
+ var result = session.CreateCriteria(typeof(Student))
+ .Add(Subqueries.PropertyIn("Name", dc))
+ .List<Student>();
+
+ Assert.That(result.Count, Is.EqualTo(3));
+ t.Commit();
+ }
+
+ using (ISession session = OpenSession())
+ using (ITransaction t = session.BeginTransaction())
+ {
+ session.CreateQuery("delete from Student").ExecuteUpdate();
+ t.Commit();
+ }
+ }
+
+ [Test]
+ public void SubqueryPagination()
+ {
+ using (ISession session = OpenSession())
+ using (ITransaction t = session.BeginTransaction())
+ {
+ session.Save(new Student { Name = "Mengano", StudentNumber = 232 });
+ session.Save(new Student { Name = "Ayende", StudentNumber = 999 });
+ session.Save(new Student { Name = "Fabio", StudentNumber = 123 });
+ session.Save(new Student { Name = "Merlo", StudentNumber = 456 });
+ session.Save(new Student { Name = "Fulano", StudentNumber = 0 });
+
+ t.Commit();
+ }
+
+ using (ISession session = OpenSession())
+ using (ITransaction t = session.BeginTransaction())
+ {
+ DetachedCriteria dc = DetachedCriteria.For(typeof (Student))
+ .Add(Property.ForName("StudentNumber").Gt(200L))
+ .SetMaxResults(2)
+ .SetFirstResult(1)
+ .AddOrder(Order.Asc("StudentNumber"))
+ .SetProjection(Property.ForName("Name"));
+
+ var result = session.CreateCriteria(typeof(Student))
+ .Add(Subqueries.PropertyIn("Name", dc))
+ .List<Student>();
+
+ Assert.That(result.Count, Is.EqualTo(2));
+ Assert.That(result[0].StudentNumber, Is.EqualTo(456));
+ Assert.That(result[1].StudentNumber, Is.EqualTo(999));
+
+ t.Commit();
+ }
+
+ using (ISession session = OpenSession())
+ using (ITransaction t = session.BeginTransaction())
+ {
+ session.CreateQuery("delete from Student").ExecuteUpdate();
+ t.Commit();
+ }
+ }
+
+ [Test]
public void SimplePagination()
{
using (ISession session = OpenSession())
@@ -350,6 +434,46 @@
}
[Test]
+ public void SimplePaginationOnlyWithFirst()
+ {
+ using (ISession session = OpenSession())
+ using (ITransaction t = session.BeginTransaction())
+ {
+ session.Save(new Student {Name = "Mengano", StudentNumber = 232});
+ session.Save(new Student {Name = "Ayende", StudentNumber = 999});
+ session.Save(new Student {Name = "Fabio", StudentNumber = 123});
+ session.Save(new Student {Name = "Merlo", StudentNumber = 456});
+ session.Save(new Student {Name = "Fulano", StudentNumber = 0});
+
+ t.Commit();
+ }
+
+ using (ISession session = OpenSession())
+ using (ITransaction t = session.BeginTransaction())
+ {
+ var result = session.CreateCriteria<Student>()
+ .Add(Restrictions.Gt("StudentNumber", 0L))
+ .AddOrder(Order.Asc("StudentNumber"))
+ .SetFirstResult(1)
+ .List<Student>();
+
+ Assert.That(result.Count, Is.EqualTo(3));
+ Assert.That(result[0].StudentNumber, Is.EqualTo(232));
+ Assert.That(result[1].StudentNumber, Is.EqualTo(456));
+ Assert.That(result[2].StudentNumber, Is.EqualTo(999));
+
+ t.Commit();
+ }
+
+ using (ISession session = OpenSession())
+ using (ITransaction t = session.BeginTransaction())
+ {
+ session.CreateQuery("delete from Student").ExecuteUpdate();
+ t.Commit();
+ }
+ }
+
+ [Test]
public void CloningDetachedCriteriaTest()
{
DetachedCriteria dc = DetachedCriteria.For(typeof(Student))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ric...@us...> - 2010-09-11 13:09:31
|
Revision: 5181
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5181&view=rev
Author: ricbrown
Date: 2010-09-11 13:09:24 +0000 (Sat, 11 Sep 2010)
Log Message:
-----------
QueryOver - added .Where(o => o is Person) syntax
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Impl/ExpressionProcessor.cs
trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/QueryOverFixture.cs
Modified: trunk/nhibernate/src/NHibernate/Impl/ExpressionProcessor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Impl/ExpressionProcessor.cs 2010-09-04 23:33:02 UTC (rev 5180)
+++ trunk/nhibernate/src/NHibernate/Impl/ExpressionProcessor.cs 2010-09-11 13:09:24 UTC (rev 5181)
@@ -175,12 +175,7 @@
MethodCallExpression methodCallExpression = (MethodCallExpression)expression;
if (methodCallExpression.Method.Name == "GetType")
- {
- if (methodCallExpression.Object.NodeType == ExpressionType.MemberAccess)
- return FindMemberExpression(methodCallExpression.Object) + ".class";
- else
- return "class";
- }
+ return ClassMember(methodCallExpression.Object);
if (methodCallExpression.Method.Name == "get_Item")
return FindMemberExpression(methodCallExpression.Object);
@@ -427,9 +422,23 @@
return ProcessCustomMethodCall(methodCallExpression);
}
- throw new Exception("Could not determine member type from " + expression.ToString());
+ if (expression is TypeBinaryExpression)
+ {
+ TypeBinaryExpression typeBinaryExpression = (TypeBinaryExpression)expression;
+ return Restrictions.Eq(ClassMember(typeBinaryExpression.Expression), typeBinaryExpression.TypeOperand);
+ }
+
+ throw new Exception("Could not determine member type from " + expression.NodeType + ", " + expression.ToString() + ", " + expression.GetType());
}
+ private static string ClassMember(Expression expression)
+ {
+ if (expression.NodeType == ExpressionType.MemberAccess)
+ return FindMemberExpression(expression) + ".class";
+ else
+ return "class";
+ }
+
private static string Signature(MethodInfo methodInfo)
{
return methodInfo.DeclaringType.FullName
Modified: trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/QueryOverFixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/QueryOverFixture.cs 2010-09-04 23:33:02 UTC (rev 5180)
+++ trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/QueryOverFixture.cs 2010-09-11 13:09:24 UTC (rev 5181)
@@ -27,6 +27,7 @@
.Add(Restrictions.Ge("Age", 11))
.Add(Restrictions.Lt("Age", 50))
.Add(Restrictions.Le("Age", 49))
+ .Add(Restrictions.Eq("class", typeof(Person)))
.Add(Restrictions.Eq("class", typeof(Person)));
IQueryOver<Person> actual =
@@ -37,7 +38,8 @@
.And(p => p.Age >= 11)
.And(p => p.Age < 50)
.And(p => p.Age <= 49)
- .And(p => p.GetType() == typeof(Person));
+ .And(p => p.GetType() == typeof(Person))
+ .And(p => p is Person);
AssertCriteriaAreEqual(expected, actual);
}
@@ -184,6 +186,7 @@
.Add(Restrictions.Ge("personAlias.Age", 11))
.Add(Restrictions.Lt("personAlias.Age", 50))
.Add(Restrictions.Le("personAlias.Age", 49))
+ .Add(Restrictions.Eq("personAlias.class", typeof(Person)))
.Add(Restrictions.Eq("personAlias.class", typeof(Person)));
Person personAlias = null;
@@ -195,7 +198,8 @@
.And(() => personAlias.Age >= 11)
.And(() => personAlias.Age < 50)
.And(() => personAlias.Age <= 49)
- .And(() => personAlias.GetType() == typeof(Person));
+ .And(() => personAlias.GetType() == typeof(Person))
+ .And(() => personAlias is Person);
AssertCriteriaAreEqual(expected, actual);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jul...@us...> - 2010-09-13 16:31:53
|
Revision: 5183
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5183&view=rev
Author: julian-maughan
Date: 2010-09-13 16:31:46 +0000 (Mon, 13 Sep 2010)
Log Message:
-----------
Fixed bug where an IPostUpdateEventListener.OnPostUpdate event causes an enumeration error in ActionQueue.ExecuteActions. In the event, an ExecuteUpdate criteria statement causes a flush to occur during a flush already initiated by transaction commit. This results in an earlier-than-expected call to ActionQueue.ClearFromFlushNeededCheck, resetting its list of updates before it has finished iterating them (ref. NH-2322). Thanks Filip Zawada for the solution.
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Engine/ActionQueue.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2322/
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2322/Fixture.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2322/Mappings.hbm.xml
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2322/Model.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2322/PostUpdateEventListener.cs
Modified: trunk/nhibernate/src/NHibernate/Engine/ActionQueue.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Engine/ActionQueue.cs 2010-09-12 00:40:28 UTC (rev 5182)
+++ trunk/nhibernate/src/NHibernate/Engine/ActionQueue.cs 2010-09-13 16:31:46 UTC (rev 5183)
@@ -109,8 +109,9 @@
private void ExecuteActions(IList list)
{
- foreach (IExecutable executable in list)
- Execute(executable);
+ int size = list.Count;
+ for (int i = 0; i < size; i++)
+ Execute((IExecutable)list[i]);
list.Clear();
session.Batcher.ExecuteBatch();
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2322/Fixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2322/Fixture.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2322/Fixture.cs 2010-09-13 16:31:46 UTC (rev 5183)
@@ -0,0 +1,51 @@
+using NHibernate.Cfg;
+using NUnit.Framework;
+using NHibernate.Event;
+using System.Diagnostics;
+
+namespace NHibernate.Test.NHSpecificTest.NH2322
+{
+ [TestFixture]
+ public class Fixture : BugTestCase
+ {
+ protected override void Configure(Configuration configuration)
+ {
+ configuration.SetProperty(Environment.FormatSql, "false");
+ configuration.SetListener(ListenerType.PostUpdate, new PostUpdateEventListener());
+ }
+
+ protected override void OnTearDown()
+ {
+ using (ISession s = OpenSession())
+ {
+ s.Delete("from Person");
+ s.Flush();
+ }
+ base.OnTearDown();
+ }
+
+ [Test]
+ public void ShouldNotThrowWhenCommitingATransaction()
+ {
+ int id;
+
+ using (ISession s = OpenSession())
+ using (ITransaction t = s.BeginTransaction())
+ {
+ var p = new Person { Name = "inserted name" };
+ s.Save(p);
+ id = p.Id;
+ t.Commit();
+ }
+
+ using (ISession s = OpenSession())
+ using (ITransaction t = s.BeginTransaction())
+ {
+ var p = s.Get<Person>(id);
+ p.Name = "changing the name...";
+
+ Assert.That(delegate() { t.Commit(); }, Throws.Nothing);
+ }
+ }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2322/Mappings.hbm.xml
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2322/Mappings.hbm.xml (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2322/Mappings.hbm.xml 2010-09-13 16:31:46 UTC (rev 5183)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-mapping
+ xmlns="urn:nhibernate-mapping-2.2"
+ assembly="NHibernate.Test"
+ namespace="NHibernate.Test.NHSpecificTest.NH2322">
+
+ <class name="Person">
+ <id name="Id">
+ <generator class="native" />
+ </id>
+ <property name="Name"/>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2322/Model.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2322/Model.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2322/Model.cs 2010-09-13 16:31:46 UTC (rev 5183)
@@ -0,0 +1,8 @@
+namespace NHibernate.Test.NHSpecificTest.NH2322
+{
+ public class Person
+ {
+ public virtual int Id { get; set; }
+ public virtual string Name { get; set; }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2322/PostUpdateEventListener.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2322/PostUpdateEventListener.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2322/PostUpdateEventListener.cs 2010-09-13 16:31:46 UTC (rev 5183)
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NHibernate.Event;
+
+namespace NHibernate.Test.NHSpecificTest.NH2322
+{
+ public class PostUpdateEventListener : IPostUpdateEventListener
+ {
+ void IPostUpdateEventListener.OnPostUpdate(PostUpdateEvent @event)
+ {
+ if (@event.Entity is Person)
+ {
+ @event.Session
+ .CreateSQLQuery("update Person set Name = :newName")
+ .SetString("newName", "new updated name")
+ .ExecuteUpdate();
+ }
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-09-12 00:40:28 UTC (rev 5182)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-09-13 16:31:46 UTC (rev 5183)
@@ -477,6 +477,9 @@
<Compile Include="NHSpecificTest\NH2302\StringLengthEntity.cs" />
<Compile Include="NHSpecificTest\NH2303\Fixture.cs" />
<Compile Include="NHSpecificTest\NH2303\Model.cs" />
+ <Compile Include="NHSpecificTest\NH2322\Fixture.cs" />
+ <Compile Include="NHSpecificTest\NH2322\Model.cs" />
+ <Compile Include="NHSpecificTest\NH2322\PostUpdateEventListener.cs" />
<Compile Include="TypesTest\CharClass.cs" />
<Compile Include="TypesTest\CharClassFixture.cs" />
<Compile Include="TypesTest\DateTimeClass.cs" />
@@ -1755,6 +1758,7 @@
<EmbeddedResource Include="NHSpecificTest\NH2224\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2279\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2111\Mappings.hbm.xml" />
+ <EmbeddedResource Include="NHSpecificTest\NH2322\Mappings.hbm.xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NHibernate.ByteCode.Castle\NHibernate.ByteCode.Castle.csproj">
@@ -2601,6 +2605,7 @@
<ItemGroup>
<Folder Include="NHSpecificTest\NH2111" />
<Folder Include="NHSpecificTest\NH2279" />
+ <Folder Include="NHSpecificTest\NH2322" />
<Folder Include="Properties\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jul...@us...> - 2010-09-14 13:37:59
|
Revision: 5184
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5184&view=rev
Author: julian-maughan
Date: 2010-09-14 13:37:52 +0000 (Tue, 14 Sep 2010)
Log Message:
-----------
Fixed bug whereby PersistentGenericIdentifierBag instantiates a List<T> type when a user-configured collection type is expected (ref. NH-2278). Also, added back a comment that was inadvertently removed from PersistenIdentifierBag.ReadFrom. Credit to Patrick Earl.
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Collection/Generic/PersistentGenericIdentifierBag.cs
trunk/nhibernate/src/NHibernate/Collection/PersistentIdentifierBag.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/CustomA.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/CustomIdentifierBagType.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/CustomList.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/CustomPersistentIdentifierBag.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/Fixture.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/ICustomList.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/Mappings.hbm.xml
Modified: trunk/nhibernate/src/NHibernate/Collection/Generic/PersistentGenericIdentifierBag.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Collection/Generic/PersistentGenericIdentifierBag.cs 2010-09-13 16:31:46 UTC (rev 5183)
+++ trunk/nhibernate/src/NHibernate/Collection/Generic/PersistentGenericIdentifierBag.cs 2010-09-14 13:37:52 UTC (rev 5184)
@@ -37,7 +37,9 @@
* from the better performance the use of generic implementation have.
*/
private IList<T> gvalues;
+
public PersistentIdentifierBag() {}
+
public PersistentIdentifierBag(ISessionImplementor session) : base(session) {}
public PersistentIdentifierBag(ISessionImplementor session, ICollection<T> coll) : base(session, coll as ICollection)
@@ -64,7 +66,7 @@
public override void BeforeInitialize(ICollectionPersister persister, int anticipatedSize)
{
identifiers = anticipatedSize <= 0 ? new Dictionary<int, object>() : new Dictionary<int, object>(anticipatedSize + 1);
- InternalValues = anticipatedSize <= 0 ? new List<T>() : new List<T>(anticipatedSize);
+ InternalValues = (IList<T>)persister.CollectionType.Instantiate(anticipatedSize);
}
#region IList<T> Members
Modified: trunk/nhibernate/src/NHibernate/Collection/PersistentIdentifierBag.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Collection/PersistentIdentifierBag.cs 2010-09-13 16:31:46 UTC (rev 5183)
+++ trunk/nhibernate/src/NHibernate/Collection/PersistentIdentifierBag.cs 2010-09-14 13:37:52 UTC (rev 5184)
@@ -221,6 +221,8 @@
{
object element = persister.ReadElement(reader, owner, descriptor.SuffixedElementAliases, Session);
object id = persister.ReadIdentifier(reader, descriptor.SuffixedIdentifierAlias, Session);
+
+ // eliminate duplication if loaded in a cartesian product
if (!identifiers.ContainsValue(id))
{
identifiers[values.Count] = id;
Property changes on: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278
___________________________________________________________________
Added: bugtraq:url
+ http://jira.nhibernate.org/browse/%BUGID%
Added: bugtraq:logregex
+ NH-\d+
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/CustomA.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/CustomA.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/CustomA.cs 2010-09-14 13:37:52 UTC (rev 5184)
@@ -0,0 +1,32 @@
+using System;
+using System.Collections;
+
+namespace NHibernate.Test.NHSpecificTest.NH2278
+{
+ public class CustomA
+ {
+ private int? _id;
+ private string _name;
+ private ICustomList<string> _items;
+
+ public CustomA() { }
+
+ public int? Id
+ {
+ get { return _id; }
+ set { _id = value; }
+ }
+
+ public string Name
+ {
+ get { return _name; }
+ set { _name = value; }
+ }
+
+ public ICustomList<string> Items
+ {
+ get { return _items; }
+ set { _items = value; }
+ }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/CustomIdentifierBagType.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/CustomIdentifierBagType.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/CustomIdentifierBagType.cs 2010-09-14 13:37:52 UTC (rev 5184)
@@ -0,0 +1,59 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using NHibernate.Collection;
+using NHibernate.Engine;
+using NHibernate.Persister.Collection;
+using NHibernate.UserTypes;
+
+namespace NHibernate.Test.NHSpecificTest.NH2278
+{
+ public class CustomIdentifierBagType<T> : IUserCollectionType
+ {
+ #region IUserCollectionType Members
+
+ public bool Contains(object collection, object entity)
+ {
+ return ((IList<T>)collection).Contains((T)entity);
+ }
+
+ public IEnumerable GetElements(object collection)
+ {
+ return (IEnumerable)collection;
+ }
+
+ public object IndexOf(object collection, object entity)
+ {
+ return ((IList<T>)collection).IndexOf((T)entity);
+ }
+
+ public object ReplaceElements(object original, object target, ICollectionPersister persister, object owner, IDictionary copyCache, ISessionImplementor session)
+ {
+ IList<T> result = (IList<T>)target;
+ result.Clear();
+ foreach (object item in ((IEnumerable)original))
+ result.Add((T)item);
+ return result;
+ }
+
+ // return an instance of the inner collection type
+ public object Instantiate(int anticipatedSize)
+ {
+ return new CustomList<T>();
+ }
+
+ public IPersistentCollection Instantiate(ISessionImplementor session, ICollectionPersister persister)
+ {
+ return new CustomPersistentIdentifierBag<T>(session);
+ }
+
+ public IPersistentCollection Wrap(ISessionImplementor session, object collection)
+ {
+ return new CustomPersistentIdentifierBag<T>(session, (ICollection<T>)collection);
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/CustomList.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/CustomList.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/CustomList.cs 2010-09-14 13:37:52 UTC (rev 5184)
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace NHibernate.Test.NHSpecificTest.NH2278
+{
+ public class CustomList<T> : List<T>, ICustomList<T>
+ {
+ }
+}
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/CustomPersistentIdentifierBag.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/CustomPersistentIdentifierBag.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/CustomPersistentIdentifierBag.cs 2010-09-14 13:37:52 UTC (rev 5184)
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using NHibernate.Collection;
+using NHibernate.Collection.Generic;
+using NHibernate.Engine;
+using NUnit.Framework;
+
+namespace NHibernate.Test.NHSpecificTest.NH2278
+{
+ public class CustomPersistentIdentifierBag<T> : PersistentIdentifierBag<T>, ICustomList<T>
+ {
+ public CustomPersistentIdentifierBag(ISessionImplementor session)
+ : base(session) { }
+
+ public CustomPersistentIdentifierBag(ISessionImplementor session, ICollection<T> coll)
+ : base(session, coll) { }
+
+ public override bool AfterInitialize(NHibernate.Persister.Collection.ICollectionPersister persister)
+ {
+ Assert.That(InternalValues, Is.InstanceOf<CustomList<string>>());
+ return base.AfterInitialize(persister);
+ }
+ }
+}
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/Fixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/Fixture.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/Fixture.cs 2010-09-14 13:37:52 UTC (rev 5184)
@@ -0,0 +1,55 @@
+using System;
+using System.Collections;
+
+using NUnit.Framework;
+using System.Collections.Generic;
+
+namespace NHibernate.Test.NHSpecificTest.NH2278
+{
+ [TestFixture]
+ public class Fixture : BugTestCase
+ {
+ protected override void OnTearDown()
+ {
+ using( ISession s = sessions.OpenSession() )
+ {
+ s.Delete( "from CustomA" );
+ s.Flush();
+ }
+ }
+
+ [Test]
+ public void CustomIdBag()
+ {
+ CustomA a = new CustomA();
+ a.Name = "first generic type";
+ a.Items = new CustomList<string>();
+ a.Items.Add( "first string" );
+ a.Items.Add( "second string" );
+
+ ISession s = OpenSession();
+ s.SaveOrUpdate(a);
+ s.Flush();
+ s.Close();
+
+ Assert.That(a.Id, Is.Not.Null);
+ Assert.That(a.Items[0], Is.StringMatching("first string"));
+
+ s = OpenSession();
+ a = s.Load<CustomA>(a.Id);
+
+ Assert.That(a.Items, Is.InstanceOf<CustomPersistentIdentifierBag<string>>());
+
+ Assert.That(a.Items[0], Is.StringMatching("first string"), "first item should be 'first string'");
+ Assert.That(a.Items[1], Is.StringMatching("second string"), "second item should be 'second string'");
+
+ // ensuring the correct generic type was constructed
+ a.Items.Add("third string");
+ Assert.That(a.Items.Count, Is.EqualTo(3), "3 items in the list now");
+
+ a.Items[1] = "new second string";
+ s.Flush();
+ s.Close();
+ }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/ICustomList.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/ICustomList.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/ICustomList.cs 2010-09-14 13:37:52 UTC (rev 5184)
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace NHibernate.Test.NHSpecificTest.NH2278
+{
+ public interface ICustomList<T> : IList<T>
+ {
+ }
+}
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/Mappings.hbm.xml
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/Mappings.hbm.xml (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2278/Mappings.hbm.xml 2010-09-14 13:37:52 UTC (rev 5184)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-mapping
+ xmlns="urn:nhibernate-mapping-2.2"
+ assembly="NHibernate.Test"
+ namespace="NHibernate.Test.NHSpecificTest.NH2278">
+
+ <class name="CustomA" table="customa" lazy="false">
+
+ <id name="Id" column="id" unsaved-value="null">
+ <generator class="native" />
+ </id>
+
+ <property name="Name" column="aname" />
+
+ <idbag
+ name="Items"
+ cascade="all-delete-orphan"
+ collection-type="NHibernate.Test.NHSpecificTest.NH2278.CustomIdentifierBagType`1[[System.String, mscorlib]], NHibernate.Test">
+ <collection-id type="Int32" column="item_id">
+ <generator class="increment" />
+ </collection-id>
+ <key column="a_id" />
+ <element type="string" />
+ </idbag>
+
+ </class>
+
+</hibernate-mapping>
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-09-13 16:31:46 UTC (rev 5183)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-09-14 13:37:52 UTC (rev 5184)
@@ -465,6 +465,12 @@
<Compile Include="NHSpecificTest\NH2245\Model.cs" />
<Compile Include="NHSpecificTest\NH2266\Domain.cs" />
<Compile Include="NHSpecificTest\NH2266\Fixture.cs" />
+ <Compile Include="NHSpecificTest\NH2278\CustomA.cs" />
+ <Compile Include="NHSpecificTest\NH2278\CustomIdentifierBagType.cs" />
+ <Compile Include="NHSpecificTest\NH2278\CustomList.cs" />
+ <Compile Include="NHSpecificTest\NH2278\CustomPersistentIdentifierBag.cs" />
+ <Compile Include="NHSpecificTest\NH2278\Fixture.cs" />
+ <Compile Include="NHSpecificTest\NH2278\ICustomList.cs" />
<Compile Include="NHSpecificTest\NH2279\A.cs" />
<Compile Include="NHSpecificTest\NH2279\B.cs" />
<Compile Include="NHSpecificTest\NH2279\C.cs" />
@@ -1759,6 +1765,7 @@
<EmbeddedResource Include="NHSpecificTest\NH2279\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2111\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2322\Mappings.hbm.xml" />
+ <EmbeddedResource Include="NHSpecificTest\NH2278\Mappings.hbm.xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NHibernate.ByteCode.Castle\NHibernate.ByteCode.Castle.csproj">
@@ -2604,6 +2611,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="NHSpecificTest\NH2111" />
+ <Folder Include="NHSpecificTest\NH2278" />
<Folder Include="NHSpecificTest\NH2279" />
<Folder Include="NHSpecificTest\NH2322" />
<Folder Include="Properties\" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jul...@us...> - 2010-09-14 15:31:37
|
Revision: 5185
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5185&view=rev
Author: julian-maughan
Date: 2010-09-14 15:31:30 +0000 (Tue, 14 Sep 2010)
Log Message:
-----------
Tidied a XML comment blocks that were badly formed and/or causing compiler warnings.
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Cfg/Loquacious/ITypeDefConfiguration.cs
trunk/nhibernate/src/NHibernate/Dialect/DB2Dialect.cs
trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs
trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs
trunk/nhibernate/src/NHibernate/Dialect/MySQLDialect.cs
trunk/nhibernate/src/NHibernate/Dialect/PostgreSQLDialect.cs
trunk/nhibernate/src/NHibernate/Hql/IQueryTranslatorFactory.cs
trunk/nhibernate/src/NHibernate/ICriteria.cs
trunk/nhibernate/src/NHibernate/ISession.cs
Modified: trunk/nhibernate/src/NHibernate/Cfg/Loquacious/ITypeDefConfiguration.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/Loquacious/ITypeDefConfiguration.cs 2010-09-14 13:37:52 UTC (rev 5184)
+++ trunk/nhibernate/src/NHibernate/Cfg/Loquacious/ITypeDefConfiguration.cs 2010-09-14 15:31:30 UTC (rev 5185)
@@ -3,7 +3,7 @@
/// <summary>
/// Properties of TypeDef configuration.
/// </summary>
- /// <seealso cref="ConfigurationExtensions.TypeDefinition{TDef}<>"/>
+ /// <seealso cref="ConfigurationExtensions.TypeDefinition{TDef}"/>
public interface ITypeDefConfigurationProperties
{
/// <summary>
@@ -19,7 +19,7 @@
/// <example>
/// As <paramref name="value"/> an anonimous object can be used:
/// <code>
- /// configure.TypeDefinition<TableHiLoGenerator>(c=>
+ /// configure.TypeDefinition<TableHiLoGenerator>(c=>
/// {
/// c.Alias = "HighLow";
/// c.Properties = new {max_lo = 99};
Modified: trunk/nhibernate/src/NHibernate/Dialect/DB2Dialect.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Dialect/DB2Dialect.cs 2010-09-14 13:37:52 UTC (rev 5184)
+++ trunk/nhibernate/src/NHibernate/Dialect/DB2Dialect.cs 2010-09-14 15:31:30 UTC (rev 5185)
@@ -205,13 +205,15 @@
get { return true; }
}
-
/// <summary>
/// Add a <c>LIMIT</c> clause to the given SQL <c>SELECT</c>
/// </summary>
/// <param name="querySqlString">A Query in the form of a SqlString.</param>
- /// <param name="hasOffset">Offset of the first row is not zero</param>
- /// <returns>A new SqlString that contains the <c>LIMIT</c> clause.</returns>
+ /// <param name="offset">Offset of the first row to be returned by the query (zero-based)</param>
+ /// <param name="limit">Maximum number of rows to be returned by the query</param>
+ /// <param name="offsetParameterIndex">Optionally, the Offset parameter index</param>
+ /// <param name="limitParameterIndex">Optionally, the Limit parameter index</param>
+ /// <returns>A new <see cref="SqlString"/> that contains the <c>LIMIT</c> clause.</returns>
public override SqlString GetLimitString(SqlString querySqlString, int offset, int limit, int? offsetParameterIndex, int? limitParameterIndex)
{
/*
Modified: trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs 2010-09-14 13:37:52 UTC (rev 5184)
+++ trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs 2010-09-14 15:31:30 UTC (rev 5185)
@@ -1409,12 +1409,14 @@
/// <summary>
/// Add a <c>LIMIT</c> clause to the given SQL <c>SELECT</c>
- /// when the dialect supports variable limits (i.e., parameters for the limit constraints)
+ /// when the dialect supports variable limits (i.e. parameters for the limit constraints)
/// </summary>
- /// <param name="querySqlString">A Query in the form of a SqlString.</param>
+ /// <param name="querySqlString">The <see cref="SqlString"/> to base the limit query off.</param>
/// <param name="offset">Offset of the first row to be returned by the query (zero-based)</param>
/// <param name="limit">Maximum number of rows to be returned by the query</param>
- /// <returns>A new SqlString that contains the <c>LIMIT</c> clause.</returns>
+ /// <param name="offsetParameterIndex">Optionally, the Offset parameter index</param>
+ /// <param name="limitParameterIndex">Optionally, the Limit parameter index</param>
+ /// <returns>A new <see cref="SqlString"/> that contains the <c>LIMIT</c> clause.</returns>
public virtual SqlString GetLimitString(SqlString querySqlString, int offset, int limit, int? offsetParameterIndex, int? limitParameterIndex)
{
if (!SupportsVariableLimit)
Modified: trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs 2010-09-14 13:37:52 UTC (rev 5184)
+++ trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs 2010-09-14 15:31:30 UTC (rev 5185)
@@ -21,7 +21,7 @@
/// <summary>
/// Add a <c>LIMIT</c> clause to the given SQL <c>SELECT</c>
/// </summary>
- /// <param name="querySqlString">The <see cref="SqlString"/> to base the limit query off of.</param>
+ /// <param name="querySqlString">The <see cref="SqlString"/> to base the limit query off.</param>
/// <param name="offset">Offset of the first row to be returned by the query (zero-based)</param>
/// <param name="limit">Maximum number of rows to be returned by the query</param>
/// <param name="offsetParameterIndex">Optionally, the Offset parameter index</param>
Modified: trunk/nhibernate/src/NHibernate/Dialect/MySQLDialect.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Dialect/MySQLDialect.cs 2010-09-14 13:37:52 UTC (rev 5184)
+++ trunk/nhibernate/src/NHibernate/Dialect/MySQLDialect.cs 2010-09-14 15:31:30 UTC (rev 5185)
@@ -181,11 +181,14 @@
}
/// <summary>
- ///
+ /// Add a <c>LIMIT</c> clause to the given SQL <c>SELECT</c>
/// </summary>
- /// <param name="querySqlString"></param>
- /// <param name="hasOffset"></param>
- /// <returns></returns>
+ /// <param name="querySqlString">The <see cref="SqlString"/> to base the limit query off.</param>
+ /// <param name="offset">Offset of the first row to be returned by the query (zero-based)</param>
+ /// <param name="limit">Maximum number of rows to be returned by the query</param>
+ /// <param name="offsetParameterIndex">Optionally, the Offset parameter index</param>
+ /// <param name="limitParameterIndex">Optionally, the Limit parameter index</param>
+ /// <returns>A new <see cref="SqlString"/> that contains the <c>LIMIT</c> clause.</returns>
public override SqlString GetLimitString(SqlString querySqlString, int offset, int limit, int? offsetParameterIndex, int? limitParameterIndex)
{
var pagingBuilder = new SqlStringBuilder();
Modified: trunk/nhibernate/src/NHibernate/Dialect/PostgreSQLDialect.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Dialect/PostgreSQLDialect.cs 2010-09-14 13:37:52 UTC (rev 5184)
+++ trunk/nhibernate/src/NHibernate/Dialect/PostgreSQLDialect.cs 2010-09-14 15:31:30 UTC (rev 5185)
@@ -128,11 +128,14 @@
}
/// <summary>
- ///
+ /// Add a <c>LIMIT</c> clause to the given SQL <c>SELECT</c>
/// </summary>
- /// <param name="querySqlString"></param>
- /// <param name="hasOffset">Offset of the first row to process in the result set is non-zero</param>
- /// <returns></returns>
+ /// <param name="querySqlString">The <see cref="SqlString"/> to base the limit query off.</param>
+ /// <param name="offset">Offset of the first row to be returned by the query (zero-based)</param>
+ /// <param name="limit">Maximum number of rows to be returned by the query</param>
+ /// <param name="offsetParameterIndex">Optionally, the Offset parameter index</param>
+ /// <param name="limitParameterIndex">Optionally, the Limit parameter index</param>
+ /// <returns>A new <see cref="SqlString"/> that contains the <c>LIMIT</c> clause.</returns>
public override SqlString GetLimitString(SqlString querySqlString, int offset, int limit, int? offsetParameterIndex, int? limitParameterIndex)
{
SqlStringBuilder pagingBuilder = new SqlStringBuilder();
Modified: trunk/nhibernate/src/NHibernate/Hql/IQueryTranslatorFactory.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Hql/IQueryTranslatorFactory.cs 2010-09-14 13:37:52 UTC (rev 5184)
+++ trunk/nhibernate/src/NHibernate/Hql/IQueryTranslatorFactory.cs 2010-09-14 15:31:30 UTC (rev 5185)
@@ -16,31 +16,35 @@
/// capable of translating an HQL query string.
/// </summary>
/// <param name="queryString">The query string to be translated</param>
+ /// <param name="collectionRole"></param>
+ /// <param name="shallow"></param>
/// <param name="filters">Currently enabled filters</param>
/// <param name="factory">The session factory</param>
/// <returns>An appropriate translator.</returns>
- IQueryTranslator[] CreateQueryTranslators(string queryString, string collectionRole, bool shallow, IDictionary<string, IFilter> filters, ISessionFactoryImplementor factory);
+ IQueryTranslator[] CreateQueryTranslators(string queryString, string collectionRole, bool shallow, IDictionary<string, IFilter> filters, ISessionFactoryImplementor factory);
}
- /// <summary>
- /// Facade for generation of <see cref="NHibernate.Hql.IQueryTranslator"/>
- /// and <see cref="NHibernate.Hql.IFilterTranslator"/> instances.
- /// </summary>
- public interface IQueryTranslatorFactory2 : IQueryTranslatorFactory
- {
- /// <summary>
- /// Construct a <see cref="NHibernate.Hql.IQueryTranslator"/> instance
- /// capable of translating a Linq expression.
- /// </summary>
- /// <param name="queryIdentifier">
- /// The query-identifier (used in <see cref="NHibernate.Stat.QueryStatistics"/> collection).
- /// This is typically the same as the queryString parameter except for the case of
- /// split polymorphic queries which result in multiple physical sql queries.
- /// </param>
- /// <param name="queryExpression">The query expression to be translated</param>
- /// <param name="filters">Currently enabled filters</param>
- /// <param name="factory">The session factory</param>
- /// <returns>An appropriate translator.</returns>
- IQueryTranslator[] CreateQueryTranslators(string queryIdentifier, IQueryExpression queryExpression, string collectionRole, bool shallow, IDictionary<string, IFilter> filters, ISessionFactoryImplementor factory);
- }
+ /// <summary>
+ /// Facade for generation of <see cref="NHibernate.Hql.IQueryTranslator"/>
+ /// and <see cref="NHibernate.Hql.IFilterTranslator"/> instances.
+ /// </summary>
+ public interface IQueryTranslatorFactory2 : IQueryTranslatorFactory
+ {
+ /// <summary>
+ /// Construct a <see cref="NHibernate.Hql.IQueryTranslator"/> instance
+ /// capable of translating a Linq expression.
+ /// </summary>
+ /// <param name="queryIdentifier">
+ /// The query-identifier (used in <see cref="NHibernate.Stat.QueryStatistics"/> collection).
+ /// This is typically the same as the queryString parameter except for the case of
+ /// split polymorphic queries which result in multiple physical sql queries.
+ /// </param>
+ /// <param name="queryExpression">The query expression to be translated</param>
+ /// <param name="collectionRole"></param>
+ /// <param name="shallow"></param>
+ /// <param name="filters">Currently enabled filters</param>
+ /// <param name="factory">The session factory</param>
+ /// <returns>An appropriate translator.</returns>
+ IQueryTranslator[] CreateQueryTranslators(string queryIdentifier, IQueryExpression queryExpression, string collectionRole, bool shallow, IDictionary<string, IFilter> filters, ISessionFactoryImplementor factory);
+ }
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/ICriteria.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/ICriteria.cs 2010-09-14 13:37:52 UTC (rev 5184)
+++ trunk/nhibernate/src/NHibernate/ICriteria.cs 2010-09-14 15:31:30 UTC (rev 5185)
@@ -136,7 +136,7 @@
/// <param name="associationPath"></param>
/// <param name="alias"></param>
/// <param name="joinType">The type of join to use.</param>
- /// <param name="withClause"The criteria to be added to the join condition (ON clause)</param>
+ /// <param name="withClause">The criteria to be added to the join condition (ON clause)</param>
/// <returns>this (for method chaining)</returns>
ICriteria CreateAlias(string associationPath, string alias, JoinType joinType, ICriterion withClause);
@@ -182,7 +182,7 @@
/// <param name="associationPath">A dot-separated property path</param>
/// <param name="alias">The alias to assign to the joined association (for later reference).</param>
/// <param name="joinType">The type of join to use.</param>
- /// <param name="withClause"The criteria to be added to the join condition (ON clause)</param>
+ /// <param name="withClause">The criteria to be added to the join condition (ON clause)</param>
/// <returns>The created "sub criteria"</returns>
ICriteria CreateCriteria(string associationPath, string alias, JoinType joinType, ICriterion withClause);
Modified: trunk/nhibernate/src/NHibernate/ISession.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/ISession.cs 2010-09-14 13:37:52 UTC (rev 5184)
+++ trunk/nhibernate/src/NHibernate/ISession.cs 2010-09-14 15:31:30 UTC (rev 5185)
@@ -666,7 +666,7 @@
/// <summary>
/// Create a new instance of <c>Query</c> for the given query expression
- /// <param name="queryExpression"/>A hibernate query expression</param>
+ /// <param name="queryExpression">A hibernate query expression</param>
/// <returns>The query</returns>
/// </summary>
IQuery CreateQuery(IQueryExpression queryExpression);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jul...@us...> - 2010-09-16 15:22:09
|
Revision: 5186
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5186&view=rev
Author: julian-maughan
Date: 2010-09-16 15:21:57 +0000 (Thu, 16 Sep 2010)
Log Message:
-----------
Added new Sybase SQL Anywhere dialects. Credit to Glenn Paulley.
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/NHibernate.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate/Dialect/SybaseSQLAnywhere10Dialect.cs
trunk/nhibernate/src/NHibernate/Dialect/SybaseSQLAnywhere11Dialect.cs
Added: trunk/nhibernate/src/NHibernate/Dialect/SybaseSQLAnywhere10Dialect.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Dialect/SybaseSQLAnywhere10Dialect.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/Dialect/SybaseSQLAnywhere10Dialect.cs 2010-09-16 15:21:57 UTC (rev 5186)
@@ -0,0 +1,886 @@
+using System;
+using System.Collections;
+using System.Data;
+using System.Data.Common;
+using System.Text.RegularExpressions;
+
+using NHibernate.Dialect.Function;
+using NHibernate.Dialect.Lock;
+using NHibernate.Engine;
+using NHibernate.Exceptions;
+using NHibernate.Mapping;
+using NHibernate.SqlCommand;
+using NHibernate.Type;
+using NHibernate.Util;
+
+using Environment = NHibernate.Cfg.Environment;
+
+namespace NHibernate.Dialect
+{
+ /// <summary>
+ /// SQL Dialect for SQL Anywhere 10 - for the NHibernate 3.0.0 distribution
+ /// Copyright (C) 2010 Glenn Paulley
+ /// Contact: http://iablog.sybase.com/paulley
+ ///
+ /// This NHibernate dialect should be considered BETA software.
+ ///
+ /// This library is free software; you can redistribute it and/or
+ /// modify it under the terms of the GNU Lesser General Public
+ /// License as published by the Free Software Foundation; either
+ /// version 2.1 of the License, or (at your option) any later version.
+ ///
+ /// This library is distributed in the hope that it will be useful,
+ /// but WITHOUT ANY WARRANTY; without even the implied warranty of
+ /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ /// Lesser General Public License for more details.
+ ///
+ /// You should have received a copy of the GNU Lesser General Public
+ /// License along with this library; if not, write to the Free Software
+ /// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ///
+ /// </summary>
+ /// <remarks>
+ /// The SybaseSQLAnywhere10Dialect defaults the following configuration properties:
+ /// <list type="table">
+ /// <listheader>
+ /// <term>Property</term>
+ /// <description>Default Value</description>
+ /// </listheader>
+ /// <item>
+ /// <term>use_outer_join</term>
+ /// <description><see langword="true" /></description>
+ /// </item>
+ /// <item>
+ /// <term>connection.driver_class</term>
+ /// <description><see cref="NHibernate.Driver.ASA10ClientDriver" /></description>
+ /// </item>
+ /// <item>
+ /// <term>prepare_sql</term>
+ /// <description><see langword="false" /></description>
+ /// </item>
+ /// </list>
+ /// </remarks>
+ public class SybaseSQLAnywhere10Dialect : Dialect
+ {
+ public SybaseSQLAnywhere10Dialect()
+ {
+ DefaultProperties[Environment.ConnectionDriver] = "NHibernate.Driver.ASA10ClientDriver";
+ DefaultProperties[Environment.PrepareSql] = "false";
+
+ RegisterCharacterTypeMappings();
+ RegisterNumericTypeMappings();
+ RegisterDateTimeTypeMappings();
+ RegisterReverseNHibernateTypeMappings();
+ RegisterFunctions();
+ RegisterKeywords();
+ }
+
+ protected void RegisterCharacterTypeMappings()
+ {
+ RegisterColumnType( DbType.AnsiStringFixedLength, "CHAR(1)" );
+ RegisterColumnType( DbType.AnsiStringFixedLength, 32767, "CHAR($l)" );
+ RegisterColumnType( DbType.AnsiString, "VARCHAR(1)" );
+ RegisterColumnType( DbType.AnsiString, 32767, "VARCHAR($l)" );
+ RegisterColumnType( DbType.AnsiString, 2147483647, "LONG VARCHAR" );
+ RegisterColumnType( DbType.StringFixedLength, "NCHAR(1)" );
+ RegisterColumnType( DbType.StringFixedLength, 32767, "NCHAR($l)" );
+ RegisterColumnType( DbType.String, "NVARCHAR(1)" );
+ RegisterColumnType( DbType.String, 32767, "NVARCHAR($l)" );
+ RegisterColumnType( DbType.String, 2147483647, "LONG NVARCHAR" );
+ RegisterColumnType( DbType.Binary, "BINARY(1)" );
+ RegisterColumnType( DbType.Binary, 32767, "VARBINARY($l)" );
+ RegisterColumnType( DbType.Binary, 2147483647, "LONG VARBINARY" );
+ RegisterColumnType( DbType.Guid, "UNIQUEIDENTIFIER");
+ }
+
+ protected void RegisterNumericTypeMappings()
+ {
+ RegisterColumnType( DbType.Boolean, "BIT" ); // BIT type is NOT NULL by default
+ RegisterColumnType( DbType.Int64, "BIGINT" );
+ RegisterColumnType( DbType.UInt64, "UNSIGNED BIGINT");
+ RegisterColumnType( DbType.Int16, "SMALLINT" );
+ RegisterColumnType( DbType.UInt16,"UNSIGNED SMALLINT");
+ RegisterColumnType( DbType.Int32, "INTEGER" );
+ RegisterColumnType( DbType.UInt32, "UNSIGNED INTEGER");
+ RegisterColumnType( DbType.Single, "REAL" );
+ RegisterColumnType( DbType.Double, "DOUBLE" );
+ RegisterColumnType( DbType.Decimal, "NUMERIC(19,$l)" ); // Precision ranges from 0-127
+ }
+
+ protected void RegisterDateTimeTypeMappings()
+ {
+ RegisterColumnType( DbType.Date, "DATE" );
+ RegisterColumnType( DbType.Time, "TIME" );
+ RegisterColumnType( DbType.DateTime, "TIMESTAMP" );
+ }
+
+ protected void RegisterReverseNHibernateTypeMappings() {}
+
+ protected void RegisterFunctions()
+ {
+ RegisterMathFunctions();
+ RegisterXMLFunctions();
+ RegisterAggregationFunctions();
+ RegisterBitFunctions();
+ RegisterDateFunctions();
+ RegisterStringFunctions();
+ RegisterSOAPFunctions();
+ RegisterMiscellaneousFunctions();
+ }
+
+ protected void RegisterMathFunctions()
+ {
+ // mathematical functions
+ RegisterFunction( "abs", new StandardSQLFunction("abs") );
+ RegisterFunction( "acos", new StandardSQLFunction("acos", NHibernateUtil.Double) );
+ RegisterFunction( "asin", new StandardSQLFunction("asin", NHibernateUtil.Double) );
+ RegisterFunction( "atan", new StandardSQLFunction("atan", NHibernateUtil.Double) );
+ RegisterFunction( "atan2", new StandardSQLFunction("atan2", NHibernateUtil.Double) );
+ RegisterFunction( "ceiling", new StandardSQLFunction("ceiling", NHibernateUtil.Double) );
+ RegisterFunction( "cos", new StandardSQLFunction("cos", NHibernateUtil.Double) );
+ RegisterFunction( "cot", new StandardSQLFunction("cot", NHibernateUtil.Double) );
+ RegisterFunction( "degrees", new StandardSQLFunction("degrees", NHibernateUtil.Double) );
+ RegisterFunction( "exp", new StandardSQLFunction("exp", NHibernateUtil.Double) );
+ RegisterFunction( "floor", new StandardSQLFunction("floor", NHibernateUtil.Double) );
+ RegisterFunction( "log", new StandardSQLFunction("log", NHibernateUtil.Double) );
+ RegisterFunction( "log10", new StandardSQLFunction("log10", NHibernateUtil.Double) );
+ RegisterFunction( "mod", new StandardSQLFunction("mod") );
+ RegisterFunction( "pi", new NoArgSQLFunction("pi", NHibernateUtil.Double, true ) );
+ RegisterFunction( "power", new StandardSQLFunction("power", NHibernateUtil.Double) );
+ RegisterFunction( "radians", new StandardSQLFunction("radians", NHibernateUtil.Double) );
+ RegisterFunction( "rand", new StandardSQLFunction("rand", NHibernateUtil.Double) );
+ RegisterFunction( "remainder", new StandardSQLFunction("remainder") );
+ RegisterFunction( "round", new StandardSQLFunction("round") );
+ RegisterFunction( "sign", new StandardSQLFunction("sign", NHibernateUtil.Int32) );
+ RegisterFunction( "sin", new StandardSQLFunction("sin", NHibernateUtil.Double) );
+ RegisterFunction( "sqrt", new StandardSQLFunction("sqrt", NHibernateUtil.Double) );
+ RegisterFunction( "tan", new StandardSQLFunction("tan", NHibernateUtil.Double) );
+ RegisterFunction( "truncate", new StandardSQLFunction("truncate") );
+ }
+
+ protected void RegisterXMLFunctions()
+ {
+ // XML scalar functions only
+ RegisterFunction( "xmlconcat", new VarArgsSQLFunction( NHibernateUtil.String, "xmlconcat(", ",", ")" ) );
+ RegisterFunction( "xmlelement", new VarArgsSQLFunction( NHibernateUtil.String, "xmlelement(", ",", ")" ) );
+ RegisterFunction( "xmlgen", new VarArgsSQLFunction( NHibernateUtil.String, "xmlgen(", ",", ")" ) );
+ // missing: XMLForest().
+ }
+
+ protected void RegisterAggregationFunctions()
+ {
+ // basic aggregate, linear regression OLAP, and window functions
+ RegisterFunction( "bit_or", new StandardSQLFunction("bit_or") );
+ RegisterFunction( "bit_and", new StandardSQLFunction("bit_and") );
+ RegisterFunction( "bit_xor", new StandardSQLFunction("bit_xor") );
+ RegisterFunction( "covar_pop", new StandardSQLFunction("covar_pop", NHibernateUtil.Double) );
+ RegisterFunction( "covar_samp", new StandardSQLFunction("covar_samp", NHibernateUtil.Double) );
+ RegisterFunction( "corr", new StandardSQLFunction("corr", NHibernateUtil.Double) );
+ RegisterFunction( "first_value", new VarArgsSQLFunction(NHibernateUtil.Double, "first_value(", ",", ")" ));
+ RegisterFunction( "grouping", new StandardSQLFunction("grouping", NHibernateUtil.Int32) );
+ RegisterFunction( "last_value", new VarArgsSQLFunction(NHibernateUtil.Double, "last_value(", ",", ")" ));
+ RegisterFunction( "list", new VarArgsSQLFunction("list(", ",", ")" ));
+ RegisterFunction( "regr_avgx", new StandardSQLFunction("regr_avgx", NHibernateUtil.Double) );
+ RegisterFunction( "regr_avgy", new StandardSQLFunction("regr_avgy", NHibernateUtil.Double) );
+ RegisterFunction( "regr_count", new StandardSQLFunction("regr_count", NHibernateUtil.Double) );
+ RegisterFunction( "regr_intercept", new StandardSQLFunction("regr_intercept", NHibernateUtil.Double) );
+ RegisterFunction( "regr_r2", new StandardSQLFunction("regr_r2", NHibernateUtil.Double) );
+ RegisterFunction( "regr_slope", new StandardSQLFunction("regr_slope", NHibernateUtil.Double) );
+ RegisterFunction( "regr_sxx", new StandardSQLFunction("regr_sxx", NHibernateUtil.Double) );
+ RegisterFunction( "regr_sxy", new StandardSQLFunction("regr_sxy", NHibernateUtil.Double) );
+ RegisterFunction( "regr_syy", new StandardSQLFunction("regr_syy", NHibernateUtil.Double) );
+ RegisterFunction( "set_bits", new StandardSQLFunction("set_bits") );
+ RegisterFunction( "stddev", new StandardSQLFunction("stddev", NHibernateUtil.Double) );
+ RegisterFunction( "stddev_pop", new StandardSQLFunction("stddev_pop", NHibernateUtil.Double) );
+ RegisterFunction( "stddev_samp", new StandardSQLFunction("stddev_samp", NHibernateUtil.Double) );
+ RegisterFunction( "variance", new StandardSQLFunction("variance", NHibernateUtil.Double) );
+ RegisterFunction( "var_pop", new StandardSQLFunction("var_pop", NHibernateUtil.Double) );
+ RegisterFunction( "var_samp", new StandardSQLFunction("var_samp", NHibernateUtil.Double) );
+ RegisterFunction( "xmlagg", new StandardSQLFunction("xmlagg") );
+ }
+
+ protected void RegisterBitFunctions()
+ {
+ RegisterFunction( "bit_length", new StandardSQLFunction("bit_length", NHibernateUtil.Int32) );
+ RegisterFunction( "bit_substr", new StandardSQLFunction("bit_substr") );
+ RegisterFunction( "get_bit", new StandardSQLFunction("get_bit", NHibernateUtil.Boolean) );
+ RegisterFunction( "set_bit", new VarArgsSQLFunction("set_bit(", ",", ")" ));
+ }
+
+ protected void RegisterDateFunctions()
+ {
+ RegisterFunction( "date", new StandardSQLFunction("date", NHibernateUtil.Date) );
+ RegisterFunction( "dateadd", new StandardSQLFunction("dateadd", NHibernateUtil.Timestamp) );
+ RegisterFunction( "datediff", new StandardSQLFunction("datediff", NHibernateUtil.Int32) );
+ RegisterFunction( "dateformat", new StandardSQLFunction("dateformat", NHibernateUtil.String) );
+ RegisterFunction( "datename", new StandardSQLFunction("datename", NHibernateUtil.String) );
+ RegisterFunction( "datepart", new StandardSQLFunction("datepart", NHibernateUtil.Int32) );
+ RegisterFunction( "datetime", new StandardSQLFunction("datetime", NHibernateUtil.Timestamp) );
+ RegisterFunction( "day", new StandardSQLFunction("day", NHibernateUtil.Int32) );
+ RegisterFunction( "dayname", new StandardSQLFunction("dayname", NHibernateUtil.String) );
+ RegisterFunction( "days", new StandardSQLFunction("days") );
+ RegisterFunction( "dow", new StandardSQLFunction("dow", NHibernateUtil.Int32) );
+ RegisterFunction( "getdate", new StandardSQLFunction("getdate", NHibernateUtil.Timestamp) );
+ RegisterFunction( "hour", new StandardSQLFunction("hour", NHibernateUtil.Int32) );
+ RegisterFunction( "hours", new StandardSQLFunction("hours") );
+ RegisterFunction( "minute", new StandardSQLFunction("minute", NHibernateUtil.Int32) );
+ RegisterFunction( "minutes", new StandardSQLFunction("minutes") );
+ RegisterFunction( "month", new StandardSQLFunction("month", NHibernateUtil.Int32) );
+ RegisterFunction( "monthname", new StandardSQLFunction("monthname", NHibernateUtil.String) );
+ RegisterFunction( "months", new StandardSQLFunction("months") );
+ RegisterFunction( "now", new NoArgSQLFunction("now", NHibernateUtil.Timestamp) );
+ RegisterFunction( "quarter", new StandardSQLFunction("quarter", NHibernateUtil.Int32) );
+ RegisterFunction( "second", new StandardSQLFunction("second", NHibernateUtil.Int32) );
+ RegisterFunction( "seconds", new StandardSQLFunction("seconds") );
+ RegisterFunction( "today", new NoArgSQLFunction("now", NHibernateUtil.Date) );
+ RegisterFunction( "weeks", new StandardSQLFunction("weeks") );
+ RegisterFunction( "year", new StandardSQLFunction("year", NHibernateUtil.Int32) );
+ RegisterFunction( "years", new StandardSQLFunction("years") );
+ RegisterFunction( "ymd", new StandardSQLFunction("ymd", NHibernateUtil.Date) );
+
+ // compatibility functions
+ RegisterFunction( "current_timestamp", new NoArgSQLFunction("getdate", NHibernateUtil.Timestamp, true ) );
+ RegisterFunction( "current_time", new NoArgSQLFunction("getdate", NHibernateUtil.Time, true ) );
+ RegisterFunction( "current_date", new NoArgSQLFunction("getdate", NHibernateUtil.Date, true ) );
+ }
+
+ protected void RegisterStringFunctions()
+ {
+ RegisterFunction( "ascii", new StandardSQLFunction("ascii", NHibernateUtil.Int32) );
+ RegisterFunction( "byte64_decode", new StandardSQLFunction("byte64_decode", NHibernateUtil.StringClob ) );
+ RegisterFunction( "byte64_encode", new StandardSQLFunction("byte64_encode", NHibernateUtil.StringClob ) );
+ RegisterFunction( "byte_length", new StandardSQLFunction("byte_length", NHibernateUtil.Int32) );
+ RegisterFunction( "byte_substr", new VarArgsSQLFunction( NHibernateUtil.String, "byte_substr(",",",")" ) );
+ RegisterFunction( "char", new StandardSQLFunction("char", NHibernateUtil.String ) );
+ RegisterFunction( "charindex", new StandardSQLFunction("charindex", NHibernateUtil.Int32) );
+ RegisterFunction( "char_length", new StandardSQLFunction("char_length", NHibernateUtil.Int32) );
+ RegisterFunction( "compare", new VarArgsSQLFunction( NHibernateUtil.Int32, "compare(",",",")" ) );
+ RegisterFunction( "compress", new VarArgsSQLFunction( NHibernateUtil.BinaryBlob, "compress(",",",")" ) );
+ RegisterFunction( "concat", new VarArgsSQLFunction( NHibernateUtil.String, "(","+",")" ) );
+ RegisterFunction( "csconvert", new VarArgsSQLFunction( NHibernateUtil.StringClob, "csconvert(",",",")" ) );
+ RegisterFunction( "decompress", new VarArgsSQLFunction( NHibernateUtil.BinaryBlob, "decompress(",",",")" ) );
+ RegisterFunction( "decrypt", new VarArgsSQLFunction( NHibernateUtil.BinaryBlob, "decrypt(",",",")" ) );
+ RegisterFunction( "difference", new StandardSQLFunction("difference", NHibernateUtil.Int32) );
+ RegisterFunction( "encrypt", new VarArgsSQLFunction( NHibernateUtil.BinaryBlob, "encrypt(",",",")" ) );
+ RegisterFunction( "hash", new VarArgsSQLFunction( NHibernateUtil.String, "hash(",",",")" ) );
+ RegisterFunction( "insertstr", new StandardSQLFunction("insertstr", NHibernateUtil.String) );
+ RegisterFunction( "lcase", new StandardSQLFunction("lcase", NHibernateUtil.String) );
+ RegisterFunction( "left", new StandardSQLFunction("left", NHibernateUtil.String) );
+ RegisterFunction( "length", new StandardSQLFunction("length", NHibernateUtil.Int32) );
+ RegisterFunction( "locate", new VarArgsSQLFunction( NHibernateUtil.Int32, "locate(",",",")" ) );
+ RegisterFunction( "lower", new StandardSQLFunction("lower", NHibernateUtil.String) );
+ RegisterFunction( "ltrim", new StandardSQLFunction("ltrim", NHibernateUtil.String) );
+ RegisterFunction( "patindex", new StandardSQLFunction("patindex", NHibernateUtil.Int32) );
+ RegisterFunction( "repeat", new StandardSQLFunction("repeat", NHibernateUtil.String) );
+ RegisterFunction( "replace", new StandardSQLFunction("replace", NHibernateUtil.String) );
+ RegisterFunction( "replicate", new StandardSQLFunction("replicate", NHibernateUtil.String) );
+ RegisterFunction( "reverse", new StandardSQLFunction("reverse", NHibernateUtil.String) );
+ RegisterFunction( "right", new StandardSQLFunction("right", NHibernateUtil.String) );
+ RegisterFunction( "rtrim", new StandardSQLFunction("rtrim", NHibernateUtil.String) );
+ RegisterFunction( "similar", new StandardSQLFunction("rtrim", NHibernateUtil.Int32) );
+ RegisterFunction( "sortkey", new VarArgsSQLFunction( NHibernateUtil.Binary, "sortkey(",",",")" ) );
+ RegisterFunction( "soundex", new StandardSQLFunction("soundex", NHibernateUtil.Int32) );
+ RegisterFunction( "space", new StandardSQLFunction("space", NHibernateUtil.String) );
+ RegisterFunction( "str", new VarArgsSQLFunction( NHibernateUtil.String, "str(",",",")" ) );
+ RegisterFunction( "string", new VarArgsSQLFunction( NHibernateUtil.String, "string(",",",")" ) );
+ RegisterFunction( "strtouuid", new StandardSQLFunction("strtouuid") );
+ RegisterFunction( "stuff", new StandardSQLFunction("stuff", NHibernateUtil.String) );
+
+ // In SQL Anywhere 10, substr() semantics depends on the ANSI_substring option
+
+ RegisterFunction( "substr", new VarArgsSQLFunction( NHibernateUtil.String, "substr(",",",")" ) );
+ RegisterFunction( "substring", new VarArgsSQLFunction( NHibernateUtil.String, "substr(",",",")" ) );
+ RegisterFunction( "to_char", new VarArgsSQLFunction( NHibernateUtil.String, "to_char(",",",")" ) );
+ RegisterFunction( "to_nchar", new VarArgsSQLFunction( NHibernateUtil.String, "to_nchar(",",",")" ) );
+
+ RegisterFunction( "trim", new StandardSQLFunction( "trim", NHibernateUtil.String) );
+ RegisterFunction( "ucase", new StandardSQLFunction("ucase", NHibernateUtil.String) );
+ RegisterFunction( "unicode", new StandardSQLFunction("unicode", NHibernateUtil.Int32) );
+ RegisterFunction( "unistr", new StandardSQLFunction("unistr", NHibernateUtil.String) );
+ RegisterFunction( "upper", new StandardSQLFunction("upper", NHibernateUtil.String) );
+ RegisterFunction( "uuidtostr", new StandardSQLFunction("uuidtostr", NHibernateUtil.String) );
+ }
+
+ protected void RegisterSOAPFunctions()
+ {
+ RegisterFunction( "html_decode", new StandardSQLFunction("html_decode", NHibernateUtil.String) );
+ RegisterFunction( "html_encode", new StandardSQLFunction("html_encode", NHibernateUtil.String) );
+ RegisterFunction( "http_decode", new StandardSQLFunction("http_decode", NHibernateUtil.String) );
+ RegisterFunction( "http_encode", new StandardSQLFunction("http_encode", NHibernateUtil.String) );
+ RegisterFunction( "http_header", new StandardSQLFunction("http_header", NHibernateUtil.String) );
+ RegisterFunction( "http_variable", new VarArgsSQLFunction( "http_variable(",",",")" ) );
+ RegisterFunction( "next_http_header", new StandardSQLFunction("next_http_header", NHibernateUtil.String) );
+ RegisterFunction( "next_http_variable", new StandardSQLFunction("next_http_variable", NHibernateUtil.String) );
+ RegisterFunction( "next_soap_header", new VarArgsSQLFunction( "next_soap_header(",",",")" ) );
+ }
+
+ protected void RegisterMiscellaneousFunctions()
+ {
+ RegisterFunction( "argn", new VarArgsSQLFunction( "argn(",",",")" ) );
+ RegisterFunction( "coalesce", new VarArgsSQLFunction( "coalesce(",",",")" ) );
+ RegisterFunction( "conflict", new StandardSQLFunction("conflict", NHibernateUtil.Boolean) );
+ RegisterFunction( "connection_property", new VarArgsSQLFunction( "connection_property(",",",")" ) );
+ RegisterFunction( "connection_extended_property", new VarArgsSQLFunction( "connection_extended_property(",",",")" ) );
+ RegisterFunction( "db_extended_property", new VarArgsSQLFunction( "db_extended_property(",",",")" ) );
+ RegisterFunction( "db_property", new VarArgsSQLFunction( "db_property(",",",")" ) );
+ RegisterFunction( "errormsg", new NoArgSQLFunction("errormsg", NHibernateUtil.String, true ) );
+ RegisterFunction( "estimate", new VarArgsSQLFunction( "estimate(",",",")" ) );
+ RegisterFunction( "estimate_source", new VarArgsSQLFunction( NHibernateUtil.String, "estimate_source(",",",")" ) );
+ RegisterFunction( "experience_estimate", new VarArgsSQLFunction( "experience_estimate(",",",")" ) );
+ RegisterFunction( "explanation", new VarArgsSQLFunction( NHibernateUtil.String, "explanation(",",",")" ) );
+ RegisterFunction( "exprtype", new StandardSQLFunction("exprtype", NHibernateUtil.String) );
+ RegisterFunction( "get_identity", new VarArgsSQLFunction( "get_identity(",",",")" ) );
+ RegisterFunction( "graphical_plan", new VarArgsSQLFunction( NHibernateUtil.String, "graphical_plan(",",",")" ) );
+ RegisterFunction( "greater", new StandardSQLFunction("greater") );
+ RegisterFunction( "identity", new StandardSQLFunction("identity") );
+ RegisterFunction( "ifnull", new VarArgsSQLFunction( "ifnull(",",",")" ) );
+ RegisterFunction( "index_estimate", new VarArgsSQLFunction( "index_estimate(",",",")" ) );
+ RegisterFunction( "isnull", new VarArgsSQLFunction( "isnull(",",",")" ) );
+ RegisterFunction( "lesser", new StandardSQLFunction("lesser") );
+ RegisterFunction( "newid", new NoArgSQLFunction("newid", NHibernateUtil.String, true ) );
+ RegisterFunction( "nullif", new StandardSQLFunction("nullif") );
+ RegisterFunction( "number", new NoArgSQLFunction("number", NHibernateUtil.Int32) );
+ RegisterFunction( "plan", new VarArgsSQLFunction( NHibernateUtil.String, "plan(",",",")" ) );
+ RegisterFunction( "property", new StandardSQLFunction( "property", NHibernateUtil.String ) );
+ RegisterFunction( "property_description", new StandardSQLFunction( "property_description", NHibernateUtil.String ) );
+ RegisterFunction( "property_name", new StandardSQLFunction( "property_name", NHibernateUtil.String ) );
+ RegisterFunction( "property_number", new StandardSQLFunction( "property_number", NHibernateUtil.Int32 ) );
+ RegisterFunction( "rewrite", new VarArgsSQLFunction( NHibernateUtil.String, "rewrite(",",",")" ) );
+ RegisterFunction( "row_number", new NoArgSQLFunction("row_number", NHibernateUtil.Int32, true ) );
+ RegisterFunction( "sqldialect", new StandardSQLFunction("sqldialect", NHibernateUtil.String) );
+ RegisterFunction( "sqlflagger", new StandardSQLFunction("sqlflagger", NHibernateUtil.String) );
+ RegisterFunction( "traceback", new NoArgSQLFunction("traceback", NHibernateUtil.String) );
+ RegisterFunction( "transactsql", new StandardSQLFunction("transactsql", NHibernateUtil.String) );
+ RegisterFunction( "varexists", new StandardSQLFunction("varexists", NHibernateUtil.Int32) );
+ RegisterFunction( "watcomsql", new StandardSQLFunction("watcomsql", NHibernateUtil.String) );
+ }
+
+ protected void RegisterKeywords()
+ {
+ RegisterKeyword( "TOP" );
+ RegisterKeyword( "FIRST" );
+ RegisterKeyword( "FETCH" );
+ RegisterKeyword( "START" );
+ RegisterKeyword( "AT" );
+ RegisterKeyword( "WITH" );
+ RegisterKeyword( "CONTAINS" );
+ RegisterKeyword( "REGEXP" );
+ RegisterKeyword( "SIMILAR" );
+ RegisterKeyword( "SEQUENCE" );
+ }
+
+ #region IDENTITY or AUTOINCREMENT support
+
+ public override bool SupportsIdentityColumns
+ {
+ get { return true; }
+ }
+
+ public override string IdentitySelectString
+ {
+ get { return "SELECT @@IDENTITY"; }
+ }
+
+ /// <summary>
+ /// SQL Anywhere uses <tt>DEFAULT AUTOINCREMENT</tt> to identify an IDENTITY
+ /// column in a <tt>CREATE TABLE</tt> statement.
+ /// </summary>
+ public override string IdentityColumnString
+ {
+ get { return "NOT NULL DEFAULT AUTOINCREMENT"; }
+ }
+
+ public override SqlString AppendIdentitySelectToInsert( SqlString insertSql )
+ {
+ return insertSql.Append( "; " + IdentitySelectString );
+ }
+
+ public override bool SupportsInsertSelectIdentity
+ {
+ get { return true; }
+ }
+
+ #endregion
+
+ #region LIMIT/OFFSET support
+
+ /// <summary>
+ /// SQL Anywhere supports a query statement that provides <c>LIMIT</c>
+ /// functionality.
+ /// </summary>
+ /// <value><c>true</c></value>
+ public override bool SupportsLimit
+ {
+ get { return true; }
+ }
+
+ /// <summary>
+ /// SQL Anywhere supports a query statement that provides <c>LIMIT</c>
+ /// functionality with an offset.
+ /// </summary>
+ /// <value><c>true</c></value>
+ public override bool SupportsLimitOffset
+ {
+ get { return true; }
+ }
+
+ /// <summary>
+ /// Can parameters be used for a statement containing a LIMIT?
+ /// </summary>
+ public override bool SupportsVariableLimit
+ {
+ get { return true; }
+ }
+
+ /// <summary>
+ /// SQL Anywhere syntax is SELECT TOP n START AT m
+ /// </summary>
+ public override bool BindLimitParametersInReverseOrder
+ {
+ get { return true; }
+ }
+
+ /// <summary>
+ /// SQL Anywhere 11 uses SELECT TOP n START AT m [ select list items ]
+ /// for LIMIT/OFFSET support.
+ /// </summary>
+ public override bool BindLimitParametersFirst
+ {
+ get { return true; }
+ }
+
+ private static int GetAfterSelectInsertPoint( SqlString sql )
+ {
+ // Assume no common table expressions with the statement.
+ if ( sql.StartsWithCaseInsensitive( "SELECT DISTINCT" ) )
+ {
+ return 15;
+ }
+ else if ( sql.StartsWithCaseInsensitive( "SELECT" ) )
+ {
+ return 6;
+ }
+ return 0;
+ }
+
+ /// <summary>
+ /// SQL Anywhere 11 uses SELECT TOP n START AT m [ select list items ]
+ /// for LIMIT/OFFSET support.
+ ///
+ /// Produce a parametertized SQL query using positional parameters for
+ /// TOP and START AT (if specified).
+ /// </summary>
+ public override SqlString GetLimitString( SqlString sql, bool hasOffset )
+ {
+ int InsertionPoint = GetAfterSelectInsertPoint( sql );
+
+ if ( InsertionPoint > 0 )
+ {
+ SqlStringBuilder LimitBuilder = new SqlStringBuilder();
+ LimitBuilder.Add( "SELECT" );
+ if ( InsertionPoint > 6 )
+ {
+ LimitBuilder.Add( " DISTINCT " );
+ }
+ LimitBuilder.Add( " TOP ");
+ LimitBuilder.Add( Parameter.Placeholder );
+ if ( hasOffset )
+ {
+ LimitBuilder.Add( " START AT ");
+ LimitBuilder.Add( Parameter.Placeholder );
+ }
+ LimitBuilder.Add( sql.Substring( InsertionPoint ) );
+ return LimitBuilder.ToSqlString();
+ }
+ else
+ {
+ return sql; // unchanged
+ }
+ }
+
+ /// <summary>
+ /// SQL Anywhere 11 uses SELECT TOP n START AT m [ select list items ]
+ /// for LIMIT/OFFSET support.
+ ///
+ /// Generate SELECT TOP n START AT m syntax using bound parameters
+ /// SQL Anywhere constraints: n > 0, m >= 0
+ /// </summary>
+ public override SqlString GetLimitString( SqlString sql, int offset, int limit)
+ {
+ if ( offset < 0 )
+ {
+ throw new NotSupportedException("SQL Anywhere does not support negative offsets");
+ }
+ if ( limit <= 0 )
+ {
+ throw new NotSupportedException( "negative or zero TOP n (SQL limit) is not supported" );
+ }
+ return GetLimitString( sql, offset > 0 );
+ }
+
+ #endregion
+
+ #region Lock acquisition support
+
+ /// <summary>
+ /// SQL Anywhere 10 supports READ, WRITE, and INTENT row
+ /// locks. INTENT locks are sufficient to ensure that other
+ /// concurrent connections cannot modify a row (though other
+ /// connections can still read that row). SQL Anywhere also
+ /// supports 3 modes of snapshot isolation (multi-version
+ /// concurrency control (MVCC).
+ ///
+ /// SQL Anywhere's <tt>FOR UPDATE</tt> clause supports
+ /// <tt>FOR UPDATE BY [ LOCK | VALUES ]</tt>
+ /// <tt>FOR UPDATE OF ( COLUMN LIST )</tt>
+ ///
+ /// though they cannot be specified at the same time. <tt>BY LOCK</tt> is
+ /// the syntax that acquires INTENT locks. <tt>FOR UPDATE BY VALUES</tt>
+ /// forces the use of the KEYSET cursor, which returns a warning to
+ /// the application when a row in the cursor has been subsequently
+ /// modified by another connection, and an error if the row has
+ /// been deleted.
+ ///
+ /// SQL Anywhere does not support the <tt>FOR UPDATE NOWAIT</tt> syntax of
+ /// Oracle on a statement-by-statement basis. However, the
+ /// identical functionality is provided by setting the connection
+ /// option <tt>BLOCKING</tt> to "OFF", or setting an appropriate timeout
+ /// period through the connection option <tt>BLOCKING_TIMEOUT</tt>.
+ /// </summary>
+ public override string GetForUpdateString( LockMode lockMode )
+ {
+ if( lockMode == LockMode.Read )
+ {
+ return ForReadOnlyString;
+ }
+ else if( lockMode == LockMode.Upgrade )
+ {
+ return ForUpdateByLockString;
+ }
+ else if( lockMode == LockMode.UpgradeNoWait )
+ {
+ return ForUpdateNowaitString;
+ }
+ else if( lockMode == LockMode.Force )
+ {
+ return ForUpdateNowaitString;
+ }
+ else
+ {
+ return string.Empty;
+ }
+ }
+
+ /// <summary>
+ /// SQL Anywhere does support <tt>FOR UPDATE OF</tt> syntax. However,
+ /// in SQL Anywhere one cannot specify both <tt>FOR UPDATE OF</tt> syntax
+ /// and <tt>FOR UPDATE BY LOCK</tt> in the same statement. To achieve INTENT
+ /// locking when using <tt>FOR UPDATE OF</tt> syntax one must use a table hint
+ /// in the query's FROM clause, ie.
+ ///
+ /// SELECT * FROM FOO WITH( UPDLOCK ) FOR UPDATE OF ( column-list ).
+ ///
+ /// In this dialect, we avoid this issue by suppor...
[truncated message content] |
|
From: <fab...@us...> - 2010-09-19 20:17:18
|
Revision: 5192
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5192&view=rev
Author: fabiomaulo
Date: 2010-09-19 20:17:12 +0000 (Sun, 19 Sep 2010)
Log Message:
-----------
Fix NH-626 and NH-866 (support for XmlDoc type)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs
trunk/nhibernate/src/NHibernate/NHibernate.csproj
trunk/nhibernate/src/NHibernate/NHibernateUtil.cs
trunk/nhibernate/src/NHibernate/Type/TypeFactory.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate/SqlTypes/XmlSqlType.cs
trunk/nhibernate/src/NHibernate/Type/XmlDocType.cs
trunk/nhibernate/src/NHibernate.Test/TypesTest/XmlDocClass.cs
trunk/nhibernate/src/NHibernate.Test/TypesTest/XmlDocClass.hbm.xml
trunk/nhibernate/src/NHibernate.Test/TypesTest/XmlDocTypeFixture.cs
Modified: trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs 2010-09-19 12:31:31 UTC (rev 5191)
+++ trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs 2010-09-19 20:17:12 UTC (rev 5192)
@@ -2,7 +2,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Data;
-using System.Text;
using NHibernate.Mapping;
using NHibernate.SqlCommand;
using NHibernate.Util;
@@ -16,6 +15,7 @@
RegisterColumnType(DbType.String, 1073741823, "NVARCHAR(MAX)");
RegisterColumnType(DbType.AnsiString, 2147483647, "VARCHAR(MAX)");
RegisterColumnType(DbType.Binary, 2147483647, "VARBINARY(MAX)");
+ RegisterColumnType(DbType.Xml, "XML");
}
/// <summary>
Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2010-09-19 12:31:31 UTC (rev 5191)
+++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2010-09-19 20:17:12 UTC (rev 5192)
@@ -847,6 +847,7 @@
<Compile Include="Param\VersionTypeSeedParameterSpecification.cs" />
<Compile Include="Proxy\AbstractProxyFactory.cs" />
<Compile Include="SqlCommand\InsertSelect.cs" />
+ <Compile Include="SqlTypes\XmlSqlType.cs" />
<Compile Include="Tool\hbm2ddl\SchemaMetadataUpdater.cs" />
<Compile Include="Tool\hbm2ddl\ScriptSplitter.cs" />
<Compile Include="Transaction\AdoNetWithDistrubtedTransactionFactory.cs" />
@@ -857,6 +858,7 @@
<Compile Include="Bytecode\ICollectionTypeFactory.cs" />
<Compile Include="Type\LocalDateTimeType.cs" />
<Compile Include="Type\UtcDateTimeType.cs" />
+ <Compile Include="Type\XmlDocType.cs" />
<Compile Include="Util\ExpressionsHelper.cs" />
<Compile Include="Util\NullableDictionary.cs" />
<Compile Include="Hql\Ast\ANTLR\Util\PathHelper.cs" />
Modified: trunk/nhibernate/src/NHibernate/NHibernateUtil.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernateUtil.cs 2010-09-19 12:31:31 UTC (rev 5191)
+++ trunk/nhibernate/src/NHibernate/NHibernateUtil.cs 2010-09-19 20:17:12 UTC (rev 5192)
@@ -281,6 +281,8 @@
public static readonly NullableType AnsiChar = new AnsiCharType();
+ public static readonly NullableType XmlDoc = new XmlDocType();
+
/// <summary>
/// A NHibernate persistent enum type
/// </summary>
Added: trunk/nhibernate/src/NHibernate/SqlTypes/XmlSqlType.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/SqlTypes/XmlSqlType.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/SqlTypes/XmlSqlType.cs 2010-09-19 20:17:12 UTC (rev 5192)
@@ -0,0 +1,18 @@
+using System;
+using System.Data;
+
+namespace NHibernate.SqlTypes
+{
+ [Serializable]
+ public class XmlSqlType : SqlType
+ {
+ public XmlSqlType()
+ : base(DbType.Xml)
+ {
+ }
+
+ public XmlSqlType(int length) : base(DbType.Xml, length)
+ {
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/Type/TypeFactory.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Type/TypeFactory.cs 2010-09-19 12:31:31 UTC (rev 5191)
+++ trunk/nhibernate/src/NHibernate/Type/TypeFactory.cs 2010-09-19 20:17:12 UTC (rev 5192)
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Globalization;
using System.Reflection;
+using System.Xml;
using NHibernate.Bytecode;
using NHibernate.Classic;
using NHibernate.Engine;
@@ -205,6 +206,9 @@
RegisterType(typeof (UInt16), NHibernateUtil.UInt16, new[] {"ushort"});
RegisterType(typeof (UInt32), NHibernateUtil.UInt32, new[] {"uint"});
RegisterType(typeof (UInt64), NHibernateUtil.UInt64, new[] {"ulong"});
+
+ RegisterType(typeof (XmlDocument), NHibernateUtil.XmlDoc, new[] {"xmldoc", "xmldocument", "xml"});
+
// object needs to have both class and serializable setup before it can
// be created.
RegisterType(typeof (Object), NHibernateUtil.Object, new[] {"object"});
Added: trunk/nhibernate/src/NHibernate/Type/XmlDocType.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Type/XmlDocType.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/Type/XmlDocType.cs 2010-09-19 20:17:12 UTC (rev 5192)
@@ -0,0 +1,86 @@
+using System;
+using System.Data;
+using System.Xml;
+using NHibernate.SqlTypes;
+
+namespace NHibernate.Type
+{
+ [Serializable]
+ public class XmlDocType : MutableType
+ {
+ public XmlDocType()
+ : base(new XmlSqlType())
+ {
+ }
+
+
+ public XmlDocType(SqlType sqlType) : base(sqlType)
+ {
+ }
+
+ public override string Name
+ {
+ get { return "XmlDoc"; }
+ }
+
+ public override System.Type ReturnedClass
+ {
+ get { return typeof (XmlDocument); }
+ }
+
+ public override void Set(IDbCommand cmd, object value, int index)
+ {
+ ((IDataParameter) cmd.Parameters[index]).Value = ((XmlDocument) value).OuterXml;
+ }
+
+ public override object Get(IDataReader rs, int index)
+ {
+ // according to documentation, GetValue should return a string, at list for MsSQL
+ // hopefully all DataProvider has the same behaviour
+ string xmlString = Convert.ToString(rs.GetValue(index));
+ return FromStringValue(xmlString);
+ }
+
+ public override object Get(IDataReader rs, string name)
+ {
+ return Get(rs, rs.GetOrdinal(name));
+ }
+
+ public override string ToString(object val)
+ {
+ return val == null ? null : ((XmlDocument) val).OuterXml;
+ }
+
+ public override object FromStringValue(string xml)
+ {
+ if (xml != null)
+ {
+ var xmlDocument = new XmlDocument();
+ xmlDocument.LoadXml(xml);
+ return xmlDocument;
+ }
+ return null;
+ }
+
+ public override object DeepCopyNotNull(object value)
+ {
+ var original = (XmlDocument) value;
+ var copy = new XmlDocument();
+ copy.LoadXml(original.OuterXml);
+ return copy;
+ }
+
+ public override bool IsEqual(object x, object y)
+ {
+ if (x == null && y == null)
+ {
+ return true;
+ }
+ if (x == null || y == null)
+ {
+ return false;
+ }
+ return ((XmlDocument) x).OuterXml == ((XmlDocument) y).OuterXml;
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-09-19 12:31:31 UTC (rev 5191)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-09-19 20:17:12 UTC (rev 5192)
@@ -491,6 +491,8 @@
<Compile Include="TypesTest\DateTimeClass.cs" />
<Compile Include="TypesTest\LocalDateTimeTypeFixture.cs" />
<Compile Include="TypesTest\UtcDateTimeTypeFixture.cs" />
+ <Compile Include="TypesTest\XmlDocClass.cs" />
+ <Compile Include="TypesTest\XmlDocTypeFixture.cs" />
<Compile Include="UtilityTest\ReflectionHelperIsMethodOfTests.cs" />
<Compile Include="UtilityTest\ReflectionHelperTest.cs" />
<Compile Include="Linq\RegresstionTests.cs" />
@@ -2277,6 +2279,7 @@
<EmbeddedResource Include="CollectionTest\NullableValueTypeElementMapFixture.hbm.xml" />
<EmbeddedResource Include="DriverTest\EntityForMs2008.hbm.xml" />
<Content Include="DynamicEntity\package.html" />
+ <EmbeddedResource Include="TypesTest\XmlDocClass.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2302\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2303\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2287\Mappings.hbm.xml" />
@@ -2610,10 +2613,6 @@
<EmbeddedResource Include="DynamicEntity\Tuplizer\Customer.hbm.xml" />
</ItemGroup>
<ItemGroup>
- <Folder Include="NHSpecificTest\NH2111" />
- <Folder Include="NHSpecificTest\NH2278" />
- <Folder Include="NHSpecificTest\NH2279" />
- <Folder Include="NHSpecificTest\NH2322" />
<Folder Include="Properties\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
Added: trunk/nhibernate/src/NHibernate.Test/TypesTest/XmlDocClass.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/TypesTest/XmlDocClass.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/TypesTest/XmlDocClass.cs 2010-09-19 20:17:12 UTC (rev 5192)
@@ -0,0 +1,11 @@
+using System.Xml;
+
+namespace NHibernate.Test.TypesTest
+{
+ public class XmlDocClass
+ {
+ public int Id { get; set; }
+ public XmlDocument Document { get; set; }
+ public XmlDocument AutoDocument { get; set; }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/TypesTest/XmlDocClass.hbm.xml
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/TypesTest/XmlDocClass.hbm.xml (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/TypesTest/XmlDocClass.hbm.xml 2010-09-19 20:17:12 UTC (rev 5192)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="false">
+ <class name="NHibernate.Test.TypesTest.XmlDocClass, NHibernate.Test" table="nh_xmldoc">
+ <id name="Id" column="id">
+ <generator class="assigned" />
+ </id>
+
+ <property name="Document" type="XmlDoc" />
+ <property name="AutoDocument" />
+ </class>
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/TypesTest/XmlDocTypeFixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/TypesTest/XmlDocTypeFixture.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/TypesTest/XmlDocTypeFixture.cs 2010-09-19 20:17:12 UTC (rev 5192)
@@ -0,0 +1,76 @@
+using System.Xml;
+using NHibernate.Type;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.TypesTest
+{
+ public class XmlDocTypeFixture : TypeFixtureBase
+ {
+ protected override string TypeName
+ {
+ get { return "XmlDoc"; }
+ }
+
+ [Test]
+ public void ReadWrite()
+ {
+ using (var s = OpenSession())
+ {
+ var docEntity = new XmlDocClass {Id = 1 };
+ docEntity.Document = new XmlDocument();
+ docEntity.Document.LoadXml("<MyNode>my Text</MyNode>");
+ s.Save(docEntity);
+ s.Flush();
+ }
+
+ using (var s = OpenSession())
+ {
+ var docEntity = s.Get<XmlDocClass>(1);
+ var document = docEntity.Document;
+ document.Should().Not.Be.Null();
+ document.OuterXml.Should().Contain("<MyNode>my Text</MyNode>");
+ var xmlElement = document.CreateElement("Pizza");
+ xmlElement.SetAttribute("temp", "calda");
+ document.FirstChild.AppendChild(xmlElement);
+ s.Save(docEntity);
+ s.Flush();
+ }
+ using (var s = OpenSession())
+ {
+ var docEntity = s.Get<XmlDocClass>(1);
+ docEntity.Document.OuterXml.Should().Contain("Pizza temp=\"calda\"");
+ s.Delete(docEntity);
+ s.Flush();
+ }
+ }
+
+ [Test]
+ public void InsertNullValue()
+ {
+ using (ISession s = OpenSession())
+ {
+ var docEntity = new XmlDocClass { Id = 1 };
+ docEntity.Document = null;
+ s.Save(docEntity);
+ s.Flush();
+ }
+
+ using (ISession s = OpenSession())
+ {
+ var docEntity = s.Get<XmlDocClass>(1);
+ docEntity.Document.Should().Be.Null();
+ s.Delete(docEntity);
+ s.Flush();
+ }
+ }
+
+ [Test]
+ public void AutoDiscoverFromNetType()
+ {
+ // integration test to be 100% sure
+ var propertyType = sessions.GetEntityPersister(typeof (XmlDocClass).FullName).GetPropertyType("AutoDocument");
+ propertyType.Should().Be.InstanceOf<XmlDocType>();
+ }
+ }
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jul...@us...> - 2010-09-21 15:00:26
|
Revision: 5198
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5198&view=rev
Author: julian-maughan
Date: 2010-09-21 15:00:19 +0000 (Tue, 21 Sep 2010)
Log Message:
-----------
Port of HHH-4545 - Allow IExecutable to register for before or after transaction completion callbacks. Note that the Hibernate revision affects a lot more files because of an errant find/replace.
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Action/BulkOperationCleanupAction.cs
trunk/nhibernate/src/NHibernate/Action/CollectionAction.cs
trunk/nhibernate/src/NHibernate/Action/CollectionUpdateAction.cs
trunk/nhibernate/src/NHibernate/Action/EntityAction.cs
trunk/nhibernate/src/NHibernate/Action/EntityDeleteAction.cs
trunk/nhibernate/src/NHibernate/Action/EntityIdentityInsertAction.cs
trunk/nhibernate/src/NHibernate/Action/EntityInsertAction.cs
trunk/nhibernate/src/NHibernate/Action/EntityUpdateAction.cs
trunk/nhibernate/src/NHibernate/Action/IExecutable.cs
trunk/nhibernate/src/NHibernate/Cache/CacheLock.cs
trunk/nhibernate/src/NHibernate/Cache/ICacheConcurrencyStrategy.cs
trunk/nhibernate/src/NHibernate/Cache/NonstrictReadWriteCache.cs
trunk/nhibernate/src/NHibernate/Cache/ReadOnlyCache.cs
trunk/nhibernate/src/NHibernate/Cache/ReadWriteCache.cs
trunk/nhibernate/src/NHibernate/Engine/ActionQueue.cs
trunk/nhibernate/src/NHibernate/Event/Default/AbstractLockUpgradeEventListener.cs
trunk/nhibernate/src/NHibernate/Event/Default/DefaultLoadEventListener.cs
trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs
trunk/nhibernate/src/NHibernate/NHibernate.csproj
trunk/nhibernate/src/NHibernate.Test/CacheTest/CacheFixture.cs
Added Paths:
-----------
trunk/nhibernate/src/NHibernate/Cache/Access/
trunk/nhibernate/src/NHibernate/Cache/Access/ISoftLock.cs
Removed Paths:
-------------
trunk/nhibernate/src/NHibernate/Cache/ISoftLock.cs
Modified: trunk/nhibernate/src/NHibernate/Action/BulkOperationCleanupAction.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Action/BulkOperationCleanupAction.cs 2010-09-20 15:13:25 UTC (rev 5197)
+++ trunk/nhibernate/src/NHibernate/Action/BulkOperationCleanupAction.cs 2010-09-21 15:00:19 UTC (rev 5198)
@@ -112,15 +112,24 @@
// nothing to do
}
- public bool HasAfterTransactionCompletion()
+ public BeforeTransactionCompletionProcessDelegate BeforeTransactionCompletionProcess
{
- return true;
+ get
+ {
+ return null;
+ }
}
- public void AfterTransactionCompletion(bool success)
+ public AfterTransactionCompletionProcessDelegate AfterTransactionCompletionProcess
{
- EvictEntityRegions();
- EvictCollectionRegions();
+ get
+ {
+ return new AfterTransactionCompletionProcessDelegate((success) =>
+ {
+ this.EvictEntityRegions();
+ this.EvictCollectionRegions();
+ });
+ }
}
private void EvictCollectionRegions()
@@ -136,7 +145,7 @@
private void EvictEntityRegions()
{
- if(affectedEntityNames!=null)
+ if (affectedEntityNames != null)
{
foreach (string entityName in affectedEntityNames)
{
Modified: trunk/nhibernate/src/NHibernate/Action/CollectionAction.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Action/CollectionAction.cs 2010-09-20 15:13:25 UTC (rev 5197)
+++ trunk/nhibernate/src/NHibernate/Action/CollectionAction.cs 2010-09-21 15:00:19 UTC (rev 5198)
@@ -1,6 +1,7 @@
using System;
using System.Runtime.Serialization;
using NHibernate.Cache;
+using NHibernate.Cache.Access;
using NHibernate.Collection;
using NHibernate.Engine;
using NHibernate.Impl;
@@ -100,30 +101,32 @@
}
}
- /// <summary> Execute this action</summary>
+ /// <summary>Execute this action</summary>
public abstract void Execute();
- /// <summary>
- /// Do we need to retain this instance until after the transaction completes?
- /// </summary>
- /// <returns>
- /// False if this class defines a no-op has after transaction completion.
- /// </returns>
- public bool HasAfterTransactionCompletion()
+ public virtual BeforeTransactionCompletionProcessDelegate BeforeTransactionCompletionProcess
{
- return persister.HasCache;
+ get
+ {
+ return null;
+ }
}
- /// <summary> Called after the transaction completes</summary>
- public virtual void AfterTransactionCompletion(bool success)
+ public virtual AfterTransactionCompletionProcessDelegate AfterTransactionCompletionProcess
{
- if (persister.HasCache)
+ get
{
- CacheKey ck = new CacheKey(key, persister.KeyType, persister.Role, session.EntityMode, session.Factory);
- persister.Cache.Release(ck, softLock);
+ return new AfterTransactionCompletionProcessDelegate((success) =>
+ {
+ if (persister.HasCache)
+ {
+ CacheKey ck = new CacheKey(key, persister.KeyType, persister.Role, Session.EntityMode, Session.Factory);
+ persister.Cache.Release(ck, softLock);
+ }
+ });
}
}
-
+
#endregion
public ISoftLock Lock
Modified: trunk/nhibernate/src/NHibernate/Action/CollectionUpdateAction.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Action/CollectionUpdateAction.cs 2010-09-20 15:13:25 UTC (rev 5197)
+++ trunk/nhibernate/src/NHibernate/Action/CollectionUpdateAction.cs 2010-09-21 15:00:19 UTC (rev 5198)
@@ -113,32 +113,46 @@
}
}
- public override void AfterTransactionCompletion(bool success)
+ public override BeforeTransactionCompletionProcessDelegate BeforeTransactionCompletionProcess
{
- // NH Different behavior: to support unlocking collections from the cache.(r3260)
- if (Persister.HasCache)
+ get
+ {
+ return null;
+ }
+ }
+
+ public override AfterTransactionCompletionProcessDelegate AfterTransactionCompletionProcess
+ {
+ get
{
- CacheKey ck = new CacheKey(Key, Persister.KeyType, Persister.Role, Session.EntityMode, Session.Factory);
-
- if (success)
+ return new AfterTransactionCompletionProcessDelegate((success) =>
{
- // we can't disassemble a collection if it was uninitialized
- // or detached from the session
- if (Collection.WasInitialized && Session.PersistenceContext.ContainsCollection(Collection))
+ // NH Different behavior: to support unlocking collections from the cache.(r3260)
+ if (Persister.HasCache)
{
- CollectionCacheEntry entry = new CollectionCacheEntry(Collection, Persister);
- bool put = Persister.Cache.AfterUpdate(ck, entry, null, Lock);
+ CacheKey ck = new CacheKey(Key, Persister.KeyType, Persister.Role, Session.EntityMode, Session.Factory);
- if (put && Session.Factory.Statistics.IsStatisticsEnabled)
+ if (success)
{
- Session.Factory.StatisticsImplementor.SecondLevelCachePut(Persister.Cache.RegionName);
+ // we can't disassemble a collection if it was uninitialized
+ // or detached from the session
+ if (Collection.WasInitialized && Session.PersistenceContext.ContainsCollection(Collection))
+ {
+ CollectionCacheEntry entry = new CollectionCacheEntry(Collection, Persister);
+ bool put = Persister.Cache.AfterUpdate(ck, entry, null, Lock);
+
+ if (put && Session.Factory.Statistics.IsStatisticsEnabled)
+ {
+ Session.Factory.StatisticsImplementor.SecondLevelCachePut(Persister.Cache.RegionName);
+ }
+ }
}
+ else
+ {
+ Persister.Cache.Release(ck, Lock);
+ }
}
- }
- else
- {
- Persister.Cache.Release(ck, Lock);
- }
+ });
}
}
}
Modified: trunk/nhibernate/src/NHibernate/Action/EntityAction.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Action/EntityAction.cs 2010-09-20 15:13:25 UTC (rev 5197)
+++ trunk/nhibernate/src/NHibernate/Action/EntityAction.cs 2010-09-21 15:00:19 UTC (rev 5198)
@@ -102,13 +102,37 @@
public abstract void Execute();
- public bool HasAfterTransactionCompletion()
+ public virtual BeforeTransactionCompletionProcessDelegate BeforeTransactionCompletionProcess
{
+ get
+ {
+ return new BeforeTransactionCompletionProcessDelegate(BeforeTransactionCompletionProcessImpl);
+ }
+ }
+
+ public virtual AfterTransactionCompletionProcessDelegate AfterTransactionCompletionProcess
+ {
+ get
+ {
+ return NeedsAfterTransactionCompletion()
+ ? new AfterTransactionCompletionProcessDelegate(AfterTransactionCompletionProcessImpl)
+ : null;
+ }
+ }
+
+ private bool NeedsAfterTransactionCompletion()
+ {
return persister.HasCache || HasPostCommitEventListeners;
}
+
+ protected virtual void BeforeTransactionCompletionProcessImpl()
+ {
+ }
+
+ protected virtual void AfterTransactionCompletionProcessImpl(bool success)
+ {
+ }
- public abstract void AfterTransactionCompletion(bool success);
-
#endregion
#region IComparable<EntityAction> Members
Modified: trunk/nhibernate/src/NHibernate/Action/EntityDeleteAction.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Action/EntityDeleteAction.cs 2010-09-20 15:13:25 UTC (rev 5197)
+++ trunk/nhibernate/src/NHibernate/Action/EntityDeleteAction.cs 2010-09-21 15:00:19 UTC (rev 5198)
@@ -1,6 +1,7 @@
using System;
using System.Diagnostics;
using NHibernate.Cache;
+using NHibernate.Cache.Access;
using NHibernate.Engine;
using NHibernate.Event;
using NHibernate.Persister.Entity;
@@ -125,8 +126,8 @@
}
return veto;
}
-
- public override void AfterTransactionCompletion(bool success)
+
+ protected override void AfterTransactionCompletionProcessImpl(bool success)
{
if (Persister.HasCache)
{
Modified: trunk/nhibernate/src/NHibernate/Action/EntityIdentityInsertAction.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Action/EntityIdentityInsertAction.cs 2010-09-20 15:13:25 UTC (rev 5197)
+++ trunk/nhibernate/src/NHibernate/Action/EntityIdentityInsertAction.cs 2010-09-21 15:00:19 UTC (rev 5198)
@@ -82,7 +82,6 @@
persister.SetIdentifier(instance, generatedId, Session.EntityMode);
}
-
//TODO from H3.2 : this bit actually has to be called after all cascades!
// but since identity insert is called *synchronously*,
// instead of asynchronously as other actions, it isn't
@@ -144,9 +143,9 @@
return veto;
}
- //Make 100% certain that this is called before any subsequent ScheduledUpdate.afterTransactionCompletion()!!
- public override void AfterTransactionCompletion(bool success)
+ protected override void AfterTransactionCompletionProcessImpl(bool success)
{
+ //TODO Make 100% certain that this is called before any subsequent ScheduledUpdate.afterTransactionCompletion()!!
//TODO from H3.2: reenable if we also fix the above todo
/*EntityPersister persister = getEntityPersister();
if ( success && persister.hasCache() && !persister.isCacheInvalidationRequired() ) {
Modified: trunk/nhibernate/src/NHibernate/Action/EntityInsertAction.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Action/EntityInsertAction.cs 2010-09-20 15:13:25 UTC (rev 5197)
+++ trunk/nhibernate/src/NHibernate/Action/EntityInsertAction.cs 2010-09-21 15:00:19 UTC (rev 5198)
@@ -102,7 +102,7 @@
}
}
- public override void AfterTransactionCompletion(bool success)
+ protected override void AfterTransactionCompletionProcessImpl(bool success)
{
//Make 100% certain that this is called before any subsequent ScheduledUpdate.afterTransactionCompletion()!!
IEntityPersister persister = Persister;
Modified: trunk/nhibernate/src/NHibernate/Action/EntityUpdateAction.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Action/EntityUpdateAction.cs 2010-09-20 15:13:25 UTC (rev 5197)
+++ trunk/nhibernate/src/NHibernate/Action/EntityUpdateAction.cs 2010-09-21 15:00:19 UTC (rev 5198)
@@ -1,6 +1,7 @@
using System;
using System.Diagnostics;
using NHibernate.Cache;
+using NHibernate.Cache.Access;
using NHibernate.Cache.Entry;
using NHibernate.Engine;
using NHibernate.Event;
@@ -134,7 +135,7 @@
}
}
- public override void AfterTransactionCompletion(bool success)
+ protected override void AfterTransactionCompletionProcessImpl(bool success)
{
IEntityPersister persister = Persister;
if (persister.HasCache)
@@ -160,7 +161,7 @@
PostCommitUpdate();
}
}
-
+
private void PostUpdate()
{
IPostUpdateEventListener[] postListeners = Session.Listeners.PostUpdateEventListeners;
Modified: trunk/nhibernate/src/NHibernate/Action/IExecutable.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Action/IExecutable.cs 2010-09-20 15:13:25 UTC (rev 5197)
+++ trunk/nhibernate/src/NHibernate/Action/IExecutable.cs 2010-09-21 15:00:19 UTC (rev 5198)
@@ -1,6 +1,29 @@
+using NHibernate.Engine;
+
namespace NHibernate.Action
{
/// <summary>
+ /// Delegate representing some process that needs to occur before transaction completion.
+ /// </summary>
+ /// <remarks>
+ /// NH specific: C# does not support dynamic interface proxies so a delegate is used in
+ /// place of the Hibernate interface (see Action/BeforeTransactionCompletionProcess). The
+ /// delegate omits the <see cref="ISessionImplementor" /> parameter as it is not used.
+ /// </remarks>
+ public delegate void BeforeTransactionCompletionProcessDelegate();
+
+ /// <summary>
+ /// Delegate representing some process that needs to occur after transaction completion.
+ /// </summary>
+ /// <param name="success"> Did the transaction complete successfully? True means it did.</param>
+ /// <remarks>
+ /// NH specific: C# does not support dynamic interface proxies so a delegate is used in
+ /// place of the Hibernate interface (see Action/AfterTransactionCompletionProcess). The
+ /// delegate omits the <see cref="ISessionImplementor" /> parameter as it is not used.
+ /// </remarks>
+ public delegate void AfterTransactionCompletionProcessDelegate(bool success);
+
+ /// <summary>
/// An operation which may be scheduled for later execution.
/// Usually, the operation is a database insert/update/delete,
/// together with required second-level cache management.
@@ -10,7 +33,7 @@
/// <summary>
/// What spaces (tables) are affected by this action?
/// </summary>
- string[] PropertySpaces { get;}
+ string[] PropertySpaces { get; }
/// <summary> Called before executing any actions</summary>
void BeforeExecutions();
@@ -18,15 +41,14 @@
/// <summary> Execute this action</summary>
void Execute();
- /// <summary>
- /// Do we need to retain this instance until after the transaction completes?
+ /// <summary>
+ /// Get the before-transaction-completion process, if any, for this action.
/// </summary>
- /// <returns>
- /// False if this class defines a no-op has after transaction completion.
- /// </returns>
- bool HasAfterTransactionCompletion();
-
- /// <summary> Called after the transaction completes</summary>
- void AfterTransactionCompletion(bool success);
+ BeforeTransactionCompletionProcessDelegate BeforeTransactionCompletionProcess { get; }
+
+ /// <summary>
+ /// Get the after-transaction-completion process, if any, for this action.
+ /// </summary>
+ AfterTransactionCompletionProcessDelegate AfterTransactionCompletionProcess { get; }
}
}
Property changes on: trunk/nhibernate/src/NHibernate/Cache/Access
___________________________________________________________________
Added: bugtraq:url
+ http://jira.nhibernate.org/browse/%BUGID%
Added: bugtraq:logregex
+ NH-\d+
Copied: trunk/nhibernate/src/NHibernate/Cache/Access/ISoftLock.cs (from rev 5197, trunk/nhibernate/src/NHibernate/Cache/ISoftLock.cs)
===================================================================
--- trunk/nhibernate/src/NHibernate/Cache/Access/ISoftLock.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/Cache/Access/ISoftLock.cs 2010-09-21 15:00:19 UTC (rev 5198)
@@ -0,0 +1,11 @@
+using System;
+
+namespace NHibernate.Cache.Access
+{
+ /// <summary>
+ /// Marker interface, denoting a client-visible "soft lock" on a cached item.
+ /// </summary>
+ public interface ISoftLock
+ {
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/Cache/CacheLock.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cache/CacheLock.cs 2010-09-20 15:13:25 UTC (rev 5197)
+++ trunk/nhibernate/src/NHibernate/Cache/CacheLock.cs 2010-09-21 15:00:19 UTC (rev 5198)
@@ -1,5 +1,6 @@
using System;
using System.Collections;
+using NHibernate.Cache.Access;
namespace NHibernate.Cache
{
Modified: trunk/nhibernate/src/NHibernate/Cache/ICacheConcurrencyStrategy.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cache/ICacheConcurrencyStrategy.cs 2010-09-20 15:13:25 UTC (rev 5197)
+++ trunk/nhibernate/src/NHibernate/Cache/ICacheConcurrencyStrategy.cs 2010-09-21 15:00:19 UTC (rev 5198)
@@ -1,4 +1,5 @@
using System.Collections;
+using NHibernate.Cache.Access;
using NHibernate.Cache.Entry;
namespace NHibernate.Cache
Deleted: trunk/nhibernate/src/NHibernate/Cache/ISoftLock.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cache/ISoftLock.cs 2010-09-20 15:13:25 UTC (rev 5197)
+++ trunk/nhibernate/src/NHibernate/Cache/ISoftLock.cs 2010-09-21 15:00:19 UTC (rev 5198)
@@ -1,11 +0,0 @@
-using System;
-
-namespace NHibernate.Cache
-{
- /// <summary>
- /// Marker interface, denoting a client-visible "soft lock" on a cached item.
- /// </summary>
- public interface ISoftLock
- {
- }
-}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/Cache/NonstrictReadWriteCache.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cache/NonstrictReadWriteCache.cs 2010-09-20 15:13:25 UTC (rev 5197)
+++ trunk/nhibernate/src/NHibernate/Cache/NonstrictReadWriteCache.cs 2010-09-21 15:00:19 UTC (rev 5198)
@@ -1,7 +1,7 @@
using System;
using System.Collections;
+using NHibernate.Cache.Access;
-
namespace NHibernate.Cache
{
/// <summary>
Modified: trunk/nhibernate/src/NHibernate/Cache/ReadOnlyCache.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cache/ReadOnlyCache.cs 2010-09-20 15:13:25 UTC (rev 5197)
+++ trunk/nhibernate/src/NHibernate/Cache/ReadOnlyCache.cs 2010-09-21 15:00:19 UTC (rev 5198)
@@ -1,7 +1,7 @@
using System;
using System.Collections;
+using NHibernate.Cache.Access;
-
namespace NHibernate.Cache
{
/// <summary>
Modified: trunk/nhibernate/src/NHibernate/Cache/ReadWriteCache.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cache/ReadWriteCache.cs 2010-09-20 15:13:25 UTC (rev 5197)
+++ trunk/nhibernate/src/NHibernate/Cache/ReadWriteCache.cs 2010-09-21 15:00:19 UTC (rev 5198)
@@ -1,7 +1,7 @@
using System;
using System.Collections;
+using NHibernate.Cache.Access;
-
namespace NHibernate.Cache
{
/// <summary>
Modified: trunk/nhibernate/src/NHibernate/Engine/ActionQueue.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Engine/ActionQueue.cs 2010-09-20 15:13:25 UTC (rev 5197)
+++ trunk/nhibernate/src/NHibernate/Engine/ActionQueue.cs 2010-09-21 15:00:19 UTC (rev 5198)
@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
+using System.Linq;
using System.Text;
using Iesi.Collections.Generic;
@@ -39,7 +40,8 @@
private readonly List<CollectionUpdateAction> collectionUpdates;
private readonly List<CollectionRemoveAction> collectionRemovals;
- private readonly List<IExecutable> executions;
+ private readonly AfterTransactionCompletionProcessQueue afterTransactionProcesses;
+ private readonly BeforeTransactionCompletionProcessQueue beforeTransactionProcesses;
public ActionQueue(ISessionImplementor session)
{
@@ -52,7 +54,8 @@
collectionUpdates = new List<CollectionUpdateAction>(InitQueueListSize);
collectionRemovals = new List<CollectionRemoveAction>(InitQueueListSize);
- executions = new List<IExecutable>(InitQueueListSize * 3);
+ afterTransactionProcesses = new AfterTransactionCompletionProcessQueue(session);
+ beforeTransactionProcesses = new BeforeTransactionCompletionProcessQueue(session);
}
public virtual void Clear()
@@ -103,10 +106,19 @@
public void AddAction(BulkOperationCleanupAction cleanupAction)
{
- // Add these directly to the executions queue
- executions.Add(cleanupAction);
+ RegisterCleanupActions(cleanupAction);
}
-
+
+ public void RegisterProcess(AfterTransactionCompletionProcessDelegate process)
+ {
+ afterTransactionProcesses.Register(process);
+ }
+
+ public void RegisterProcess(BeforeTransactionCompletionProcessDelegate process)
+ {
+ beforeTransactionProcesses.Register(process);
+ }
+
private void ExecuteActions(IList list)
{
int size = list.Count;
@@ -119,17 +131,27 @@
public void Execute(IExecutable executable)
{
- bool lockQueryCache = session.Factory.Settings.IsQueryCacheEnabled;
- if (executable.HasAfterTransactionCompletion() || lockQueryCache)
+ try
{
- executions.Add(executable);
+ executable.Execute();
}
- if (lockQueryCache)
+ finally
{
- session.Factory.UpdateTimestampsCache.PreInvalidate(executable.PropertySpaces);
+ RegisterCleanupActions(executable);
}
- executable.Execute();
}
+
+ private void RegisterCleanupActions(IExecutable executable)
+ {
+ beforeTransactionProcesses.Register(executable.BeforeTransactionCompletionProcess);
+ if (session.Factory.Settings.IsQueryCacheEnabled)
+ {
+ string[] spaces = executable.PropertySpaces;
+ afterTransactionProcesses.AddSpacesToInvalidate(spaces);
+ session.Factory.UpdateTimestampsCache.PreInvalidate(spaces);
+ }
+ afterTransactionProcesses.Register(executable.AfterTransactionCompletionProcess);
+ }
/// <summary>
/// Perform all currently queued entity-insertion actions.
@@ -168,42 +190,23 @@
PrepareActions(collectionCreations);
}
+ /// <summary>
+ /// Execute any registered <see cref="BeforeTransactionCompletionProcessDelegate" />
+ /// </summary>
+ public void BeforeTransactionCompletion()
+ {
+ beforeTransactionProcesses.BeforeTransactionCompletion();
+ }
+
/// <summary>
/// Performs cleanup of any held cache softlocks.
/// </summary>
/// <param name="success">Was the transaction successful.</param>
public void AfterTransactionCompletion(bool success)
{
- bool invalidateQueryCache = session.Factory.Settings.IsQueryCacheEnabled;
- foreach (IExecutable exec in executions)
- {
- try
- {
- try
- {
- exec.AfterTransactionCompletion(success);
- }
- finally
- {
- if (invalidateQueryCache)
- {
- session.Factory.UpdateTimestampsCache.Invalidate(exec.PropertySpaces);
- }
- }
- }
- catch (CacheException ce)
- {
- log.Error("could not release a cache lock", ce);
- // continue loop
- }
- catch (Exception e)
- {
- throw new HibernateException("Exception releasing cache locks", e);
- }
- }
- executions.Clear();
+ afterTransactionProcesses.AfterTransactionCompletion(success);
}
-
+
/// <summary>
/// Check whether the given tables/query-spaces are to be executed against
/// given the currently queued actions.
@@ -212,12 +215,13 @@
/// <returns> True if we contain pending actions against any of the given tables; false otherwise.</returns>
public virtual bool AreTablesToBeUpdated(ISet<string> tables)
{
- return AreTablesToUpdated(updates, tables) ||
- AreTablesToUpdated(insertions, tables) ||
- AreTablesToUpdated(deletions, tables) ||
- AreTablesToUpdated(collectionUpdates, tables) ||
- AreTablesToUpdated(collectionCreations, tables) ||
- AreTablesToUpdated(collectionRemovals, tables);
+ return
+ AreTablesToUpdated(updates, tables)
+ || AreTablesToUpdated(insertions, tables)
+ || AreTablesToUpdated(deletions, tables)
+ || AreTablesToUpdated(collectionUpdates, tables)
+ || AreTablesToUpdated(collectionCreations, tables)
+ || AreTablesToUpdated(collectionRemovals, tables);
}
/// <summary>
@@ -407,13 +411,27 @@
}
}
+ public bool HasBeforeTransactionActions()
+ {
+ return beforeTransactionProcesses.HasActions;
+ }
+
+ public bool HasAfterTransactionActions()
+ {
+ return afterTransactionProcesses.HasActions;
+ }
+
public bool HasAnyQueuedActions
{
get
{
return
- updates.Count > 0 || insertions.Count > 0 || deletions.Count > 0 || collectionUpdates.Count > 0
- || collectionRemovals.Count > 0 || collectionCreations.Count > 0;
+ updates.Count > 0
+ || insertions.Count > 0
+ || deletions.Count > 0
+ || collectionUpdates.Count > 0
+ || collectionRemovals.Count > 0
+ || collectionCreations.Count > 0;
}
}
@@ -435,5 +453,127 @@
.Append(collectionUpdates)
.Append("]").ToString();
}
+
+ [Serializable]
+ private class BeforeTransactionCompletionProcessQueue
+ {
+ private ISessionImplementor session;
+ private IList<BeforeTransactionCompletionProcessDelegate> processes = new List<BeforeTransactionCompletionProcessDelegate>();
+
+ public bool HasActions
+ {
+ get { return processes.Count > 0; }
+ }
+
+ public BeforeTransactionCompletionProcessQueue(ISessionImplementor session)
+ {
+ this.session = session;
+ }
+
+ public void Register(BeforeTransactionCompletionProcessDelegate process)
+ {
+ if (process == null)
+ {
+ return;
+ }
+ processes.Add(process);
+ }
+
+ public void BeforeTransactionCompletion()
+ {
+ int size = processes.Count;
+ for (int i = 0; i < size; i++)
+ {
+ try
+ {
+ BeforeTransactionCompletionProcessDelegate process = processes[i];
+ process();
+ }
+ catch (HibernateException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new AssertionFailure("Unable to perform BeforeTransactionCompletion callback", e);
+ }
+ }
+ processes.Clear();
+ }
+ }
+
+ [Serializable]
+ private class AfterTransactionCompletionProcessQueue
+ {
+ private ISessionImplementor session;
+ private ISet<string> querySpacesToInvalidate = new HashedSet<string>();
+ private IList<AfterTransactionCompletionProcessDelegate> processes = new List<AfterTransactionCompletionProcessDelegate>(InitQueueListSize * 3);
+
+ public bool HasActions
+ {
+ get { return processes.Count > 0; }
+ }
+
+ public AfterTransactionCompletionProcessQueue(ISessionImplementor session)
+ {
+ this.session = session;
+ }
+
+ public void AddSpacesToInvalidate(string[] spaces)
+ {
+ if (spaces == null)
+ {
+ return;
+ }
+ for (int i = 0, max = spaces.Length; i < max; i++)
+ {
+ this.AddSpaceToInvalidate(spaces[i]);
+ }
+ }
+
+ public void AddSpaceToInvalidate(string space)
+ {
+ querySpacesToInvalidate.Add(space);
+ }
+
+ public void Register(AfterTransactionCompletionProcessDelegate process)
+ {
+ if (process == null)
+ {
+ return;
+ }
+ processes.Add(process);
+ }
+
+ public void AfterTransactionCompletion(bool success)
+ {
+ int size = processes.Count;
+
+ for (int i = 0; i < size; i++)
+ {
+ try
+ {
+ AfterTransactionCompletionProcessDelegate process = processes[i];
+ process(success);
+ }
+ catch (CacheException e)
+ {
+ log.Error( "could not release a cache lock", e);
+ // continue loop
+ }
+ catch (Exception e)
+ {
+ throw new AssertionFailure("Exception releasing cache locks", e);
+ }
+ }
+ processes.Clear();
+
+ if (session.Factory.Settings.IsQueryCacheEnabled)
+ {
+ session.Factory.UpdateTimestampsCache.Invalidate(querySpacesToInvalidate.ToArray());
+ }
+ querySpacesToInvalidate.Clear();
+ }
+ }
}
}
Modified: trunk/nhibernate/src/NHibernate/Event/Default/AbstractLockUpgradeEventListener.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Event/Default/AbstractLockUpgradeEventListener.cs 2010-09-20 15:13:25 UTC (rev 5197)
+++ trunk/nhibernate/src/NHibernate/Event/Default/AbstractLockUpgradeEventListener.cs 2010-09-21 15:00:19 UTC (rev 5198)
@@ -1,6 +1,7 @@
using System;
using NHibernate.Cache;
+using NHibernate.Cache.Access;
using NHibernate.Engine;
using NHibernate.Impl;
using NHibernate.Persister.Entity;
Modified: trunk/nhibernate/src/NHibernate/Event/Default/DefaultLoadEventListener.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Event/Default/DefaultLoadEventListener.cs 2010-09-20 15:13:25 UTC (rev 5197)
+++ trunk/nhibernate/src/NHibernate/Event/Default/DefaultLoadEventListener.cs 2010-09-21 15:00:19 UTC (rev 5198)
@@ -2,6 +2,7 @@
using System.Diagnostics;
using NHibernate.Cache;
+using NHibernate.Cache.Access;
using NHibernate.Cache.Entry;
using NHibernate.Engine;
using NHibernate.Impl;
Modified: trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs 2010-09-20 15:13:25 UTC (rev 5197)
+++ trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs 2010-09-21 15:00:19 UTC (rev 5198)
@@ -2278,6 +2278,7 @@
using (new SessionIdLoggingContext(SessionId))
{
log.Debug("before transaction completion");
+ actionQueue.BeforeTransactionCompletion();
if (rootSession == null)
{
try
Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj
================================================...
[truncated message content] |