You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(248) |
May
(82) |
Jun
(90) |
Jul
(177) |
Aug
(253) |
Sep
(157) |
Oct
(151) |
Nov
(143) |
Dec
(278) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(152) |
Feb
(107) |
Mar
(177) |
Apr
(133) |
May
(259) |
Jun
(81) |
Jul
(119) |
Aug
(306) |
Sep
(416) |
Oct
(240) |
Nov
(329) |
Dec
(206) |
2006 |
Jan
(466) |
Feb
(382) |
Mar
(153) |
Apr
(162) |
May
(133) |
Jun
(21) |
Jul
(18) |
Aug
(37) |
Sep
(97) |
Oct
(114) |
Nov
(110) |
Dec
(28) |
2007 |
Jan
(74) |
Feb
(65) |
Mar
(49) |
Apr
(76) |
May
(43) |
Jun
(15) |
Jul
(68) |
Aug
(55) |
Sep
(63) |
Oct
(59) |
Nov
(70) |
Dec
(66) |
2008 |
Jan
(71) |
Feb
(60) |
Mar
(120) |
Apr
(31) |
May
(48) |
Jun
(81) |
Jul
(107) |
Aug
(51) |
Sep
(80) |
Oct
(83) |
Nov
(83) |
Dec
(79) |
2009 |
Jan
(83) |
Feb
(110) |
Mar
(97) |
Apr
(91) |
May
(291) |
Jun
(250) |
Jul
(197) |
Aug
(58) |
Sep
(54) |
Oct
(122) |
Nov
(68) |
Dec
(34) |
2010 |
Jan
(50) |
Feb
(17) |
Mar
(63) |
Apr
(61) |
May
(84) |
Jun
(81) |
Jul
(138) |
Aug
(144) |
Sep
(78) |
Oct
(26) |
Nov
(30) |
Dec
(61) |
2011 |
Jan
(33) |
Feb
(35) |
Mar
(166) |
Apr
(221) |
May
(109) |
Jun
(76) |
Jul
(27) |
Aug
(37) |
Sep
(1) |
Oct
(4) |
Nov
(2) |
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2013 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
(1) |
2014 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ric...@us...> - 2010-09-22 21:01:41
|
Revision: 5203 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5203&view=rev Author: ricbrown Date: 2010-09-22 21:01:34 +0000 (Wed, 22 Sep 2010) Log Message: ----------- Fix NH-2024 (Max results parameter could not provided to sub-query) Pushed QuotedAndParenthesisStringTokenizer up to Dialect base class to share with Oracle. On Oracle, fixes: NHibernate.Test.Criteria.CriteriaQueryTest.SubqueryPagination NHibernate.Test.Criteria.CriteriaQueryTest.SubqueryPaginationOnlyWithFirst NHibernate.Test.NHSpecificTest.NH2251.Fixture.MultiplePagingParametersInSingleQuery Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Criterion/SubqueryExpression.cs trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs trunk/nhibernate/src/NHibernate/Dialect/Oracle8iDialect.cs trunk/nhibernate/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs trunk/nhibernate/src/NHibernate.Test/DialectTest/MsSql2005DialectFixture.cs Modified: trunk/nhibernate/src/NHibernate/Criterion/SubqueryExpression.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Criterion/SubqueryExpression.cs 2010-09-22 20:25:09 UTC (rev 5202) +++ trunk/nhibernate/src/NHibernate/Criterion/SubqueryExpression.cs 2010-09-22 21:01:34 UTC (rev 5203) @@ -68,10 +68,11 @@ 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 firstResults = Loader.Loader.GetFirstRow(parameters.RowSelection); + int maxResults = Loader.Loader.GetMaxOrLimit(factory.Dialect, parameters.RowSelection); + int? offsetParameterIndex = criteriaQuery.CreatePagingParameter(firstResults); int? limitParameterIndex = criteriaQuery.CreatePagingParameter(maxResults); - sql = factory.Dialect.GetLimitString(sql, criteriaImpl.FirstResult, criteriaImpl.MaxResults, offsetParameterIndex, limitParameterIndex); + sql = factory.Dialect.GetLimitString(sql, firstResults, maxResults, offsetParameterIndex, limitParameterIndex); } if (op != null) Modified: trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs 2010-09-22 20:25:09 UTC (rev 5202) +++ trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs 2010-09-22 21:01:34 UTC (rev 5203) @@ -1,10 +1,10 @@ using System; +using System.Collections; using System.Collections.Generic; using System.Data; using System.Data.Common; using System.Text; using Iesi.Collections.Generic; - using NHibernate.Dialect.Function; using NHibernate.Dialect.Lock; using NHibernate.Dialect.Schema; @@ -1337,6 +1337,256 @@ return value ? "1" : "0"; } + protected static void ExtractColumnOrAliasNames(SqlString select, out List<SqlString> columnsOrAliases, + out Dictionary<SqlString, SqlString> aliasToColumn) + { + columnsOrAliases = new List<SqlString>(); + aliasToColumn = new Dictionary<SqlString, SqlString>(); + + IList<SqlString> tokens = new QuotedAndParenthesisStringTokenizer(select).GetTokens(); + int index = 0; + while (index < tokens.Count) + { + SqlString token = tokens[index]; + + int nextTokenIndex = index += 1; + + if (token.StartsWithCaseInsensitive("select")) + continue; + + if (token.StartsWithCaseInsensitive("distinct")) + continue; + + if (token.StartsWithCaseInsensitive(",")) + continue; + + if (token.StartsWithCaseInsensitive("from")) + break; + + // handle composite expressions like "2 * 4 as foo" + while ((nextTokenIndex < tokens.Count) + && (tokens[nextTokenIndex].StartsWithCaseInsensitive("as") == false + && tokens[nextTokenIndex].StartsWithCaseInsensitive("from") == false + && tokens[nextTokenIndex].StartsWithCaseInsensitive(",") == false)) + { + SqlString nextToken = tokens[nextTokenIndex]; + token = token.Append(nextToken); + nextTokenIndex = index += 1; + } + + // if there is no alias, the token and the alias will be the same + SqlString alias = token; + + 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) + { + // 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 (nextTokenIndex + 1 < tokens.Count) + { + 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(alias); + aliasToColumn[alias] = token; + } + } + + /// <summary> + /// This specialized string tokenizier will break a string to tokens, taking + /// into account single quotes, parenthesis and commas and [ ] + /// 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<SqlString> + { + private readonly SqlString original; + + public QuotedAndParenthesisStringTokenizer(SqlString original) + { + this.original = original; + } + + IEnumerator<SqlString> IEnumerable<SqlString>.GetEnumerator() + { + TokenizerState state = TokenizerState.WhiteSpace; + int parenthesisCount = 0; + bool escapeQuote = false; + char quoteType = '\''; + int tokenStart = 0; + int tokenLength = 0; + string originalString = original.ToString(); + + for (int i = 0; i < originalString.Length; i++) + { + char ch = originalString[i]; + switch (state) + { + case TokenizerState.WhiteSpace: + if (ch == '\'') + { + state = TokenizerState.Quoted; + quoteType = '\''; + tokenLength += 1; + } + else if (ch == '"') + { + state = TokenizerState.Quoted; + quoteType = '"'; + tokenLength += 1; + } + else if (ch == ',') + { + yield return new SqlString(","); + tokenStart += 1; + } + else if (ch == '(' || ch == '[') + { + state = TokenizerState.InParenthesis; + tokenLength += 1; + parenthesisCount = 1; + } + else if (char.IsWhiteSpace(ch) == false) + { + state = TokenizerState.Token; + tokenLength += 1; + } + else + { + tokenStart += 1; + } + break; + case TokenizerState.Quoted: + if (escapeQuote) + { + escapeQuote = false; + tokenLength += 1; + } + // handle escaping of ' by using '' or \' + else if (ch == '\\' || (ch == quoteType && i + 1 < originalString.Length && originalString[i + 1] == quoteType)) + { + escapeQuote = true; + tokenLength += 1; + } + else if (ch == quoteType) + { + yield return original.Substring(tokenStart, tokenLength + 1); + tokenStart += tokenLength + 1; + tokenLength = 0; + state = TokenizerState.WhiteSpace; + } + else + { + tokenLength += 1; + } + break; + case TokenizerState.InParenthesis: + if (ch == ')' || ch == ']') + { + tokenLength += 1; + parenthesisCount -= 1; + if (parenthesisCount == 0) + { + yield return original.Substring(tokenStart, tokenLength); + tokenStart += tokenLength; + tokenLength = 0; + state = TokenizerState.WhiteSpace; + } + } + else if (ch == '(' || ch == '[') + { + tokenLength += 1; + parenthesisCount += 1; + } + else + { + tokenLength += 1; + } + break; + case TokenizerState.Token: + if (char.IsWhiteSpace(ch)) + { + 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 original.Substring(tokenStart, tokenLength); + yield return new SqlString(","); + tokenStart += tokenLength + 1; + tokenLength = 0; + state = TokenizerState.WhiteSpace; + } + else if (ch == '(' || ch == '[') + { + state = TokenizerState.InParenthesis; + parenthesisCount = 1; + tokenLength += 1; + } + else if (ch == '\'') + { + state = TokenizerState.Quoted; + quoteType = '\''; + tokenLength += 1; + } + else if (ch == '"') + { + state = TokenizerState.Quoted; + quoteType = '"'; + tokenLength += 1; + } + else + { + tokenLength += 1; + } + break; + default: + throw new InvalidExpressionException("Could not understand the string " + original); + } + } + if (tokenLength > 0) + { + yield return original.Substring(tokenStart, tokenLength); + } + } + + public IEnumerator GetEnumerator() + { + return ((IEnumerable<SqlString>)this).GetEnumerator(); + } + + public enum TokenizerState + { + WhiteSpace, + Quoted, + InParenthesis, + Token + } + + public IList<SqlString> GetTokens() + { + return new List<SqlString>(this); + } + } + #endregion #region limit/offset support Modified: trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs 2010-09-22 20:25:09 UTC (rev 5202) +++ trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs 2010-09-22 21:01:34 UTC (rev 5203) @@ -1,5 +1,4 @@ using System; -using System.Collections; using System.Collections.Generic; using System.Data; using NHibernate.Mapping; @@ -153,74 +152,6 @@ throw new NotSupportedException("The query should start with 'SELECT' or 'SELECT DISTINCT'"); } - private static void ExtractColumnOrAliasNames(SqlString select, out List<SqlString> columnsOrAliases, - out Dictionary<SqlString, SqlString> aliasToColumn) - { - columnsOrAliases = new List<SqlString>(); - aliasToColumn = new Dictionary<SqlString, SqlString>(); - - IList<SqlString> tokens = new QuotedAndParenthesisStringTokenizer(select).GetTokens(); - int index = 0; - while (index < tokens.Count) - { - SqlString token = tokens[index]; - - int nextTokenIndex = index += 1; - - if (token.StartsWithCaseInsensitive("select")) - continue; - - if (token.StartsWithCaseInsensitive("distinct")) - continue; - - if (token.StartsWithCaseInsensitive(",")) - continue; - - if (token.StartsWithCaseInsensitive("from")) - break; - - // handle composite expressions like "2 * 4 as foo" - while ((nextTokenIndex < tokens.Count) && (tokens[nextTokenIndex].StartsWithCaseInsensitive("as") == false && tokens[nextTokenIndex].StartsWithCaseInsensitive(",") == false)) - { - SqlString nextToken = tokens[nextTokenIndex]; - token = token.Append(nextToken); - nextTokenIndex = index += 1; - } - - // if there is no alias, the token and the alias will be the same - SqlString alias = token; - - 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) - { - // 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 (nextTokenIndex + 1 < tokens.Count) - { - 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(alias); - aliasToColumn[alias] = token; - } - } - /// <summary> /// Indicates whether the string fragment contains matching parenthesis /// </summary> @@ -309,164 +240,5 @@ get { return false; } } - /// <summary> - /// This specialized string tokenizier will break a string to tokens, taking - /// into account single quotes, parenthesis and commas and [ ] - /// 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<SqlString> - { - private readonly SqlString original; - - public QuotedAndParenthesisStringTokenizer(SqlString original) - { - this.original = original; - } - - IEnumerator<SqlString> IEnumerable<SqlString>.GetEnumerator() - { - TokenizerState state = TokenizerState.WhiteSpace; - int parenthesisCount = 0; - bool escapeQuote = false; - int tokenStart = 0; - int tokenLength = 0; - string originalString = original.ToString(); - - for (int i = 0; i < originalString.Length; i++) - { - char ch = originalString[i]; - switch (state) - { - case TokenizerState.WhiteSpace: - if (ch == '\'') - { - state = TokenizerState.Quoted; - tokenLength += 1; - } - else if (ch == ',') - { - yield return new SqlString(","); - //tokenLength += 1? - } - else if (ch == '(' || ch == '[') - { - state = TokenizerState.InParenthesis; - tokenLength += 1; - parenthesisCount = 1; - } - else if (char.IsWhiteSpace(ch) == false) - { - state = TokenizerState.Token; - tokenLength += 1; - } - break; - case TokenizerState.Quoted: - if (escapeQuote) - { - escapeQuote = false; - tokenLength += 1; - } - // handle escaping of ' by using '' or \' - else if (ch == '\\' || (ch == '\'' && i + 1 < originalString.Length && originalString[i + 1] == '\'')) - { - escapeQuote = true; - tokenLength += 1; - } - else if (ch == '\'') - { - yield return original.Substring(tokenStart, tokenLength); - tokenStart += tokenLength + 1; - tokenLength = 0; - state = TokenizerState.WhiteSpace; - } - else - { - tokenLength += 1; - } - break; - case TokenizerState.InParenthesis: - if (ch == ')' || ch == ']') - { - tokenLength += 1; - parenthesisCount -= 1; - if (parenthesisCount == 0) - { - yield return original.Substring(tokenStart, tokenLength); - tokenStart += tokenLength + 1; - tokenLength = 0; - state = TokenizerState.WhiteSpace; - } - } - else if (ch == '(' || ch == '[') - { - tokenLength += 1; - parenthesisCount += 1; - } - else - { - tokenLength += 1; - } - break; - case TokenizerState.Token: - if (char.IsWhiteSpace(ch)) - { - 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 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; - tokenLength += 1; - } - else if (ch == '\'') - { - state = TokenizerState.Quoted; - tokenLength += 1; - } - else - { - tokenLength += 1; - } - break; - default: - throw new InvalidExpressionException("Could not understand the string " + original); - } - } - if (tokenLength > 0) - { - yield return original.Substring(tokenStart, tokenLength); - } - } - - public IEnumerator GetEnumerator() - { - return ((IEnumerable<SqlString>)this).GetEnumerator(); - } - - public enum TokenizerState - { - WhiteSpace, - Quoted, - InParenthesis, - Token - } - - public IList<SqlString> GetTokens() - { - return new List<SqlString>(this); - } - } } } \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/Dialect/Oracle8iDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/Oracle8iDialect.cs 2010-09-22 20:25:09 UTC (rev 5202) +++ trunk/nhibernate/src/NHibernate/Dialect/Oracle8iDialect.cs 2010-09-22 21:01:34 UTC (rev 5203) @@ -1,14 +1,16 @@ using System; using System.Collections; +using System.Collections.Generic; using System.Data; +using System.Data.Common; using NHibernate.Dialect.Function; using NHibernate.Dialect.Schema; using NHibernate.Engine; using NHibernate.SqlCommand; using NHibernate.SqlTypes; using NHibernate.Type; -using Environment=NHibernate.Cfg.Environment; -using System.Data.Common; +using NHibernate.Util; +using Environment = NHibernate.Cfg.Environment; namespace NHibernate.Dialect { @@ -259,14 +261,16 @@ isForUpdate = true; } + string selectColumns = ExtractColumnOrAliasNames(sql); + var pagingSelect = new SqlStringBuilder(sql.Parts.Count + 10); if (hasOffset) { - pagingSelect.Add("select * from ( select row_.*, rownum rownum_ from ( "); + pagingSelect.Add("select " + selectColumns + " from ( select row_.*, rownum rownum_ from ( "); } else { - pagingSelect.Add("select * from ( "); + pagingSelect.Add("select " + selectColumns + " from ( "); } pagingSelect.Add(sql); if (hasOffset) @@ -286,6 +290,15 @@ return pagingSelect.ToSqlString(); } + private string ExtractColumnOrAliasNames(SqlString select) + { + List<SqlString> columnsOrAliases; + Dictionary<SqlString, SqlString> aliasToColumn; + ExtractColumnOrAliasNames(select, out columnsOrAliases, out aliasToColumn); + + return StringHelper.Join(",", columnsOrAliases); + } + /// <summary> /// Allows access to the basic <see cref="Dialect.GetSelectClauseNullString"/> /// implementation... Modified: trunk/nhibernate/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs 2010-09-22 20:25:09 UTC (rev 5202) +++ trunk/nhibernate/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs 2010-09-22 21:01:34 UTC (rev 5203) @@ -378,6 +378,7 @@ var result = session.CreateCriteria(typeof(Student)) .Add(Subqueries.PropertyIn("Name", dc)) + .AddOrder(Order.Asc("StudentNumber")) .List<Student>(); Assert.That(result.Count, Is.EqualTo(2)); Modified: trunk/nhibernate/src/NHibernate.Test/DialectTest/MsSql2005DialectFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/DialectTest/MsSql2005DialectFixture.cs 2010-09-22 20:25:09 UTC (rev 5202) +++ trunk/nhibernate/src/NHibernate.Test/DialectTest/MsSql2005DialectFixture.cs 2010-09-22 21:01:34 UTC (rev 5203) @@ -159,6 +159,35 @@ Assert.AreEqual(current, expected.Length); } + [Test] + public void QuotedStringTokenizerTests() + { + MsSql2005Dialect.QuotedAndParenthesisStringTokenizer tokenizier = + new MsSql2005Dialect.QuotedAndParenthesisStringTokenizer( + new SqlString("SELECT fish.\"id column\", fish.'fish name' as 'bar\\' column', f FROM fish")); + string[] expected = new string[] + { + "SELECT", + "fish.\"id column\"", + ",", + "fish.'fish name'", + "as", + "'bar\\' column'", + ",", + "f", + "FROM", + "fish" + }; + int current = 0; + IList<SqlString> tokens = tokenizier.GetTokens(); + foreach (SqlString token in tokens) + { + Assert.AreEqual(expected[current], token.ToString()); + current += 1; + } + Assert.AreEqual(current, expected.Length); + } + [Test] public void GetIfExistsDropConstraintTest_without_schema() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2010-09-22 20:25:16
|
Revision: 5202 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5202&view=rev Author: fabiomaulo Date: 2010-09-22 20:25:09 +0000 (Wed, 22 Sep 2010) Log Message: ----------- Fixed one of the two issues reported in NH-2206 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Linq/Visitors/QueryModelVisitor.cs trunk/nhibernate/src/NHibernate/NHibernate.csproj trunk/nhibernate/src/NHibernate.Test/Linq/WhereTests.cs Added Paths: ----------- trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessCast.cs Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/QueryModelVisitor.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/Visitors/QueryModelVisitor.cs 2010-09-22 19:57:43 UTC (rev 5201) +++ trunk/nhibernate/src/NHibernate/Linq/Visitors/QueryModelVisitor.cs 2010-09-22 20:25:09 UTC (rev 5202) @@ -80,7 +80,8 @@ ResultOperatorMap.Add<FetchManyRequest, ProcessFetchMany>(); ResultOperatorMap.Add<CacheableResultOperator, ProcessCacheable>(); ResultOperatorMap.Add<OfTypeResultOperator, ProcessOfType>(); - } + ResultOperatorMap.Add<CastResultOperator, ProcessCast>(); + } private QueryModelVisitor(VisitorParameters visitorParameters, bool root, QueryModel queryModel) { Added: trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessCast.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessCast.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessCast.cs 2010-09-22 20:25:09 UTC (rev 5202) @@ -0,0 +1,16 @@ +using Remotion.Data.Linq.Clauses.ResultOperators; + +namespace NHibernate.Linq.Visitors.ResultOperatorProcessors +{ + public class ProcessCast : IResultOperatorProcessor<CastResultOperator> + { + public void Process(CastResultOperator resultOperator, QueryModelVisitor queryModelVisitor, IntermediateHqlTree tree) + { + // what we can do with Cast, so far, is only ignore it. + // The meaning of Cast<T>() is different than OfType<T>. + // With OfType<T> the user selects a specific entity-type; + // with Cast<T> the user "hopes" that everything will work with the same type + // When we will have some more detail we can change this "implementation" ;) + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2010-09-22 19:57:43 UTC (rev 5201) +++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2010-09-22 20:25:09 UTC (rev 5202) @@ -694,6 +694,7 @@ <Compile Include="Linq\ReWriters\RemoveUnnecessaryBodyOperators.cs" /> <Compile Include="Linq\Clauses\LeftJoinClause.cs" /> <Compile Include="Linq\IntermediateHqlTree.cs" /> + <Compile Include="Linq\Visitors\ResultOperatorProcessors\ProcessCast.cs" /> <Compile Include="Linq\Visitors\ResultOperatorProcessors\ProcessOfType.cs" /> <Compile Include="Linq\Visitors\ResultOperatorProcessors\ProcessCacheable.cs" /> <Compile Include="Linq\Visitors\QuerySourceLocator.cs" /> @@ -1554,9 +1555,6 @@ <ItemGroup> <Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}" /> </ItemGroup> - <ItemGroup> - <Folder Include="Cache\Access" /> - </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. Modified: trunk/nhibernate/src/NHibernate.Test/Linq/WhereTests.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Linq/WhereTests.cs 2010-09-22 19:57:43 UTC (rev 5201) +++ trunk/nhibernate/src/NHibernate.Test/Linq/WhereTests.cs 2010-09-22 20:25:09 UTC (rev 5202) @@ -430,7 +430,7 @@ Assert.AreEqual(2, query.Count); } - [Test(Description = "Reported as bug NH-2206"), Ignore("Not fixed yet")] + [Test(Description = "Reported as bug NH-2206")] public void SearchOnObjectTypeUpCastWithExtensionMethod() { var query = (from o in session.Query<Dog>() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2010-09-22 19:57:50
|
Revision: 5201 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5201&view=rev Author: fabiomaulo Date: 2010-09-22 19:57:43 +0000 (Wed, 22 Sep 2010) Log Message: ----------- Fix NH-2289 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Linq/NhRelinqQueryParser.cs trunk/nhibernate/src/NHibernate.Test/Linq/WhereTests.cs Modified: trunk/nhibernate/src/NHibernate/Linq/NhRelinqQueryParser.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/NhRelinqQueryParser.cs 2010-09-22 17:05:14 UTC (rev 5200) +++ trunk/nhibernate/src/NHibernate/Linq/NhRelinqQueryParser.cs 2010-09-22 19:57:43 UTC (rev 5201) @@ -29,15 +29,17 @@ }, typeof (AggregateExpressionNode)); - MethodCallRegistry.Register( - new[] - { - MethodCallExpressionNodeTypeRegistry.GetRegisterableMethodDefinition( - ReflectionHelper.GetMethodDefinition((List<object> l) => l.Contains(null))), + // Here would be useful to have something like our ReflectionHelper.IsMethodOf because it is impossible to know + // which is the implementation of ICollection<T> used by our user. Reported to Stefan Wenig as possible (via mail instead of their JIAR) + MethodCallRegistry.Register( + new[] + { + MethodCallExpressionNodeTypeRegistry.GetRegisterableMethodDefinition( + ReflectionHelper.GetMethodDefinition((List<object> l) => l.Contains(null))), + typeof (ICollection<>).GetMethod("Contains"), + }, + typeof (ContainsExpressionNode)); - }, - typeof (ContainsExpressionNode)); - MethodCallRegistry.Register(new[] { typeof(EagerFetchingExtensionMethods).GetMethod("Fetch") }, typeof(FetchOneExpressionNode)); MethodCallRegistry.Register(new[] { typeof(EagerFetchingExtensionMethods).GetMethod("FetchMany") }, typeof(FetchManyExpressionNode)); MethodCallRegistry.Register(new[] { typeof(EagerFetchingExtensionMethods).GetMethod("ThenFetch") }, typeof(ThenFetchOneExpressionNode)); Modified: trunk/nhibernate/src/NHibernate.Test/Linq/WhereTests.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Linq/WhereTests.cs 2010-09-22 17:05:14 UTC (rev 5200) +++ trunk/nhibernate/src/NHibernate.Test/Linq/WhereTests.cs 2010-09-22 19:57:43 UTC (rev 5201) @@ -326,7 +326,7 @@ Assert.AreEqual(2, query.Count); } - [Test, Ignore("Not fixed yet NH-2289")] + [Test] public void WhenTheSourceOfConstantIsICollectionThenNoThrows() { ICollection<string> names = new List<string> {"ayende", "rahien"}; @@ -340,6 +340,19 @@ } [Test] + public void WhenTheSourceOfConstantIsIListThenNoThrows() + { + IList<string> names = new List<string> { "ayende", "rahien" }; + + var query = (from user in db.Users + where names.Contains(user.Name) + select user); + List<User> result = null; + Executing.This(() => result = query.ToList()).Should().NotThrow(); + result.Count.Should().Be(2); + } + + [Test] public void TimesheetsWithCollectionContains() { var entry = session.Get<TimesheetEntry>(1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2010-09-22 17:05:24
|
Revision: 5200 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5200&view=rev Author: fabiomaulo Date: 2010-09-22 17:05:14 +0000 (Wed, 22 Sep 2010) Log Message: ----------- Fix NH-2339 (thanks to Timur Krist?\195?\179f) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Context/ReflectiveHttpContext.cs Modified: trunk/nhibernate/src/NHibernate/Context/ReflectiveHttpContext.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Context/ReflectiveHttpContext.cs 2010-09-22 16:04:12 UTC (rev 5199) +++ trunk/nhibernate/src/NHibernate/Context/ReflectiveHttpContext.cs 2010-09-22 17:05:14 UTC (rev 5200) @@ -30,8 +30,11 @@ { get { - string mscorlibVersion = typeof(object).Assembly.GetName().Version.ToString(); - return System.Type.GetType("System.Web.HttpContext, System.Web, Version=" + mscorlibVersion + ", Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); + return + System.Type.GetType( + string.Format( + "System.Web.HttpContext, System.Web, Version={0}, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", + Environment.Version)); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2010-09-22 16:04:23
|
Revision: 5199 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5199&view=rev Author: fabiomaulo Date: 2010-09-22 16:04:12 +0000 (Wed, 22 Sep 2010) Log Message: ----------- Fix NH-2288 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Cfg/Configuration.cs trunk/nhibernate/src/NHibernate/Cfg/Mappings.cs trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/MappingRootBinder.cs trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2288/ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2288/AclassWithDefault.hbm.xml trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2288/AclassWithNothing.hbm.xml trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2288/AclassWithSpecific.hbm.xml trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2288/Fixture.cs Modified: trunk/nhibernate/src/NHibernate/Cfg/Configuration.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Cfg/Configuration.cs 2010-09-21 15:00:19 UTC (rev 5198) +++ trunk/nhibernate/src/NHibernate/Cfg/Configuration.cs 2010-09-22 16:04:12 UTC (rev 5199) @@ -552,11 +552,14 @@ /// </summary> public Mappings CreateMappings(Dialect.Dialect dialect) { + string defaultCatalog = PropertiesHelper.GetString(Environment.DefaultCatalog, properties, null); + string defaultSchema = PropertiesHelper.GetString(Environment.DefaultSchema, properties, null); + ProcessPreMappingBuildProperties(); return new Mappings(classes, collections, tables, NamedQueries, NamedSQLQueries, SqlResultSetMappings, Imports, secondPasses, filtersSecondPasses, propertyReferences, namingStrategy, typeDefs, FilterDefinitions, extendsQueue, auxiliaryDatabaseObjects, tableNameBinding, columnNameBindingPerTable, defaultAssembly, - defaultNamespace, dialect); + defaultNamespace, defaultCatalog, defaultSchema, dialect); } private void ProcessPreMappingBuildProperties() Modified: trunk/nhibernate/src/NHibernate/Cfg/Mappings.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Cfg/Mappings.cs 2010-09-21 15:00:19 UTC (rev 5198) +++ trunk/nhibernate/src/NHibernate/Cfg/Mappings.cs 2010-09-22 16:04:12 UTC (rev 5199) @@ -110,6 +110,8 @@ IDictionary<Table, ColumnNames> columnNameBindingPerTable, string defaultAssembly, string defaultNamespace, + string defaultCatalog, + string defaultSchema, Dialect.Dialect dialect) { this.classes = classes; @@ -130,6 +132,8 @@ this.columnNameBindingPerTable = columnNameBindingPerTable; this.defaultAssembly = defaultAssembly; this.defaultNamespace = defaultNamespace; + DefaultCatalog = defaultCatalog; + DefaultSchema = defaultSchema; this.dialect = dialect; this.filtersSecondPasses = filtersSecondPasses; } @@ -209,6 +213,9 @@ set { defaultAssembly = value; } } + public string DefaultCatalog { get; set; } + public string DefaultSchema { get; set; } + public Mapping.Collection GetCollection(string role) { return collections[role]; Modified: trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/MappingRootBinder.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/MappingRootBinder.cs 2010-09-21 15:00:19 UTC (rev 5198) +++ trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/MappingRootBinder.cs 2010-09-22 16:04:12 UTC (rev 5199) @@ -57,8 +57,8 @@ private void SetMappingsProperties(HbmMapping mappingSchema) { - mappings.SchemaName = mappingSchema.schema; - mappings.CatalogName = mappingSchema.catalog; + mappings.SchemaName = mappingSchema.schema ?? mappings.DefaultSchema; + mappings.CatalogName = mappingSchema.catalog ?? mappings.DefaultCatalog; mappings.DefaultCascade = mappingSchema.defaultcascade; mappings.DefaultAccess = mappingSchema.defaultaccess; mappings.DefaultLazy = mappingSchema.defaultlazy; Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2288/AclassWithDefault.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2288/AclassWithDefault.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2288/AclassWithDefault.hbm.xml 2010-09-22 16:04:12 UTC (rev 5199) @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + namespace="NHibernate.Test.NHSpecificTest.NH2288" + assembly="NHibernate.Test" + catalog="nhibernate" + schema="dbo"> + + <class name="Aclass"> + <id name="Id"> + <generator class="native"/> + </id> + </class> + + <class name="Bclass"> + <id name="Id"> + <generator class="native"/> + </id> + <bag name="Aclasses"> + <key foreign-key="Aclasses_Id_FK" /> + <one-to-many class="Aclass"/> + </bag> + </class> +</hibernate-mapping> Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2288/AclassWithNothing.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2288/AclassWithNothing.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2288/AclassWithNothing.hbm.xml 2010-09-22 16:04:12 UTC (rev 5199) @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + namespace="NHibernate.Test.NHSpecificTest.NH2288" + assembly="NHibernate.Test"> + + <class name="Aclass"> + <id name="Id"> + <generator class="native"/> + </id> + </class> + + <class name="Bclass"> + <id name="Id"> + <generator class="native"/> + </id> + <bag name="Aclasses"> + <key foreign-key="Aclasses_Id_FK" /> + <one-to-many class="Aclass"/> + </bag> + </class> +</hibernate-mapping> Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2288/AclassWithSpecific.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2288/AclassWithSpecific.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2288/AclassWithSpecific.hbm.xml 2010-09-22 16:04:12 UTC (rev 5199) @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + namespace="NHibernate.Test.NHSpecificTest.NH2288" + assembly="NHibernate.Test" + catalog="somethingDifferent" + schema="somethingDifferent"> + + <class name="Aclass" catalog="nhibernate" schema="dbo"> + <id name="Id"> + <generator class="native"/> + </id> + </class> + + <class name="Bclass" catalog="nhibernate" schema="dbo"> + <id name="Id"> + <generator class="native"/> + </id> + <bag name="Aclasses"> + <key foreign-key="Aclasses_Id_FK" /> + <one-to-many class="Aclass"/> + </bag> + </class> +</hibernate-mapping> Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2288/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2288/Fixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2288/Fixture.cs 2010-09-22 16:04:12 UTC (rev 5199) @@ -0,0 +1,84 @@ +using System.Collections; +using System.Text; +using NHibernate.Cfg; +using NHibernate.Tool.hbm2ddl; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Test.NHSpecificTest.NH2288 +{ + [TestFixture] + public class Fixture + { + private static void CheckDialect(Configuration configuration) + { + if (!configuration.Properties[Environment.Dialect].Contains("MsSql")) + Assert.Ignore("Specific test for MsSQL dialects"); + } + + private static void AssertThatCheckOnTableExistenceIsCorrect(Configuration configuration) + { + var su = new SchemaExport(configuration); + var sb = new StringBuilder(500); + su.Execute(x => sb.AppendLine(x), false, false); + string script = sb.ToString(); + script.Should().Contain( + "if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'dbo.[Aclasses_Id_FK]') AND parent_object_id = OBJECT_ID('dbo.Aclass'))"); + } + + [Test] + public void TestForClassWithDefaultSchema() + { + Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration(); + CheckDialect(cfg); + cfg.SetProperty(Environment.DefaultCatalog, "nhibernate"); + cfg.SetProperty(Environment.DefaultSchema, "dbo"); + cfg.AddResource("NHibernate.Test.NHSpecificTest.NH2288.AclassWithNothing.hbm.xml", GetType().Assembly); + AssertThatCheckOnTableExistenceIsCorrect(cfg); + } + + [Test] + public void WithDefaultValuesInMapping() + { + Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration(); + CheckDialect(cfg); + cfg.SetProperty(Environment.DefaultCatalog, "nhibernate"); + cfg.SetProperty(Environment.DefaultSchema, "somethingDifferent"); + cfg.AddResource("NHibernate.Test.NHSpecificTest.NH2288.AclassWithDefault.hbm.xml", GetType().Assembly); + AssertThatCheckOnTableExistenceIsCorrect(cfg); + } + + [Test] + public void WithSpecificValuesInMapping() + { + Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration(); + CheckDialect(cfg); + cfg.SetProperty(Environment.DefaultCatalog, "nhibernate"); + cfg.SetProperty(Environment.DefaultSchema, "somethingDifferent"); + cfg.AddResource("NHibernate.Test.NHSpecificTest.NH2288.AclassWithSpecific.hbm.xml", GetType().Assembly); + AssertThatCheckOnTableExistenceIsCorrect(cfg); + } + + [Test] + public void WithDefaultValuesInConfigurationPriorityToMapping() + { + Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration(); + CheckDialect(cfg); + cfg.SetProperty(Environment.DefaultCatalog, "nhibernate"); + cfg.SetProperty(Environment.DefaultSchema, "somethingDifferent"); + cfg.AddResource("NHibernate.Test.NHSpecificTest.NH2288.AclassWithDefault.hbm.xml", GetType().Assembly); + AssertThatCheckOnTableExistenceIsCorrect(cfg); + } + } + + public class Aclass + { + public int Id { get; set; } + } + + public class Bclass + { + public int Id { get; set; } + public ICollection Aclasses { get; set; } + } +} \ 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-21 15:00:19 UTC (rev 5198) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-09-22 16:04:12 UTC (rev 5199) @@ -487,6 +487,7 @@ <Compile Include="NHSpecificTest\NH2279\Fixture.cs" /> <Compile Include="NHSpecificTest\NH2287\Domain.cs" /> <Compile Include="NHSpecificTest\NH2287\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH2288\Fixture.cs" /> <Compile Include="NHSpecificTest\NH2293\Fixture.cs" /> <Compile Include="NHSpecificTest\NH2294\Fixture.cs" /> <Compile Include="NHSpecificTest\NH2302\Fixture.cs" /> @@ -2290,6 +2291,9 @@ <EmbeddedResource Include="CollectionTest\NullableValueTypeElementMapFixture.hbm.xml" /> <EmbeddedResource Include="DriverTest\EntityForMs2008.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH2288\AclassWithDefault.hbm.xml" /> + <EmbeddedResource Include="NHSpecificTest\NH2288\AclassWithNothing.hbm.xml" /> + <EmbeddedResource Include="NHSpecificTest\NH2288\AclassWithSpecific.hbm.xml" /> <EmbeddedResource Include="TypesTest\XmlDocClass.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH2302\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH2303\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-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 =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2010-09-20 15:13:25 UTC (rev 5197) +++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2010-09-21 15:00:19 UTC (rev 5198) @@ -72,6 +72,7 @@ <Compile Include="ADOException.cs" /> <Compile Include="AssemblyInfo.cs" /> <Compile Include="AssertionFailure.cs" /> + <Compile Include="Cache\Access\ISoftLock.cs" /> <Compile Include="Cache\CachedItem.cs" /> <Compile Include="Cache\CacheException.cs" /> <Compile Include="Cache\CacheFactory.cs" /> @@ -83,7 +84,6 @@ <Compile Include="Cache\ICacheProvider.cs" /> <Compile Include="Cache\IQueryCache.cs" /> <Compile Include="Cache\IQueryCacheFactory.cs" /> - <Compile Include="Cache\ISoftLock.cs" /> <Compile Include="Cache\NonstrictReadWriteCache.cs" /> <Compile Include="Cache\QueryKey.cs" /> <Compile Include="Cache\ReadOnlyCache.cs" /> @@ -1554,6 +1554,9 @@ <ItemGroup> <Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}" /> </ItemGroup> + <ItemGroup> + <Folder Include="Cache\Access" /> + </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. Modified: trunk/nhibernate/src/NHibernate.Test/CacheTest/CacheFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/CacheTest/CacheFixture.cs 2010-09-20 15:13:25 UTC (rev 5197) +++ trunk/nhibernate/src/NHibernate.Test/CacheTest/CacheFixture.cs 2010-09-21 15:00:19 UTC (rev 5198) @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Threading; using NHibernate.Cache; +using NHibernate.Cache.Access; using NUnit.Framework; namespace NHibernate.Test.CacheTest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jul...@us...> - 2010-09-20 15:13:32
|
Revision: 5197 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5197&view=rev Author: julian-maughan Date: 2010-09-20 15:13:25 +0000 (Mon, 20 Sep 2010) Log Message: ----------- Fixed date string in NH-1136 test - CI server has different culture Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/Fixture.cs Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/Fixture.cs 2010-09-20 14:55:09 UTC (rev 5196) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/Fixture.cs 2010-09-20 15:13:25 UTC (rev 5197) @@ -39,8 +39,8 @@ person1.AddPercentageToFeeMatrix(0, .20m); person1.AddPercentageToFeeMatrix(50, .15m); person1.AddPercentageToFeeMatrix(100, .1m); - person1.RegisterChangeOfAddress(DateTime.Parse("15/04/2005"), address1); - person1.RegisterChangeOfAddress(DateTime.Parse("29/05/2007"), address2); + person1.RegisterChangeOfAddress(new DateTime(2005, 4, 15), address1); + person1.RegisterChangeOfAddress(new DateTime(2007, 5, 29), address2); s.Save(person1); s.Flush(); @@ -51,7 +51,7 @@ using (ISession s = OpenSession()) { var person1 = s.Load<Person>(id); - person1.RegisterChangeOfAddress(DateTime.Parse("23/03/2008"), new Address("8", "SS7 1TT")); + person1.RegisterChangeOfAddress(new DateTime(2008, 3, 23), new Address("8", "SS7 1TT")); s.Save(person1); s.Flush(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jul...@us...> - 2010-09-20 14:55:16
|
Revision: 5196 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5196&view=rev Author: julian-maughan Date: 2010-09-20 14:55:09 +0000 (Mon, 20 Sep 2010) Log Message: ----------- Test for NH-1136. Provides an example of mapping a custom dictionary with a many-to-many association. Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/Address.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/FeeMatrixType.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/Fixture.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/IMilestoneCollection.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/Mappings.hbm.xml trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/MilestoneCollection.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/MilestoneCollectionType.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/PersistentMilestoneCollection.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/Person.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/ReverseSortComparer.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/TemporalAddressType.cs Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/Address.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/Address.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/Address.cs 2010-09-20 14:55:09 UTC (rev 5196) @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace NHibernate.Test.NHSpecificTest.NH1136 +{ + public class Address : IEquatable<Address> + { + #region Fields + +#pragma warning disable 169 + private int _id; + private int _version; +#pragma warning restore 169 + + private string _number; + private string _postcode; + + #endregion + + #region Ctors + + public Address(string number, string postcode) + { + _number = number; + _postcode = postcode; + } + + private Address() + { + } + + #endregion + + #region Properties + + public string Number + { + get { return _number; } + } + + public string Postcode + { + get { return _postcode; } + } + + #endregion + + #region Object Overrides + + public override bool Equals(object obj) + { + return Equals(obj as Address); + } + + public override int GetHashCode() + { + return Postcode.GetHashCode() + 29*Number.GetHashCode(); + } + + #endregion + + #region IEquatable<Address> Members + + public bool Equals(Address other) + { + return other == null ? false : IsEqualTo(other); + } + + #endregion + + private bool IsEqualTo(Address other) + { + return ReferenceEquals(this, other) || (Postcode.Equals(other.Postcode) && Number.Equals(other.Number)); + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/FeeMatrixType.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/FeeMatrixType.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/FeeMatrixType.cs 2010-09-20 14:55:09 UTC (rev 5196) @@ -0,0 +1,9 @@ +using System; +using NHibernate.UserTypes; + +namespace NHibernate.Test.NHSpecificTest.NH1136 +{ + public class FeeMatrixType : MilestoneCollectionType<int, decimal> + { + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/Fixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/Fixture.cs 2010-09-20 14:55:09 UTC (rev 5196) @@ -0,0 +1,60 @@ +using System; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH1136 +{ + [TestFixture] + public class Fixture : BugTestCase + { + public override string BugNumber + { + get { return "NH1136"; } + } + + protected override void OnTearDown() + { + using (ISession s = OpenSession()) + { + s.Delete("from Address"); + s.Delete("from Person"); + s.Flush(); + } + + base.OnTearDown(); + } + + [Test] + public void Test() + { + int id = -1; + + using (ISession s = OpenSession()) + { + var address1 = new Address("60", "EH3 8BE"); + var address2 = new Address("2", "EH6 6JA"); + s.Save(address1); + s.Save(address2); + + var person1 = new Person("'lil old me"); + person1.AddPercentageToFeeMatrix(0, .20m); + person1.AddPercentageToFeeMatrix(50, .15m); + person1.AddPercentageToFeeMatrix(100, .1m); + person1.RegisterChangeOfAddress(DateTime.Parse("15/04/2005"), address1); + person1.RegisterChangeOfAddress(DateTime.Parse("29/05/2007"), address2); + + s.Save(person1); + s.Flush(); + + id = person1.Id; + } + + using (ISession s = OpenSession()) + { + var person1 = s.Load<Person>(id); + person1.RegisterChangeOfAddress(DateTime.Parse("23/03/2008"), new Address("8", "SS7 1TT")); + s.Save(person1); + s.Flush(); + } + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/IMilestoneCollection.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/IMilestoneCollection.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/IMilestoneCollection.cs 2010-09-20 14:55:09 UTC (rev 5196) @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; + +namespace NHibernate.Test.NHSpecificTest.NH1136 +{ + public interface IMilestoneCollection<TKey, TValue> : IDictionary<TKey, TValue> + where TKey : IComparable<TKey> + { + TValue FindValueFor(TKey key); + } +} Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/Mappings.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/Mappings.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/Mappings.hbm.xml 2010-09-20 14:55:09 UTC (rev 5196) @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping + xmlns="urn:nhibernate-mapping-2.2" + assembly="NHibernate.Test" + namespace="NHibernate.Test.NHSpecificTest.NH1136"> + + <class name ="Person" table="PERSON" lazy="false"> + + <id name="_id" column="PERSON_ID" access="field"> + <generator class="identity"/> + </id> + + <version name="_version" column ="VERSION" access="field"/> + + <property name="Name" column="NAME" access="nosetter.camelcase-underscore" /> + + <map + name="_feeMatrix" + access="field" + generic="true" + cascade="all-delete-orphan" + lazy="true" + table="FEE_MATRIX" + collection-type="FeeMatrixType, NHibernate.Test"> + + <key column="PERSON_ID"/> + <index column="MILESTONE" type="System.Int32"/> + <element column="PERCENTAGE" type="System.Decimal" not-null="true"/> + </map> + + <map + name="_historyOfAddresses" + access="field" + generic="true" + cascade="all-delete-orphan" + lazy="true" + table="PERSON_ADDRESS_ASSOCIATION" + collection-type="TemporalAddressesType, NHibernate.Test"> + + <key column="PERSON_ID" /> + <index column="MOVED_IN_ON" type="System.DateTime"/> + <many-to-many class="Address" column="ADDRESS_ID" /> + </map> + + </class> + + <class name ="Address" table="ADDRESS" lazy="false"> + + <id name="_id" column="ADDRESS_ID" access="field"> + <generator class="identity"/> + </id> + + <version name="_version" column ="VERSION" access="field"/> + + <property name="Number" column="HOUSE_NUMBER" access="nosetter.camelcase-underscore" /> + + <property name="Postcode" column="POSTCODE" access="nosetter.camelcase-underscore" /> + + </class> + +</hibernate-mapping> Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/MilestoneCollection.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/MilestoneCollection.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/MilestoneCollection.cs 2010-09-20 14:55:09 UTC (rev 5196) @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; + +namespace NHibernate.Test.NHSpecificTest.NH1136 +{ + public class MilestoneCollection<TKey, TValue> : SortedDictionary<TKey, TValue>, IMilestoneCollection<TKey, TValue> + where TKey : IComparable<TKey> + { + public MilestoneCollection() : base(new ReverseSortComparer<TKey>()){} + + #region IMilestoneCollection<TKey,TValue> Members + + public TValue FindValueFor(TKey key) + { + foreach (TKey milestone in this.Keys) + { + if (milestone.CompareTo(key) <= 0) return this[milestone]; + } + return default(TValue); + } + + #endregion + } +} Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/MilestoneCollectionType.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/MilestoneCollectionType.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/MilestoneCollectionType.cs 2010-09-20 14:55:09 UTC (rev 5196) @@ -0,0 +1,47 @@ +using System; +using System.Collections; +using NHibernate.Collection; +using NHibernate.Engine; +using NHibernate.Persister.Collection; +using NHibernate.UserTypes; + +namespace NHibernate.Test.NHSpecificTest.NH1136 +{ + public class MilestoneCollectionType<TKey, TValue> : IUserCollectionType where TKey : IComparable<TKey> + { + public IPersistentCollection Instantiate(ISessionImplementor session, ICollectionPersister persister) + { + return new PersistentMilestoneCollection<TKey, TValue>(session); + } + + public IPersistentCollection Wrap(ISessionImplementor session, object collection) + { + return new PersistentMilestoneCollection<TKey, TValue>(session, (IMilestoneCollection <TKey, TValue>) collection); + } + + public IEnumerable GetElements(object collection) + { + return (IEnumerable)((IMilestoneCollection<TKey, TValue>) collection).Values; + } + + public bool Contains(object collection, object entity) + { + throw new NotImplementedException(); + } + + public object IndexOf(object collection, object entity) + { + throw new NotImplementedException(); + } + + public object ReplaceElements(object original, object target, ICollectionPersister persister, object owner, IDictionary copyCache, ISessionImplementor session) + { + throw new NotImplementedException(); + } + + public object Instantiate(int anticipatedSize) + { + return new MilestoneCollection<TKey, TValue>(); + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/PersistentMilestoneCollection.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/PersistentMilestoneCollection.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/PersistentMilestoneCollection.cs 2010-09-20 14:55:09 UTC (rev 5196) @@ -0,0 +1,28 @@ +using System; +using NHibernate.Collection.Generic; +using NHibernate.Engine; + +namespace NHibernate.Test.NHSpecificTest.NH1136 +{ + public class PersistentMilestoneCollection<TKey, TValue> : PersistentGenericMap<TKey, TValue>, IMilestoneCollection<TKey, TValue> + where TKey : IComparable<TKey> + { + public PersistentMilestoneCollection(ISessionImplementor session, IMilestoneCollection<TKey, TValue> map) : base(session, map) + { + } + + public PersistentMilestoneCollection(ISessionImplementor session) : base(session) + { + } + + #region IMilestoneCollection<TKey,TValue> Members + + public TValue FindValueFor(TKey key) + { + Read(); + return ((IMilestoneCollection<TKey, TValue>) map).FindValueFor(key); + } + + #endregion + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/Person.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/Person.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/Person.cs 2010-09-20 14:55:09 UTC (rev 5196) @@ -0,0 +1,104 @@ +using System; + +namespace NHibernate.Test.NHSpecificTest.NH1136 +{ + public class Person : IEquatable<Person> + { + #region Fields + +#pragma warning disable 169 + private int _id; + private int _version; +#pragma warning restore 169 + + private string _name; + private IMilestoneCollection<int, decimal> _feeMatrix = new MilestoneCollection<int, decimal>(); + private IMilestoneCollection<DateTime, Address> _historyOfAddresses = new MilestoneCollection<DateTime, Address>(); + + #endregion + + #region Constructors + + private Person() + { + } + + public Person(string name) + { + _name = name; + } + + #endregion + + #region Properties + + public int Id + { + get { return _id; } + } + + public string Name + { + get { return _name; } + } + + public Address CurrentAddress + { + get { return _historyOfAddresses.FindValueFor(DateTime.Now); } + } + + #endregion + + #region Methods + + public void AddPercentageToFeeMatrix(int value, decimal percentage) + { + _feeMatrix[value] = percentage; + } + + public decimal FindFeePercentageForValue(int value) + { + return _feeMatrix.FindValueFor(value); + } + + public void RegisterChangeOfAddress(DateTime movingDate, Address newAddress) + { + _historyOfAddresses[movingDate] = newAddress; + } + + #endregion + + #region Object Overrides + + public override bool Equals(object obj) + { + return Equals(obj as Person); + } + + public override int GetHashCode() + { + return Name.GetHashCode(); + } + + public override string ToString() + { + return "Person: " + Name; + } + + #endregion + + #region IEquatable<Person> Members + + public bool Equals(Person other) + { + return other == null ? false : IsEqualTo(other); + } + + #endregion + + private bool IsEqualTo(Person other) + { + return ReferenceEquals(this, other) || Name.Equals(other.Name); + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/ReverseSortComparer.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/ReverseSortComparer.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/ReverseSortComparer.cs 2010-09-20 14:55:09 UTC (rev 5196) @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; + +namespace NHibernate.Test.NHSpecificTest.NH1136 +{ + public sealed class ReverseSortComparer<T> : IComparer<T> where T : IComparable<T> + { + #region IComparer<T> Members + + public int Compare(T x, T y) + { + return y.CompareTo(x); + } + + #endregion + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/TemporalAddressType.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/TemporalAddressType.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1136/TemporalAddressType.cs 2010-09-20 14:55:09 UTC (rev 5196) @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; +using NHibernate.UserTypes; + +namespace NHibernate.Test.NHSpecificTest.NH1136 +{ + public class TemporalAddressesType : MilestoneCollectionType<DateTime, Address> + { + } +} Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-09-20 09:41:14 UTC (rev 5195) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-09-20 14:55:09 UTC (rev 5196) @@ -450,6 +450,16 @@ <Compile Include="Linq\ReadonlyTestCase.cs" /> <Compile Include="Logging\Log4NetLoggerTest.cs" /> <Compile Include="Logging\LoggerProviderTest.cs" /> + <Compile Include="NHSpecificTest\NH1136\Address.cs" /> + <Compile Include="NHSpecificTest\NH1136\FeeMatrixType.cs" /> + <Compile Include="NHSpecificTest\NH1136\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1136\IMilestoneCollection.cs" /> + <Compile Include="NHSpecificTest\NH1136\MilestoneCollection.cs" /> + <Compile Include="NHSpecificTest\NH1136\MilestoneCollectionType.cs" /> + <Compile Include="NHSpecificTest\NH1136\PersistentMilestoneCollection.cs" /> + <Compile Include="NHSpecificTest\NH1136\Person.cs" /> + <Compile Include="NHSpecificTest\NH1136\ReverseSortComparer.cs" /> + <Compile Include="NHSpecificTest\NH1136\TemporalAddressType.cs" /> <Compile Include="NHSpecificTest\NH1421\AnEntity.cs" /> <Compile Include="NHSpecificTest\NH1421\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1836\Entity.cs" /> @@ -1768,6 +1778,7 @@ <EmbeddedResource Include="NHSpecificTest\NH2111\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH2322\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH2278\Mappings.hbm.xml" /> + <EmbeddedResource Include="NHSpecificTest\NH1136\Mappings.hbm.xml" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\NHibernate.ByteCode.Castle\NHibernate.ByteCode.Castle.csproj"> @@ -2613,6 +2624,7 @@ <EmbeddedResource Include="DynamicEntity\Tuplizer\Customer.hbm.xml" /> </ItemGroup> <ItemGroup> + <Folder Include="NHSpecificTest\NH1136" /> <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-09-20 09:41:24
|
Revision: 5195 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5195&view=rev Author: fabiomaulo Date: 2010-09-20 09:41:14 +0000 (Mon, 20 Sep 2010) Log Message: ----------- failing test for NH-2289 Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/Linq/WhereTests.cs Modified: trunk/nhibernate/src/NHibernate.Test/Linq/WhereTests.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Linq/WhereTests.cs 2010-09-19 21:45:33 UTC (rev 5194) +++ trunk/nhibernate/src/NHibernate.Test/Linq/WhereTests.cs 2010-09-20 09:41:14 UTC (rev 5195) @@ -5,6 +5,7 @@ using NHibernate.Linq; using NHibernate.Test.Linq.Entities; using NUnit.Framework; +using SharpTestsEx; namespace NHibernate.Test.Linq { @@ -325,6 +326,19 @@ Assert.AreEqual(2, query.Count); } + [Test, Ignore("Not fixed yet NH-2289")] + public void WhenTheSourceOfConstantIsICollectionThenNoThrows() + { + ICollection<string> names = new List<string> {"ayende", "rahien"}; + + var query = (from user in db.Users + where names.Contains(user.Name) + select user); + List<User> result = null; + Executing.This(() => result = query.ToList()).Should().NotThrow(); + result.Count.Should().Be(2); + } + [Test] public void TimesheetsWithCollectionContains() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2010-09-19 21:45:39
|
Revision: 5194 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5194&view=rev Author: fabiomaulo Date: 2010-09-19 21:45:33 +0000 (Sun, 19 Sep 2010) Log Message: ----------- Apply NH-2336 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/Function/AnsiTrimEmulationFunction.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/Function/AnsiTrimEmulationFunction.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/Function/AnsiTrimEmulationFunction.cs 2010-09-19 20:34:17 UTC (rev 5193) +++ trunk/nhibernate/src/NHibernate/Dialect/Function/AnsiTrimEmulationFunction.cs 2010-09-19 21:45:33 UTC (rev 5194) @@ -31,11 +31,11 @@ private static readonly ISQLFunction LeadingTrim = new SQLFunctionTemplate(NHibernateUtil.String, - "replace( replace( rtrim( replace( replace( ?1, ' ', '${space}$' ), ?2, ' ' ) ), ' ', ?2 ), '${space}$', ' ' )"); + "replace( replace( ltrim( replace( replace( ?1, ' ', '${space}$' ), ?2, ' ' ) ), ' ', ?2 ), '${space}$', ' ' )"); private static readonly ISQLFunction TrailingTrim = new SQLFunctionTemplate(NHibernateUtil.String, - "replace( replace( ltrim( replace( replace( ?1, ' ', '${space}$' ), ?2, ' ' ) ), ' ', ?2 ), '${space}$', ' ' )"); + "replace( replace( rtrim( replace( replace( ?1, ' ', '${space}$' ), ?2, ' ' ) ), ' ', ?2 ), '${space}$', ' ' )"); private static readonly ISQLFunction BothTrim = new SQLFunctionTemplate(NHibernateUtil.String, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2010-09-19 20:34:23
|
Revision: 5193 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5193&view=rev Author: fabiomaulo Date: 2010-09-19 20:34:17 +0000 (Sun, 19 Sep 2010) Log Message: ----------- Apply NH-2335 (by Patrick Earl) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Context/ReflectiveHttpContext.cs Modified: trunk/nhibernate/src/NHibernate/Context/ReflectiveHttpContext.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Context/ReflectiveHttpContext.cs 2010-09-19 20:17:12 UTC (rev 5192) +++ trunk/nhibernate/src/NHibernate/Context/ReflectiveHttpContext.cs 2010-09-19 20:34:17 UTC (rev 5193) @@ -28,7 +28,11 @@ private static System.Type HttpContextType { - get { return System.Type.GetType("System.Web.HttpContext, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); } + get + { + string mscorlibVersion = typeof(object).Assembly.GetName().Version.ToString(); + return System.Type.GetType("System.Web.HttpContext, System.Web, Version=" + mscorlibVersion + ", Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); + } } private static void CreateCurrentHttpContextGetter() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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: <fab...@us...> - 2010-09-19 12:31:38
|
Revision: 5191 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5191&view=rev Author: fabiomaulo Date: 2010-09-19 12:31:31 +0000 (Sun, 19 Sep 2010) Log Message: ----------- Added missed cache config in loquacious Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Cfg/Loquacious/CacheConfiguration.cs trunk/nhibernate/src/NHibernate/Cfg/Loquacious/ICacheConfiguration.cs Modified: trunk/nhibernate/src/NHibernate/Cfg/Loquacious/CacheConfiguration.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Cfg/Loquacious/CacheConfiguration.cs 2010-09-17 16:25:16 UTC (rev 5190) +++ trunk/nhibernate/src/NHibernate/Cfg/Loquacious/CacheConfiguration.cs 2010-09-19 12:31:31 UTC (rev 5191) @@ -18,6 +18,11 @@ set { cfg.SetProperty(Environment.UseMinimalPuts, value.ToString().ToLowerInvariant()); } } + public bool UseQueryCache + { + set { cfg.SetProperty(Environment.UseQueryCache, value.ToString().ToLowerInvariant()); } + } + public string RegionsPrefix { set { cfg.SetProperty(Environment.CacheRegionPrefix, value); } @@ -35,7 +40,8 @@ public void QueryCache<TFactory>() where TFactory : IQueryCache { - cfg.SetProperty(Environment.QueryCacheFactory, typeof (TFactory).AssemblyQualifiedName); + UseQueryCache = true; + cfg.SetProperty(Environment.QueryCacheFactory, typeof(TFactory).AssemblyQualifiedName); } #endregion Modified: trunk/nhibernate/src/NHibernate/Cfg/Loquacious/ICacheConfiguration.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Cfg/Loquacious/ICacheConfiguration.cs 2010-09-17 16:25:16 UTC (rev 5190) +++ trunk/nhibernate/src/NHibernate/Cfg/Loquacious/ICacheConfiguration.cs 2010-09-19 12:31:31 UTC (rev 5191) @@ -13,6 +13,7 @@ public interface ICacheConfigurationProperties { bool UseMinimalPuts { set; } + bool UseQueryCache { set; } string RegionsPrefix { set; } byte DefaultExpiration { set; } void Provider<TProvider>() where TProvider : ICacheProvider; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jul...@us...> - 2010-09-17 16:25:22
|
Revision: 5190 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5190&view=rev Author: julian-maughan Date: 2010-09-17 16:25:16 +0000 (Fri, 17 Sep 2010) Log Message: ----------- Added GetDataBaseSchema method override to SybaseSQLAnywhere10Dialect, and refined XML comments. Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/SybaseSQLAnywhere10Dialect.cs trunk/nhibernate/src/NHibernate/Dialect/SybaseSQLAnywhere11Dialect.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/SybaseSQLAnywhere10Dialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/SybaseSQLAnywhere10Dialect.cs 2010-09-17 16:23:14 UTC (rev 5189) +++ trunk/nhibernate/src/NHibernate/Dialect/SybaseSQLAnywhere10Dialect.cs 2010-09-17 16:25:16 UTC (rev 5190) @@ -6,6 +6,7 @@ using NHibernate.Dialect.Function; using NHibernate.Dialect.Lock; +using NHibernate.Dialect.Schema; using NHibernate.Engine; using NHibernate.Exceptions; using NHibernate.Mapping; @@ -40,17 +41,13 @@ /// /// </summary> /// <remarks> - /// The SybaseSQLAnywhere10Dialect defaults the following configuration properties: + /// The dialect 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> @@ -882,5 +879,10 @@ { get { return true; } } + + public override IDataBaseSchema GetDataBaseSchema(DbConnection connection) + { + return new SybaseAnywhereDataBaseMetaData(connection); + } } } \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/Dialect/SybaseSQLAnywhere11Dialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/SybaseSQLAnywhere11Dialect.cs 2010-09-17 16:23:14 UTC (rev 5189) +++ trunk/nhibernate/src/NHibernate/Dialect/SybaseSQLAnywhere11Dialect.cs 2010-09-17 16:25:16 UTC (rev 5190) @@ -25,17 +25,13 @@ /// /// </summary> /// <remarks> - /// The SybaseSQLAnywhere11Dialect defaults the following configuration properties: + /// The dialect 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> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jul...@us...> - 2010-09-17 16:23:20
|
Revision: 5189 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5189&view=rev Author: julian-maughan Date: 2010-09-17 16:23:14 +0000 (Fri, 17 Sep 2010) Log Message: ----------- Deletion omitted from previous commit (rev. 5188) Removed Paths: ------------- trunk/nhibernate/src/NHibernate/Dialect/Sybase11Dialect.cs Deleted: trunk/nhibernate/src/NHibernate/Dialect/Sybase11Dialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/Sybase11Dialect.cs 2010-09-17 16:13:14 UTC (rev 5188) +++ trunk/nhibernate/src/NHibernate/Dialect/Sybase11Dialect.cs 2010-09-17 16:23:14 UTC (rev 5189) @@ -1,93 +0,0 @@ -using System; -using NHibernate.Dialect; -using NHibernate.SqlCommand; -using NHibernate.Util; - -namespace NHibernate.Dialect -{ - /// <summary> - /// This is a subclass of SybaseDialect for sybase 11 databases (specifically tested against 11.9.2). 11.9.2 does not support ANSI JOINs - /// therefore we have to provide a special join fragment for left/right joins (*= and =* respectively). - /// </summary> - public class Sybase11Dialect : SybaseDialect - { - public override JoinFragment CreateOuterJoinFragment() - { - return new Sybase11JoinFragment(); - } - } - - /// <summary> - /// This class is basically a port of the hibernate 3.2 Sybase 11 join fragment. It uses concepts from that join fragment and the Oracle join fragment in NHibernate - /// </summary> - internal class Sybase11JoinFragment : JoinFragment - { - private readonly SqlStringBuilder afterFrom = new SqlStringBuilder(); - private readonly SqlStringBuilder afterWhere = new SqlStringBuilder(); - - public override void AddJoin(string tableName, string alias, string[] fkColumns, string[] pkColumns, JoinType joinType) - { - AddCrossJoin(tableName, alias); - - for ( int j=0; j<fkColumns.Length; j++) - { - //full joins are not supported.. yet! - if (joinType==JoinType.FullJoin ) throw new InvalidOperationException("full joins are not supported yet"); - - afterWhere.Add(" and " + fkColumns[j] ); - - if (joinType==JoinType.LeftOuterJoin) afterWhere.Add("*"); - afterWhere.Add("="); - if (joinType==JoinType.RightOuterJoin) afterWhere.Add("*"); - - afterWhere.Add (alias + StringHelper.Dot + pkColumns[j]); - } - } - - public override SqlString ToFromFragmentString - { - get { return afterFrom.ToSqlString(); } - } - - public override SqlString ToWhereFragmentString - { - get { return afterWhere.ToSqlString(); } - } - - public override void AddJoins(SqlString fromFragment, SqlString whereFragment) - { - afterFrom.Add(fromFragment); - afterWhere.Add(whereFragment); - } - - public override void AddCrossJoin(string tableName, string alias) - { - afterFrom.Add(StringHelper.CommaSpace) - .Add(tableName) - .Add(" ") - .Add(alias); - } - - public override void AddJoin(string tableName, string alias, string[] fkColumns, string[] pkColumns, JoinType joinType, - SqlString on) - { - AddJoin(tableName, alias, fkColumns, pkColumns, joinType); - AddCondition(on); - } - - public override bool AddCondition(string condition) - { - return AddCondition(afterWhere, condition); - } - - public override bool AddCondition(SqlString condition) - { - return AddCondition(afterWhere, condition); - } - - public override void AddFromFragmentString(SqlString fromFragmentString) - { - afterFrom.Add(fromFragmentString); - } - } -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jul...@us...> - 2010-09-17 16:13:27
|
Revision: 5188 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5188&view=rev Author: julian-maughan Date: 2010-09-17 16:13:14 +0000 (Fri, 17 Sep 2010) Log Message: ----------- Removed Sybase ASE dialects and drivers (deemed badly named, and poorly implemented). SybaseAnywhereDialect code merged into SybaseASA9Dialect, and then deleted. Marked the SybaseASA10Dialect obsolete with a comment suggesting users switch to SybaseSQLAnywhere10Dialect. Modified Paths: -------------- trunk/nhibernate/releasenotes.txt trunk/nhibernate/src/NHibernate/Dialect/SybaseASA10Dialect.cs trunk/nhibernate/src/NHibernate/Dialect/SybaseASA9Dialect.cs trunk/nhibernate/src/NHibernate/NHibernate.csproj trunk/nhibernate/src/NHibernate.Test/Legacy/FooBarTest.cs trunk/nhibernate/src/NHibernate.Test/Legacy/MasterDetailTest.cs trunk/nhibernate/src/NHibernate.Test/Legacy/MultiTableTest.cs trunk/nhibernate/src/NHibernate.Test/Legacy/SQLFunctionsTest.cs Removed Paths: ------------- trunk/nhibernate/src/NHibernate/Dialect/SybaseAdoNet12Dialect.cs trunk/nhibernate/src/NHibernate/Dialect/SybaseAnywhereDialect.cs trunk/nhibernate/src/NHibernate/Dialect/SybaseDialect.cs trunk/nhibernate/src/NHibernate/Driver/SybaseAdoNet12ClientDriver.cs trunk/nhibernate/src/NHibernate/Driver/SybaseClientDriver.cs Modified: trunk/nhibernate/releasenotes.txt =================================================================== --- trunk/nhibernate/releasenotes.txt 2010-09-17 15:44:32 UTC (rev 5187) +++ trunk/nhibernate/releasenotes.txt 2010-09-17 16:13:14 UTC (rev 5188) @@ -1,8 +1,9 @@ -Build 3.0.0.Alpha2 +Build 3.0.0.Alpha3 ============================= -** Known BREAKING CHANGES from NH2.1.1.GA to NH3.0.0.Alpha2 +** Known BREAKING CHANGES from NH2.1.1.GA to NH3.0.0.Alpha3 ##### Run time ##### * (NH-2199) - null values in maps/dictionaries are no longer silenty ignored/deleted + * (NH-1894) - SybaseAnywhereDialect has been removed, and replaced with SybaseASA9Dialect ##### Possible Breaking Changes ##### * (NH-2251) - Signature change for GetLimitString in Dialect Modified: trunk/nhibernate/src/NHibernate/Dialect/SybaseASA10Dialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/SybaseASA10Dialect.cs 2010-09-17 15:44:32 UTC (rev 5187) +++ trunk/nhibernate/src/NHibernate/Dialect/SybaseASA10Dialect.cs 2010-09-17 16:13:14 UTC (rev 5188) @@ -1,7 +1,9 @@ -using System.Data; +using System; +using System.Data; namespace NHibernate.Dialect { + [Obsolete("Please use SybaseSQLAnywhere10Dialect instead. This dialect will be removed in a future release.")] public class SybaseASA10Dialect : SybaseASA9Dialect { public SybaseASA10Dialect() Modified: trunk/nhibernate/src/NHibernate/Dialect/SybaseASA9Dialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/SybaseASA9Dialect.cs 2010-09-17 15:44:32 UTC (rev 5187) +++ trunk/nhibernate/src/NHibernate/Dialect/SybaseASA9Dialect.cs 2010-09-17 16:13:14 UTC (rev 5188) @@ -1,15 +1,44 @@ using System.Data; using System.Data.Common; + +using NHibernate.Cfg; using NHibernate.Dialect.Function; using NHibernate.Dialect.Schema; using NHibernate.SqlCommand; namespace NHibernate.Dialect { - public class SybaseASA9Dialect : SybaseAnywhereDialect + /// <summary> + /// An SQL dialect for Sybase Adaptive Server Anywhere 9.0 + /// </summary> + /// <remarks> + /// <p> + /// This dialect probably will not work with schema-export. If anyone out there + /// can fill in the ctor with DbTypes to Strings that would be helpful. + /// </p> + /// The dialect defaults the following configuration properties: + /// <list type="table"> + /// <listheader> + /// <term>Property</term> + /// <description>Default Value</description> + /// </listheader> + /// <item> + /// <term>connection.driver_class</term> + /// <description><see cref="NHibernate.Driver.ASAClientDriver" /></description> + /// </item> + /// <item> + /// <term>prepare_sql</term> + /// <description><see langword="false" /></description> + /// </item> + /// </list> + /// </remarks> + public class SybaseASA9Dialect : Dialect { public SybaseASA9Dialect() { + DefaultProperties[Environment.ConnectionDriver] = "NHibernate.Driver.ASAClientDriver"; + DefaultProperties[Environment.PrepareSql] = "false"; + RegisterColumnType(DbType.AnsiStringFixedLength, 255, "CHAR($l)"); RegisterColumnType(DbType.AnsiString, "VARCHAR(255)"); RegisterColumnType(DbType.AnsiString, 255, "VARCHAR($l)"); @@ -48,8 +77,10 @@ RegisterFunction("nullif", new StandardSafeSQLFunction("nullif", 2)); RegisterFunction("lower", new StandardSafeSQLFunction("lower", NHibernateUtil.String, 1)); RegisterFunction("upper", new StandardSafeSQLFunction("upper", NHibernateUtil.String, 1)); - ; + RegisterFunction("now", new StandardSQLFunction("now")); + + RegisterKeyword("top"); } public override bool SupportsLimit @@ -73,7 +104,59 @@ { return new SybaseAnywhereDataBaseMetaData(connection); } + + public override string AddColumnString + { + get { return "add"; } + } + public override string NullColumnString + { + get { return " null"; } + } + + public override bool QualifyIndexName + { + get { return false; } + } + + public override string ForUpdateString + { + get { return string.Empty; } + } + + public override bool SupportsIdentityColumns + { + get { return true; } + } + + public override string IdentitySelectString + { + get { return "select @@identity"; } + } + + /// <summary></summary> + public override string IdentityColumnString + { + get { return "IDENTITY NOT NULL"; } + } + + /// <summary></summary> + public override string NoColumnsInsertString + { + get { return "DEFAULT VALUES"; } + } + + /// <summary> + /// ASA does not require to drop constraint before dropping tables, and DROP statement + /// syntax used by Hibernate to drop constraint is not compatible with ASA, so disable it. + /// Comments matchs SybaseAnywhereDialect from Hibernate-3.1 src + /// </summary> + public override bool DropConstraints + { + get { return false; } + } + private static int GetAfterSelectInsertPoint(SqlString sql) { string[] arrSelectStrings = {"select distinct", "select all", "select"}; Deleted: trunk/nhibernate/src/NHibernate/Dialect/SybaseAdoNet12Dialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/SybaseAdoNet12Dialect.cs 2010-09-17 15:44:32 UTC (rev 5187) +++ trunk/nhibernate/src/NHibernate/Dialect/SybaseAdoNet12Dialect.cs 2010-09-17 16:13:14 UTC (rev 5188) @@ -1,101 +0,0 @@ -using NHibernate.Cfg; - -namespace NHibernate.Dialect -{ - /// <summary> - /// An SQL dialect compatible with Sybase. - /// </summary> - /// <remarks> - /// <p> - /// This dialect probably will not work with schema-export. If anyone out there - /// can fill in the ctor with DbTypes to Strings that would be helpful. - /// </p> - /// The SybaseDialect 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.SybaseClientDriver" /></description> - /// </item> - /// <item> - /// <term>prepare_sql</term> - /// <description><see langword="false" /></description> - /// </item> - /// </list> - /// </remarks> - public class SybaseAdoNet12Dialect : Dialect - { - /// <summary></summary> - public SybaseAdoNet12Dialect() - { - RegisterKeyword("top"); - - DefaultProperties[Environment.ConnectionDriver] = "NHibernate.Driver.SybaseAdoNet12ClientDriver"; - DefaultProperties[Environment.PrepareSql] = "true"; - } - - /// <summary></summary> - public override string AddColumnString - { - get { return "add"; } - } - - /// <summary></summary> - public override string NullColumnString - { - get { return " null"; } - } - - /// <summary></summary> - public override bool QualifyIndexName - { - get { return false; } - } - - /// <summary></summary> - public override string ForUpdateString - { - get { return string.Empty; } - } - - /// <summary></summary> - public override bool SupportsIdentityColumns - { - get { return true; } - } - - /// <summary></summary> - public override string IdentitySelectString - { - get { return "select @@identity"; } - } - - /// <summary></summary> - public override string IdentityColumnString - { - get { return "IDENTITY NOT NULL"; } - } - - /// <summary></summary> - public override string NoColumnsInsertString - { - get { return "DEFAULT VALUES"; } - } - - /// <remarks> - /// Sybase does not support quoted aliases, this function thus returns - /// <c>aliasName</c> as is. - /// </remarks> - public override string QuoteForAliasName(string aliasName) - { - return aliasName; - } - } -} \ No newline at end of file Deleted: trunk/nhibernate/src/NHibernate/Dialect/SybaseAnywhereDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/SybaseAnywhereDialect.cs 2010-09-17 15:44:32 UTC (rev 5187) +++ trunk/nhibernate/src/NHibernate/Dialect/SybaseAnywhereDialect.cs 2010-09-17 16:13:14 UTC (rev 5188) @@ -1,116 +0,0 @@ -using NHibernate.Cfg; - -namespace NHibernate.Dialect -{ - /// <summary> - /// An SQL dialect for Sybase Adaptive Server Anywhere 9.0/10.0 - /// </summary> - /// <remarks> - /// <p> - /// This dialect probably will not work with schema-export. If anyone out there - /// can fill in the ctor with DbTypes to Strings that would be helpful. - /// </p> - /// The SybaseAnywhereDialect 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.SybaseClientDriver" /></description> - /// </item> - /// <item> - /// <term>prepare_sql</term> - /// <description><see langword="false" /></description> - /// </item> - /// </list> - /// </remarks> - public class SybaseAnywhereDialect : Dialect - { - /// <summary></summary> - public SybaseAnywhereDialect() : base() - { - /* Java mapping was: - - Types.BIT, "TINYINT" ); - Types.BIGINT, "NUMERIC(19,0)" ); - Types.SMALLINT, "SMALLINT" ); - Types.TINYINT, "TINYINT" ); - Types.INTEGER, "INT" ); - Types.CHAR, "CHAR(1)" ); - Types.VARCHAR, "VARCHAR($l)" ); - Types.FLOAT, "FLOAT" ); - Types.DOUBLE, "DOUBLE PRECISION" - Types.DATE, "DATETIME" ); - Types.TIME, "DATETIME" ); - Types.TIMESTAMP, "DATETIME" ); - Types.VARBINARY, "VARBINARY($l)" - Types.NUMERIC, "NUMERIC(19,$l)" - Types.BLOB, "IMAGE" ); - Types.CLOB, "TEXT" ); - */ - - RegisterKeyword("top"); - - DefaultProperties[Environment.ConnectionDriver] = "NHibernate.Driver.ASAClientDriver"; - DefaultProperties[Environment.PrepareSql] = "false"; - } - - public override string AddColumnString - { - get { return "add"; } - } - - public override string NullColumnString - { - get { return " null"; } - } - - public override bool QualifyIndexName - { - get { return false; } - } - - public override string ForUpdateString - { - get { return string.Empty; } - } - - public override bool SupportsIdentityColumns - { - get { return true; } - } - - public override string IdentitySelectString - { - get { return "select @@identity"; } - } - - /// <summary></summary> - public override string IdentityColumnString - { - get { return "IDENTITY NOT NULL"; } - } - - /// <summary></summary> - public override string NoColumnsInsertString - { - get { return "DEFAULT VALUES"; } - } - - /// <summary> - /// ASA does not require to drop constraint before dropping tables, and DROP statement - /// syntax used by Hibernate to drop constraint is not compatible with ASA, so disable it. - /// Comments matchs SybaseAnywhereDialect from Hibernate-3.1 src - /// </summary> - public override bool DropConstraints - { - get { return false; } - } - } -} Deleted: trunk/nhibernate/src/NHibernate/Dialect/SybaseDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/SybaseDialect.cs 2010-09-17 15:44:32 UTC (rev 5187) +++ trunk/nhibernate/src/NHibernate/Dialect/SybaseDialect.cs 2010-09-17 16:13:14 UTC (rev 5188) @@ -1,192 +0,0 @@ -using System.Data; -using NHibernate.Cfg; -using NHibernate.Dialect.Function; - -namespace NHibernate.Dialect -{ - /// <summary> - /// An SQL dialect compatible with Sybase. - /// </summary> - /// <remarks> - /// <p> - /// This dialect probably will not work with schema-export. If anyone out there - /// can fill in the ctor with DbTypes to Strings that would be helpful. - /// </p> - /// The SybaseDialect 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.SybaseClientDriver" /></description> - /// </item> - /// <item> - /// <term>prepare_sql</term> - /// <description><see langword="false" /></description> - /// </item> - /// </list> - /// </remarks> - public class SybaseDialect : Dialect - { - /// <summary></summary> - public SybaseDialect() - { - RegisterColumnType(DbType.Boolean, "tinyint"); //Sybase BIT type does not support null values - RegisterColumnType(DbType.Int16, "smallint"); - RegisterColumnType(DbType.Int32, "int"); - RegisterColumnType(DbType.Int64, "numeric(19,0)"); - RegisterColumnType(DbType.UInt16, "smallint"); - RegisterColumnType(DbType.UInt32, "int"); - RegisterColumnType(DbType.UInt64, "numeric(19,0)"); - - RegisterColumnType(DbType.Byte, "tinyint"); - - RegisterColumnType(DbType.AnsiStringFixedLength, "char(255)"); - RegisterColumnType(DbType.AnsiStringFixedLength, 800, "char($l)"); - RegisterColumnType(DbType.AnsiString, "varchar(255)"); - RegisterColumnType(DbType.AnsiString, 8000, "varchar($l)"); - - RegisterColumnType(DbType.String, "varchar(255)"); - RegisterColumnType(DbType.String, 8000, "varchar($l)"); - RegisterColumnType(DbType.String, "text"); - - RegisterColumnType(DbType.Single, "float"); - RegisterColumnType(DbType.Double, "double precision"); - RegisterColumnType(DbType.Date, "datetime"); - RegisterColumnType(DbType.Time, "datetime"); - RegisterColumnType(DbType.DateTime, "datetime"); - - RegisterColumnType(DbType.Binary, 8000, "varbinary($l)"); - RegisterColumnType(DbType.Binary, "varbinary(8000)"); - RegisterColumnType(DbType.Binary, int.MaxValue, "image"); - - RegisterColumnType(DbType.Decimal, "numeric(19,6)"); - RegisterColumnType(DbType.Decimal, 19, "numeric($p,$s)"); - - RegisterFunction("ascii", new StandardSQLFunction("ascii", NHibernateUtil.Int32)); - RegisterFunction("char", new StandardSQLFunction("char", NHibernateUtil.Character)); - RegisterFunction("len", new StandardSQLFunction("len", NHibernateUtil.Int64)); - RegisterFunction("lower", new StandardSQLFunction("lower")); - RegisterFunction("upper", new StandardSQLFunction("upper")); - RegisterFunction("str", new StandardSQLFunction("str", NHibernateUtil.String)); - RegisterFunction("ltrim", new StandardSQLFunction("ltrim")); - RegisterFunction("rtrim", new StandardSQLFunction("rtrim")); - RegisterFunction("reverse", new StandardSQLFunction("reverse")); - RegisterFunction("space", new StandardSQLFunction("space", NHibernateUtil.String)); - - RegisterFunction("user", new NoArgSQLFunction("user", NHibernateUtil.String)); - - RegisterFunction("current_timestamp", new NoArgSQLFunction("getdate", NHibernateUtil.DateTime)); - RegisterFunction("current_time", new NoArgSQLFunction("getdate", NHibernateUtil.Time)); - RegisterFunction("current_date", new NoArgSQLFunction("getdate", NHibernateUtil.Date)); - - RegisterFunction("getdate", new NoArgSQLFunction("getdate", NHibernateUtil.Timestamp)); - RegisterFunction("getutcdate", new NoArgSQLFunction("getutcdate", NHibernateUtil.Timestamp)); - RegisterFunction("day", new StandardSQLFunction("day", NHibernateUtil.Int32)); - RegisterFunction("month", new StandardSQLFunction("month", NHibernateUtil.Int32)); - RegisterFunction("year", new StandardSQLFunction("year", NHibernateUtil.Int32)); - RegisterFunction("datename", new StandardSQLFunction("datename", NHibernateUtil.String)); - - RegisterFunction("abs", new StandardSQLFunction("abs")); - RegisterFunction("sign", new StandardSQLFunction("sign", NHibernateUtil.Int32)); - - RegisterFunction("acos", new StandardSQLFunction("acos", NHibernateUtil.Double)); - RegisterFunction("asin", new StandardSQLFunction("asin", NHibernateUtil.Double)); - RegisterFunction("atan", new StandardSQLFunction("atan", NHibernateUtil.Double)); - RegisterFunction("cos", new StandardSQLFunction("cos", NHibernateUtil.Double)); - RegisterFunction("cot", new StandardSQLFunction("cot", NHibernateUtil.Double)); - RegisterFunction("exp", new StandardSQLFunction("exp", NHibernateUtil.Double)); - RegisterFunction("log", new StandardSQLFunction("log", NHibernateUtil.Double)); - RegisterFunction("log10", new StandardSQLFunction("log10", NHibernateUtil.Double)); - RegisterFunction("sin", new StandardSQLFunction("sin", NHibernateUtil.Double)); - RegisterFunction("sqrt", new StandardSQLFunction("sqrt", NHibernateUtil.Double)); - RegisterFunction("tan", new StandardSQLFunction("tan", NHibernateUtil.Double)); - RegisterFunction("pi", new NoArgSQLFunction("pi", NHibernateUtil.Double)); - RegisterFunction("square", new StandardSQLFunction("square")); - RegisterFunction("rand", new StandardSQLFunction("rand", NHibernateUtil.Single)); - - RegisterFunction("radians", new StandardSQLFunction("radians", NHibernateUtil.Double)); - RegisterFunction("degrees", new StandardSQLFunction("degrees", NHibernateUtil.Double)); - - RegisterFunction("round", new StandardSQLFunction("round")); - RegisterFunction("ceiling", new StandardSQLFunction("ceiling")); - RegisterFunction("floor", new StandardSQLFunction("floor")); - - RegisterFunction("isnull", new StandardSQLFunction("isnull")); - - RegisterFunction("concat", new VarArgsSQLFunction(NHibernateUtil.String, "(", "+", ")")); - - RegisterFunction("length", new StandardSQLFunction("len", NHibernateUtil.Int32)); - RegisterFunction("trim", new SQLFunctionTemplate(NHibernateUtil.String, "ltrim(rtrim(?1))")); - RegisterFunction("locate", new CharIndexFunction()); - - RegisterKeyword("top"); - - DefaultProperties[Environment.ConnectionDriver] = "NHibernate.Driver.SybaseClientDriver"; - DefaultProperties[Environment.PrepareSql] = "false"; - } - - /// <summary></summary> - public override string AddColumnString - { - get { return "add"; } - } - - /// <summary></summary> - public override string NullColumnString - { - get { return " null"; } - } - - /// <summary></summary> - public override bool QualifyIndexName - { - get { return false; } - } - - /// <summary></summary> - public override string ForUpdateString - { - get { return string.Empty; } - } - - /// <summary></summary> - public override bool SupportsIdentityColumns - { - get { return true; } - } - - /// <summary></summary> - public override string IdentitySelectString - { - get { return "select @@identity"; } - } - - /// <summary></summary> - public override string IdentityColumnString - { - get { return "IDENTITY NOT NULL"; } - } - - /// <summary></summary> - public override string NoColumnsInsertString - { - get { return "DEFAULT VALUES"; } - } - - /// <remarks> - /// Sybase does not support quoted aliases, this function thus returns - /// <c>aliasName</c> as is. - /// </remarks> - public override string QuoteForAliasName(string aliasName) - { - return aliasName; - } - } -} Deleted: trunk/nhibernate/src/NHibernate/Driver/SybaseAdoNet12ClientDriver.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Driver/SybaseAdoNet12ClientDriver.cs 2010-09-17 15:44:32 UTC (rev 5187) +++ trunk/nhibernate/src/NHibernate/Driver/SybaseAdoNet12ClientDriver.cs 2010-09-17 16:13:14 UTC (rev 5188) @@ -1,50 +0,0 @@ -namespace NHibernate.Driver -{ - /// <summary> - /// The SybaseClientDriver Driver provides a database driver for Sybase. - /// </summary> - /// <remarks> - /// It has been reported to work with the <see cref="Dialect.MsSql2000Dialect"/>. - /// </remarks> - public class SybaseAdoNet12ClientDriver : ReflectionBasedDriver - { - /// <summary> - /// Initializes a new instance of the <see cref="SybaseClientDriver"/> class. - /// </summary> - /// <exception cref="HibernateException"> - /// Thrown when the Sybase.Data.AseClient assembly can not be loaded. - /// </exception> - public SybaseAdoNet12ClientDriver() - : base( - "Sybase.Data.AseClient", - "Sybase.AdoNet2.AseClient", - "Sybase.Data.AseClient.AseConnection", - "Sybase.Data.AseClient.AseCommand") - { - } - - /// <summary> - /// Sybase.Data.AseClient uses named parameters in the sql. - /// </summary> - /// <value><see langword="true" /> - Sybase uses <c>@</c> in the sql.</value> - public override bool UseNamedPrefixInSql - { - get { return true; } - } - - /// <summary></summary> - public override bool UseNamedPrefixInParameter - { - get { return true; } - } - - /// <summary> - /// Sybase.Data.AseClient use the <c>@</c> to locate parameters in sql. - /// </summary> - /// <value><c>@</c> is used to locate parameters in sql.</value> - public override string NamedPrefix - { - get { return "@"; } - } - } -} \ No newline at end of file Deleted: trunk/nhibernate/src/NHibernate/Driver/SybaseClientDriver.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Driver/SybaseClientDriver.cs 2010-09-17 15:44:32 UTC (rev 5187) +++ trunk/nhibernate/src/NHibernate/Driver/SybaseClientDriver.cs 2010-09-17 16:13:14 UTC (rev 5188) @@ -1,51 +0,0 @@ -using System; - -namespace NHibernate.Driver -{ - /// <summary> - /// The SybaseClientDriver Driver provides a database driver for Sybase. - /// </summary> - /// <remarks> - /// It has been reported to work with the <see cref="Dialect.MsSql2000Dialect"/>. - /// </remarks> - public class SybaseClientDriver : ReflectionBasedDriver - { - /// <summary> - /// Initializes a new instance of the <see cref="SybaseClientDriver"/> class. - /// </summary> - /// <exception cref="HibernateException"> - /// Thrown when the Sybase.Data.AseClient assembly can not be loaded. - /// </exception> - public SybaseClientDriver() : base( - "Sybase.Data.AseClient", - "Sybase.Data.AseClient", - "Sybase.Data.AseClient.AseConnection", - "Sybase.Data.AseClient.AseCommand") - { - } - - /// <summary> - /// Sybase.Data.AseClient uses named parameters in the sql. - /// </summary> - /// <value><see langword="true" /> - Sybase uses <c>@</c> in the sql.</value> - public override bool UseNamedPrefixInSql - { - get { return true; } - } - - /// <summary></summary> - public override bool UseNamedPrefixInParameter - { - get { return true; } - } - - /// <summary> - /// Sybase.Data.AseClient use the <c>@</c> to locate parameters in sql. - /// </summary> - /// <value><c>@</c> is used to locate parameters in sql.</value> - public override string NamedPrefix - { - get { return "@"; } - } - } -} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2010-09-17 15:44:32 UTC (rev 5187) +++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2010-09-17 16:13:14 UTC (rev 5188) @@ -118,7 +118,6 @@ <Compile Include="Dialect\MySQLDialect.cs" /> <Compile Include="Dialect\PostgreSQLDialect.cs" /> <Compile Include="Dialect\SQLiteDialect.cs" /> - <Compile Include="Dialect\SybaseDialect.cs" /> <Compile Include="Dialect\SybaseSQLAnywhere10Dialect.cs" /> <Compile Include="Dialect\SybaseSQLAnywhere11Dialect.cs" /> <Compile Include="Dialect\TypeNames.cs" /> @@ -136,7 +135,6 @@ <Compile Include="Driver\OracleDataClientDriver.cs" /> <Compile Include="Driver\SqlClientDriver.cs" /> <Compile Include="Driver\SQLiteDriver.cs" /> - <Compile Include="Driver\SybaseClientDriver.cs" /> <Compile Include="Engine\Cascade.cs" /> <Compile Include="Engine\IBatcher.cs" /> <Compile Include="Engine\IMapping.cs" /> @@ -1022,13 +1020,10 @@ <Compile Include="Dialect\Schema\ITableMetadata.cs" /> <Compile Include="Dialect\Schema\MsSqlMetaData.cs" /> <Compile Include="Dialect\Schema\OracleMetaData.cs" /> - <Compile Include="Dialect\Sybase11Dialect.cs" /> - <Compile Include="Dialect\SybaseAdoNet12Dialect.cs" /> <Compile Include="Driver\ASA10ClientDriver.cs" /> <Compile Include="Driver\ISqlParameterFormatter.cs" /> <Compile Include="Driver\SqlStringFormatter.cs" /> <Compile Include="Criterion\SubqueryProjection.cs" /> - <Compile Include="Driver\SybaseAdoNet12ClientDriver.cs" /> <Compile Include="EmptyInterceptor.cs" /> <Compile Include="Engine\ActionQueue.cs" /> <Compile Include="Engine\AssociationKey.cs" /> @@ -1290,7 +1285,6 @@ <Compile Include="Dialect\IngresDialect.cs" /> <Compile Include="Dialect\MsSql2005Dialect.cs" /> <Compile Include="Dialect\PostgreSQL81Dialect.cs" /> - <Compile Include="Dialect\SybaseAnywhereDialect.cs" /> <Compile Include="Driver\ASAClientDriver.cs" /> <Compile Include="Driver\DB2400Driver.cs" /> <Compile Include="Driver\FirebirdClientDriver.cs" /> Modified: trunk/nhibernate/src/NHibernate.Test/Legacy/FooBarTest.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Legacy/FooBarTest.cs 2010-09-17 15:44:32 UTC (rev 5187) +++ trunk/nhibernate/src/NHibernate.Test/Legacy/FooBarTest.cs 2010-09-17 16:13:14 UTC (rev 5188) @@ -473,7 +473,7 @@ .List(); } - if ((Dialect is SybaseDialect) || (Dialect is MsSql2000Dialect)) + if (Dialect is MsSql2000Dialect) { s.CreateQuery("select baz from Baz as baz join baz.FooArray foo group by baz order by sum(foo.Float)").Enumerable(); } Modified: trunk/nhibernate/src/NHibernate.Test/Legacy/MasterDetailTest.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Legacy/MasterDetailTest.cs 2010-09-17 15:44:32 UTC (rev 5187) +++ trunk/nhibernate/src/NHibernate.Test/Legacy/MasterDetailTest.cs 2010-09-17 16:13:14 UTC (rev 5188) @@ -656,7 +656,7 @@ d2.Master = (m); m.AddDetail(d1); m.AddDetail(d2); - if ((Dialect is SybaseDialect) || (Dialect is MsSql2000Dialect)) + if (Dialect is MsSql2000Dialect) { s.Save(d1); } @@ -748,7 +748,7 @@ d2.Master = m; m.AddDetail(d1); m.AddDetail(d2); - if ((Dialect is SybaseDialect) || (Dialect is MsSql2000Dialect)) + if (Dialect is MsSql2000Dialect) { s.Save(d1); s.Save(d2); Modified: trunk/nhibernate/src/NHibernate.Test/Legacy/MultiTableTest.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Legacy/MultiTableTest.cs 2010-09-17 15:44:32 UTC (rev 5187) +++ trunk/nhibernate/src/NHibernate.Test/Legacy/MultiTableTest.cs 2010-09-17 16:13:14 UTC (rev 5188) @@ -155,7 +155,7 @@ ISession s = OpenSession(); long id = 1L; - if ((Dialect is SybaseDialect) || (Dialect is MsSql2000Dialect)) + if (Dialect is MsSql2000Dialect) { id = (long) s.Save(new TrivialClass()); } @@ -198,7 +198,7 @@ ITransaction t = s.BeginTransaction(); SubMulti sm = new SubMulti(); sm.Amount = 66.5f; - if ((Dialect is SybaseDialect) || (Dialect is MsSql2000Dialect)) + if (Dialect is MsSql2000Dialect) { s.Save(sm); } @@ -229,7 +229,7 @@ simp.Name = "simp"; object mid; object sid; - if ((Dialect is SybaseDialect) || (Dialect is MsSql2000Dialect)) + if (Dialect is MsSql2000Dialect) { mid = s.Save(multi); sid = s.Save(simp); @@ -244,7 +244,7 @@ SubMulti sm = new SubMulti(); sm.Amount = 66.5f; object smid; - if ((Dialect is SybaseDialect) || (Dialect is MsSql2000Dialect)) + if (Dialect is MsSql2000Dialect) { smid = s.Save(sm); } @@ -493,7 +493,7 @@ simp.Name = "simp"; object mid; object sid; - if ((Dialect is SybaseDialect) || (Dialect is MsSql2000Dialect)) + if (Dialect is MsSql2000Dialect) { mid = s.Save(multi); sid = s.Save(simp); @@ -515,7 +515,7 @@ dict.Add(multi); dict.Add(simp); object id; - if ((Dialect is SybaseDialect) || (Dialect is MsSql2000Dialect)) + if (Dialect is MsSql2000Dialect) { id = s.Save(ls); } @@ -572,7 +572,7 @@ simp.Name = "simp"; object mid; - if ((Dialect is SybaseDialect) || (Dialect is MsSql2000Dialect)) + if (Dialect is MsSql2000Dialect) { mid = s.Save(multi); } @@ -587,7 +587,7 @@ ls.YetAnother = ls; ls.Name = "Less Simple"; object id; - if ((Dialect is SybaseDialect) || (Dialect is MsSql2000Dialect)) + if (Dialect is MsSql2000Dialect) { id = s.Save(ls); } Modified: trunk/nhibernate/src/NHibernate.Test/Legacy/SQLFunctionsTest.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Legacy/SQLFunctionsTest.cs 2010-09-17 15:44:32 UTC (rev 5187) +++ trunk/nhibernate/src/NHibernate.Test/Legacy/SQLFunctionsTest.cs 2010-09-17 16:13:14 UTC (rev 5188) @@ -434,7 +434,7 @@ "from s in class Simple where not( upper(s.Name)='yada' or 1=2 or 'foo'='bar' or not('foo'='foo') or 'foo' like 'bar')") .List().Count); - if (!(Dialect is MySQLDialect) && !(Dialect is SybaseDialect) && !(Dialect is MsSql2000Dialect)) + if (!(Dialect is MySQLDialect) && !(Dialect is MsSql2000Dialect)) { // Dialect.MckoiDialect and Dialect.InterbaseDialect also included // My Sql has a funny concatenation operator @@ -442,13 +442,6 @@ s.CreateQuery("from s in class Simple where lower(s.Name || ' foo')='simple 1 foo'").List().Count); } - if ((Dialect is SybaseDialect)) - { - Assert.AreEqual(1, - s.CreateQuery("from s in class Simple where lower( concat(s.Name, ' foo') ) = 'simple 1 foo'").List - ().Count); - } - if ((Dialect is MsSql2000Dialect)) { Assert.AreEqual(1, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jul...@us...> - 2010-09-17 15:44:38
|
Revision: 5187 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5187&view=rev Author: julian-maughan Date: 2010-09-17 15:44:32 +0000 (Fri, 17 Sep 2010) Log Message: ----------- Improvement allowing Sybase SQL Anywhere/ASA dialect keywords to be ascertained using database metadata (ref. NH-2332). Thanks to Mark Junker. Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/Schema/SybaseAnywhereMetaData.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/Schema/SybaseAnywhereMetaData.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/Schema/SybaseAnywhereMetaData.cs 2010-09-16 15:21:57 UTC (rev 5186) +++ trunk/nhibernate/src/NHibernate/Dialect/Schema/SybaseAnywhereMetaData.cs 2010-09-17 15:44:32 UTC (rev 5187) @@ -2,6 +2,8 @@ using System.Data; using System.Data.Common; +using Iesi.Collections.Generic; + namespace NHibernate.Dialect.Schema { // Metadata for connections using the iAnywhere.Data.SQLAnywhere ADO.NET provider @@ -14,6 +16,17 @@ return new SybaseAnywhereTableMetaData(rs, this, extras); } + public override ISet<string> GetReservedWords() + { + var result = new HashedSet<string>(); + DataTable dtReservedWords = Connection.GetSchema(DbMetaDataCollectionNames.ReservedWords); + foreach (DataRow row in dtReservedWords.Rows) + { + result.Add(row["reserved_word"].ToString()); + } + return result; + } + public override DataTable GetTables(string catalog, string schemaPattern, string tableNamePattern, string[] types) { var restrictions = new[] {schemaPattern, tableNamePattern, null}; @@ -36,7 +49,7 @@ } public override DataTable GetColumns(string catalog, string schemaPattern, string tableNamePattern, - string columnNamePattern) + string columnNamePattern) { var restrictions = new[] {schemaPattern, tableNamePattern, null}; DataTable objTbl = Connection.GetSchema("Columns", restrictions); 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 supporting only + /// <tt>FOR UPDATE BY LOCK</tt>. + /// </summary> + public override bool ForUpdateOfColumns + { + get { return false; } + } + + /// <summary> + /// SQL Anywhere supports <tt>FOR UPDATE</tt> over cursors containing + /// outer joins. + /// </summary> + public override bool SupportsOuterJoinForUpdate + { + get { return true; } + } + + /// <summary> + /// Lock rows in the cursor explicitly using INTENT row locks. + /// </summary> + public override string ForUpdateString + { + get { return ForUpdateByLockString; } + } + + /// <summary> + /// Enforce the condition that this query is read-only. This ensure that certain + /// query rewrite optimizations, such as join elimination, can be used. + /// </summary> + public string ForReadOnlyString + { + get { return " FOR READ ONLY"; } + } + + /// <summary> + /// Lock rows in the cursor explicitly using INTENT row locks. + /// </summary> + public string ForUpdateByLockString + { + get { return " FOR UPDATE BY LOCK"; } + } + + /// <summary> + /// SQL Anywhere does not support <tt>FOR UPDATE NOWAIT</tt>. However, the intent + /// is to acquire pessimistic locks on the underlying rows; with NHibernate + /// one can accomplish this through setting the BLOCKING connection option. + /// Hence, with this API we lock rows in the cursor explicitly using INTENT row locks. + /// </summary> + public override string ForUpdateNowaitString + { + get { return ForUpdateByLockString; } + } + + /// <summary> + /// We assume that applications using this dialect are NOT using + /// SQL Anywhere's snapshot isolation modes. + /// </summary> + public override bool DoesReadCommittedCauseWritersToBlockReaders + { + get { return true; } + } + + /// <summary> + /// We assume that applications using this dialect are NOT using + /// SQL Anywhere's snapshot isolation modes. + /// </summary> + public override bool DoesRepeatableReadCauseReadersToBlockWriters + { + get { return true; } + } + + // SQL Anywhere-specific query syntax + + public override bool SupportsCurrentTimestampSelection + { + get { return true; } + } + + public override string CurrentTimestampSQLFunctionName + { + get { return "GETDATE"; } + } + + public override bool IsCurrentTimestampSelectStringCallable + { + get { return false; } + } + + public override string CurrentTimestampSelectString + { + get { return "SELECT GETDATE()"; } + } + + /// <summary> + /// SQL Anywhere supports both double quotes or '[' (Microsoft syntax) for + /// quoted identifiers. + /// + /// Note that quoted identifiers are controlled through + /// the QUOTED_IDENTIFIER connection option. + /// </summary> + public override char CloseQuote + { + get { return '"'; } + } + + /// <summary> + /// SQL Anywhere supports both double quotes or '[' (Microsoft syntax) for + /// quoted identifiers. + /// </summary> + public override char OpenQuote + { + get { return '"'; } + } + + #endregion + + #region Informational metadata + + /// <summary> + /// SQL Anywhere Does not support empty IN lists. + /// </summary> + public override bool SupportsEmptyInList + { + get { return false; } + } + + /// <summary> + /// SQL Anywhere's implementation of KEYSET-DRIVEN cursors does not + /// permit absolute postioning. With jConnect as the driver, this support + /// will succeed because jConnect FETCHes the entire result set to the client + /// first; it will fail with the iAnywhere JDBC driver. Because the server + /// may decide to use a KEYSET cursor even if the cursor is declared as + /// FORWARD ONLY, this support is disabled. + /// </summary> + public override bool SupportsResultSetPositionQueryMethodsOnForwardOnlyCursor + { + get { return false; } + } + + /// <summary> + /// SQL Anywhere does not support an EXISTS clause within a + /// SELECT list. + /// </summary> + public override bool SupportsExistsInSelect + { + get { return false; } + } + + /// <summary> + /// By default, the SQL Anywhere dbinit utility creates a + /// case-insensitive database for the CHAR collation. This can + /// be changed through the use of the -c command line switch on + /// dbinit, and the setting may differ for the NCHAR collation + /// for national character sets. Whether or not a database + /// supports case-sensitive comparisons can be determined via + /// the DB_Extended_property() function, for example + /// + /// SELECT DB_EXTENDED_PROPERTY( 'Collation', 'CaseSensitivity'); + /// </summary> + public override bool AreStringComparisonsCaseInsensitive + { + get { return true; } + } + + #endregion + + #region DDL support + + /// <summary> + /// SQL Anywhere supports <tt>COMMENT ON</tt> statements for a wide variety of + /// database objects. When the COMMENT statement is executed an implicit + /// <tt>COMMIT</tt> is performed. However, COMMENT syntax for <tt>CREATE TABLE</tt>, as + /// expected by NHibernate (see Table.cs), is not supported. + /// </summary> + public override bool SupportsCommentOn + { + get { return false; } + } + + public override int MaxAliasLength + { + get { return 127; } + } + + public override string AddColumnString + { + get { return "ADD "; } + } + + public override string NullColumnString + { + get { return " NULL"; } + } + + /// <summary> + /// SQL Anywhere does not require qualification of index names. + /// </summary> + public override bool QualifyIndexName + { + get { return false; } + } + + /// <summary> + /// SQL Anywhere currently supports only "VALUES (DEFAULT)", not + /// the ANSI standard "DEFAULT VALUES". This latter syntax will be + /// supported in the SQL Anywhere 11.0.1 release. For the moment, + /// "VALUES (DEFAULT)" works only for a single-column table. + /// </summary> + public override string NoColumnsInsertString + { + get { return " VALUES (DEFAULT) "; } + } + + /// <summary> + /// SQL Anywhere does not require dropping a constraint before + /// dropping a table, and the DROP statement syntax used by Hibernate + /// to drop a constraint is not compatible with SQL Anywhere, so disable it. + /// </summary> + public override bool DropConstraints + { + get { return false; } + } + + public override string DropForeignKeyString + // ALTER TABLE DROP FOREIGN KEY <foo> + { + get { return " DROP FOREIGN KEY "; } + } + + #endregion + + #region Temporary table support + + public override bool SupportsTemporaryTables + { + get { return true; } + } + + /// <summary> + /// In SQL Anywhere, the syntax + /// + /// DECLARE LOCAL TEMPORARY TABLE ... + /// + /// can also be used, which creates a temporary table with procedure scope, + /// which may be important for stored procedures. + /// </summary> + public override string CreateTemporaryTableString + { + get { return "CREATE LOCAL TEMPORARY TABLE "; } + } + + /// <summary> + /// Assume that temporary table rows should be preserved across COMMITs. + /// </summary> + public override string CreateTemporaryTablePostfix + { + get { return " ON COMMIT PRESERVE ROWS "; } + } + + /// <summary> + /// SQL Anywhere 10 does not perform a COMMIT upon creation of + /// a temporary table. However, it does perform an implicit + /// COMMIT when creating an index over a temporary table, or + /// upon ALTERing the definition of temporary table. + /// </summary> + public override bool? PerformTemporaryTableDDLInIsolation() + { + return null; + } + + #endregion + + #region Callable statement support + + /// <summary> + /// SQL Anywhere does support OUT parameters with callable stored procedures. + /// </summary> + public override int RegisterResultSetOutParameter( DbCommand statement, int position ) + { + return position; + } + + public override DbDataReader GetResultSet( DbCommand statement ) + { + DbDataReader rdr = statement.ExecuteReader(); + return rdr; + } + + #endregion + + public override string SelectGUIDString + { + get { return "select newid()"; } + } + + /// <summary> + /// SQL Anywhere does support query expressions containing UNION ALL. + /// </summary> + public override bool SupportsUnionAll + { + get { return true; } + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Dialect/SybaseSQLAnywhere11Dialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/SybaseSQLAnywhere11Dialect.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Dialect/SybaseSQLAnywhere11Dialect.cs 2010-09-16 15:21:57 UTC (rev 5186) @@ -0,0 +1,54 @@ +using System; + +namespace NHibernate.Dialect +{ + /// <summary> + /// SQL Dialect for SQL Anywhere 11 - 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 SybaseSQLAnywhere11Dialect 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 SybaseSQLAnywhere11Dialect : SybaseSQLAnywhere10Dialect + { + public SybaseSQLAnywhere11Dialect() : base() + { + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2010-09-14 15:31:30 UTC (rev 5185) +++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2010-09-16 15:21:57 UTC (rev 5186) @@ -119,6 +119,8 @@ <Compile Include="Dialect\PostgreSQLDialect.cs" /> <Compile Include="Dialect\SQLiteDialect.cs" /> <Compile Include="Dialect\SybaseDialect.cs" /> + <Compile Include="Dialect\SybaseSQLAnywhere10Dialect.cs" /> + <Compile Include="Dialect\SybaseSQLAnywhere11Dialect.cs" /> <Compile Include="Dialect\TypeNames.cs" /> <Compile Include="Driver\DB2Driver.cs" /> <Compile Include="Driver\DriverBase.cs" /> 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-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-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: <sb...@us...> - 2010-09-12 00:40:37
|
Revision: 5182 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5182&view=rev Author: sbohlen Date: 2010-09-12 00:40:28 +0000 (Sun, 12 Sep 2010) Log Message: ----------- Update Spring.NET ByteCodeProvider binary dependencies to Spring.NET 1.3 RTM to relieve conflict with NH's own ANTLR dependency (re: NH-2315) Modified Paths: -------------- trunk/nhibernate/lib/net/3.5/Spring.Aop.dll trunk/nhibernate/lib/net/3.5/Spring.Aop.xml trunk/nhibernate/lib/net/3.5/Spring.Core.dll trunk/nhibernate/lib/net/3.5/Spring.Core.xml Modified: trunk/nhibernate/lib/net/3.5/Spring.Aop.dll =================================================================== (Binary files differ) Modified: trunk/nhibernate/lib/net/3.5/Spring.Aop.xml =================================================================== --- trunk/nhibernate/lib/net/3.5/Spring.Aop.xml 2010-09-11 13:09:24 UTC (rev 5181) +++ trunk/nhibernate/lib/net/3.5/Spring.Aop.xml 2010-09-12 00:40:28 UTC (rev 5182) @@ -26,30 +26,34 @@ <member name="T:Spring.Aop.Config.AopNamespaceUtils"> <summary> Utility class for handling registration of auto-proxy creators used internally by the - <code>aop</code> namespace tags. + <code>aop</code> and <code>tx</code> namespace tags. </summary> <author>Rob Harrop</author> <author>Juergen Hoeller</author> <author>Mark Pollack (.NET)</author> + <author>Erich Eichinger (.NET)</author> </member> <member name="F:Spring.Aop.Config.AopNamespaceUtils.AUTO_PROXY_CREATOR_OBJECT_NAME"> <summary> The object name of the internally managed auto-proxy creator. </summary> </member> + <member name="F:Spring.Aop.Config.AopNamespaceUtils.InfrastructureAutoProxyCreatorType"> + <summary> + The type of the APC that handles advisors with object role <see cref="F:Spring.Objects.Factory.Config.ObjectRole.ROLE_INFRASTRUCTURE"/>. + </summary> + </member> <member name="M:Spring.Aop.Config.AopNamespaceUtils.RegisterAutoProxyCreatorIfNecessary(Spring.Objects.Factory.Xml.ParserContext,System.Xml.XmlElement)"> <summary> - Registers the auto proxy creator if necessary. + Registers the internal auto proxy creator if necessary. </summary> <param name="parserContext">The parser context.</param> <param name="sourceElement">The source element.</param> </member> - <member name="M:Spring.Aop.Config.AopNamespaceUtils.RegisterApcAsRequired(System.Type,Spring.Objects.Factory.Xml.ParserContext)"> + <member name="M:Spring.Aop.Config.AopNamespaceUtils.RegisterAutoProxyCreatorIfNecessary(Spring.Objects.Factory.Support.IObjectDefinitionRegistry)"> <summary> - Registries the or escalate apc as required. + Registers the internal auto proxy creator if necessary. </summary> - <param name="type">The type.</param> - <param name="parserContext">The parser context.</param> </member> <member name="M:Spring.Aop.Config.AopNamespaceUtils.ForceAutoProxyCreatorToUseDecoratorProxy(Spring.Objects.Factory.Support.IObjectDefinitionRegistry)"> <summary> @@ -965,15 +969,15 @@ </member> <member name="T:Spring.Aop.Framework.AutoProxy.AbstractAdvisorAutoProxyCreator"> <summary> - Abstract IOBjectPostProcessor implementation that creates AOP proxies. + Abstract IObjectPostProcessor implementation that creates AOP proxies. This class is completely generic; it contains no special code to handle any particular aspects, such as pooling aspects. </summary> <remarks> - <p>Subclasses must implement the abstract findCandidateAdvisors() method + <p>Subclasses must implement the abstract FindCandidateAdvisors() method to return a list of Advisors applying to any object. Subclasses can also - override the inherited shouldSkip() method to exclude certain objects - from autoproxying, but they must be careful to invoke the shouldSkip() + override the inherited ShouldSkip() method to exclude certain objects + from autoproxying, but they must be careful to invoke the ShouldSkip() method of this class, which tries to avoid circular reference problems and infinite loops.</p> <p>Advisors or advices requiring ordering should implement the Ordered interface. @@ -981,9 +985,10 @@ the Ordered interface will be considered to be unordered, and will appear at the end of the advisor chain in undefined order.</p> </remarks> - <seealso cref="M:Spring.Aop.Framework.AutoProxy.AbstractAdvisorAutoProxyCreator.FindCandidateAdvisors"/> + <seealso cref="M:Spring.Aop.Framework.AutoProxy.AbstractAdvisorAutoProxyCreator.FindCandidateAdvisors(System.Type,System.String)"/> <author>Rod Johnson</author> <author>Adhari C Mahendra (.NET)</author> + <author>Erich Eichinger</author> </member> <member name="T:Spring.Aop.Framework.AutoProxy.AbstractAutoProxyCreator"> <summary> @@ -1171,8 +1176,12 @@ </member> <member name="F:Spring.Aop.Framework.AutoProxy.AbstractAutoProxyCreator.freezeProxy"> <summary> - + Indicates whether to mark the create proxy as immutable. </summary> + <remarks> + Setting this to true effectively disables modifying the generated + proxy's advisor configuration + </remarks> </member> <member name="F:Spring.Aop.Framework.AutoProxy.AbstractAutoProxyCreator.interceptorNames"> <summary> @@ -1189,6 +1198,11 @@ (from "PostProcessBeforeInstantiation") in the "PostProcessAfterInitialization" method. </summary> </member> + <member name="M:Spring.Aop.Framework.AutoProxy.AbstractAutoProxyCreator.#ctor"> + <summary> + Create a new instance of this AutoProxyCreator + </summary> + </member> <member name="M:Spring.Aop.Framework.AutoProxy.AbstractAutoProxyCreator.PostProcessAfterInitialization(System.Object,System.String)"> <summary> Create a proxy with the configured interceptors if the object is @@ -1210,8 +1224,8 @@ Sometimes we need to be able to avoid this happening if it will lead to a circular reference. This implementation returns false. </summary> - <param name="objectType">the type of the object</param> - <param name="objectName">the name of the object</param> + <param name="targetType">the type of the object</param> + <param name="targetName">the name of the object</param> <returns>if remarkable to skip</returns> </member> <member name="M:Spring.Aop.Framework.AutoProxy.AbstractAutoProxyCreator.CustomizeProxyFactory(Spring.Aop.Framework.ProxyFactory)"> @@ -1252,15 +1266,15 @@ advices (e.g. AOP Alliance interceptors) and advisors to apply. </summary> <remarks> - <p>The previous name of this method was "GetInterceptorAndAdvisorForObject". + <p>The previous targetName of this method was "GetInterceptorAndAdvisorForObject". It has been renamed in the course of general terminology clarification in Spring 1.1. An AOP Alliance Interceptor is just a special form of Advice, so the generic Advice term is preferred now.</p> <p>The third parameter, customTargetSource, is new in Spring 1.1; add it to existing implementations of this method.</p> </remarks> - <param name="objType">the new object instance</param> - <param name="name">the name of the object</param> + <param name="targetType">the new object instance</param> + <param name="targetName">the name of the object</param> <param name="customTargetSource">targetSource returned by TargetSource property: may be ignored. Will be null unless a custom target source is in use.</param> <returns>an array of additional interceptors for the particular object; @@ -1271,8 +1285,8 @@ <summary> Create an AOP proxy for the given object. </summary> - <param name="objectType">Type of the object.</param> - <param name="objectName">The name of the object.</param> + <param name="targetType">Type of the object.</param> + <param name="targetName">The name of the object.</param> <param name="specificInterceptors">The set of interceptors that is specific to this object (may be empty but not null)</param> <param name="targetSource">The target source for the proxy, already pre-configured to access the object.</param> @@ -1289,7 +1303,7 @@ Determines the advisors for the given object, including the specific interceptors as well as the common interceptor, all adapted to the Advisor interface. </summary> - <param name="objectName">The name of the object.</param> + <param name="targetName">The name of the object.</param> <param name="specificInterceptors">The set of interceptors that is specific to this object (may be empty, but not null)</param> <returns>The list of Advisors for the given object</returns> @@ -1423,13 +1437,44 @@ Default value is int.MaxValue, meaning that it's non-ordered. </remarks> </member> + <member name="M:Spring.Aop.Framework.AutoProxy.AbstractAdvisorAutoProxyCreator.#ctor"> + <summary> + Initialize + </summary> + </member> + <member name="M:Spring.Aop.Framework.AutoProxy.AbstractAdvisorAutoProxyCreator.InitObjectFactory(Spring.Objects.Factory.Config.IConfigurableListableObjectFactory)"> + <summary> + An new <see cref="T:Spring.Objects.Factory.Config.IConfigurableListableObjectFactory"/> was set. Initialize this creator instance + according to the specified object factory. + </summary> + <param name="objectFactory"></param> + </member> + <member name="M:Spring.Aop.Framework.AutoProxy.AbstractAdvisorAutoProxyCreator.CreateAdvisorRetrievalHelper(Spring.Objects.Factory.Config.IConfigurableListableObjectFactory)"> + <summary> + Create the <see cref="T:Spring.Aop.Framework.AutoProxy.IAdvisorRetrievalHelper"/> for retrieving the list of + applicable advisor objects. The default implementation calls back into + <see cref="M:Spring.Aop.Framework.AutoProxy.AbstractAdvisorAutoProxyCreator.IsEligibleAdvisorObject(System.String,System.Type,System.String)"/> thus it usually is sufficient to just + override <see cref="M:Spring.Aop.Framework.AutoProxy.AbstractAdvisorAutoProxyCreator.IsEligibleAdvisorObject(System.String,System.Type,System.String)"/>. Override <see cref="M:Spring.Aop.Framework.AutoProxy.AbstractAdvisorAutoProxyCreator.CreateAdvisorRetrievalHelper(Spring.Objects.Factory.Config.IConfigurableListableObjectFactory)"/> + only if you know what you are doing! + </summary> + <param name="objectFactory"></param> + <returns></returns> + </member> <member name="M:Spring.Aop.Framework.AutoProxy.AbstractAdvisorAutoProxyCreator.GetAdvicesAndAdvisorsForObject(System.Type,System.String,Spring.Aop.ITargetSource)"> <summary> Return whether the given object is to be proxied, what additional advices (e.g. AOP Alliance interceptors) and advisors to apply. </summary> - <param name="objType">the new object instance</param> - <param name="name">the name of the object</param> + <remarks> + <p>The previous targetName of this method was "GetInterceptorAndAdvisorForObject". + It has been renamed in the course of general terminology clarification + in Spring 1.1. An AOP Alliance Interceptor is just a special form of + Advice, so the generic Advice term is preferred now.</p> + <p>The third parameter, customTargetSource, is new in Spring 1.1; + add it to existing implementations of this method.</p> + </remarks> + <param name="targetType">the type of the target object</param> + <param name="targetName">the name of the target object</param> <param name="customTargetSource">targetSource returned by TargetSource property: may be ignored. Will be null unless a custom target source is in use.</param> <returns> @@ -1437,22 +1482,36 @@ or an empty array if no additional interceptors but just the common ones; or null if no proxy at all, not even with the common interceptors. </returns> - <remarks> - <p>The previous name of this method was "GetInterceptorAndAdvisorForObject". - It has been renamed in the course of general terminology clarification - in Spring 1.1. An AOP Alliance Interceptor is just a special form of - Advice, so the generic Advice term is preferred now.</p> - <p>The third parameter, customTargetSource, is new in Spring 1.1; - add it to existing implementations of this method.</p> - </remarks> </member> - <member name="M:Spring.Aop.Framework.AutoProxy.AbstractAdvisorAutoProxyCreator.FindEligibleAdvisors(System.Type)"> + <member name="M:Spring.Aop.Framework.AutoProxy.AbstractAdvisorAutoProxyCreator.FindEligibleAdvisors(System.Type,System.String)"> <summary> Find all eligible advices and for autoproxying this class. </summary> - <param name="type"></param> - <returns>the empty list, not null, if there are no pointcuts or interceptors</returns> + <param name="targetType">the type of the object to be advised</param> + <param name="targetName">the name of the object to be advised</param> + <returns> + the empty list, not null, if there are no pointcuts or interceptors. + The by-order sorted list of advisors otherwise + </returns> </member> + <member name="M:Spring.Aop.Framework.AutoProxy.AbstractAdvisorAutoProxyCreator.FindCandidateAdvisors(System.Type,System.String)"> + <summary> + Find all possible advisor candidates to use in auto-proxying + </summary> + <param name="targetType">the type of the object to be advised</param> + <param name="targetName">the name of the object to be advised</param> + <returns>the list of candidate advisors</returns> + </member> + <member name="M:Spring.Aop.Framework.AutoProxy.AbstractAdvisorAutoProxyCreator.FindAdvisorsThatCanApply(System.Collections.IList,System.Type,System.String)"> + <summary> + From the given list of candidate advisors, select the ones that are applicable + to the given target specified by targetType and name. + </summary> + <param name="candidateAdvisors">the list of candidate advisors to date</param> + <param name="targetType">the target object's type</param> + <param name="targetName">the target object's name</param> + <returns>the list of applicable advisors</returns> + </member> <member name="M:Spring.Aop.Framework.AutoProxy.AbstractAdvisorAutoProxyCreator.SortAdvisors(System.Collections.IList)"> <summary> Sorts the advisors. @@ -1460,12 +1519,30 @@ <param name="advisors">The advisors.</param> <returns></returns> </member> - <member name="M:Spring.Aop.Framework.AutoProxy.AbstractAdvisorAutoProxyCreator.FindCandidateAdvisors"> + <member name="M:Spring.Aop.Framework.AutoProxy.AbstractAdvisorAutoProxyCreator.ExtendAdvisors(System.Collections.IList,System.Type,System.String)"> <summary> - Find all candidate advisors to use in auto-proxying. + Extension hook that subclasses can override to add additional advisors for the given object, + given the sorted advisors obtained to date.<br/> + The default implementation does nothing.<br/> + Typically used to add advisors that expose contextual information required by some of the later advisors. </summary> - <returns>list of Advisors</returns> + <remarks> + The advisor list passed into this method is already reduced to advisors applying to this particular object. + If you want to register additional common advisor candidates, override <see cref="M:Spring.Aop.Framework.AutoProxy.AbstractAdvisorAutoProxyCreator.FindCandidateAdvisors(System.Type,System.String)"/>. + </remarks> + <param name="advisors">Advisors that have already been identified as applying to a given object</param> + <param name="objectType">the type of the object to be advised</param> + <param name="objectName">the name of the object to be advised</param> </member> + <member name="M:Spring.Aop.Framework.AutoProxy.AbstractAdvisorAutoProxyCreator.IsEligibleAdvisorObject(System.String,System.Type,System.String)"> + <summary> + Whether the given advisor is eligible for the specified target. The default implementation + always returns true. + </summary> + <param name="advisorName">the advisor name</param> + <param name="targetType">the target object's type</param> + <param name="targetName">the target object's name</param> + </member> <member name="P:Spring.Aop.Framework.AutoProxy.AbstractAdvisorAutoProxyCreator.ObjectFactory"> <summary> We override this method to ensure that all candidate advisors are materialized @@ -1473,6 +1550,68 @@ be apparent to the circular-reference prevention strategy in AbstractObjectFactory. </summary> </member> + <member name="T:Spring.Aop.Framework.AutoProxy.ObjectFactoryAdvisorRetrievalHelper"> + <summary> + Helper for retrieving standard Spring advisors from an <see cref="T:Spring.Objects.Factory.IObjectFactory"/> for + use with auto-proxying. + </summary> + <author>Erich Eichinger</author> + </member> + <member name="T:Spring.Aop.Framework.AutoProxy.IAdvisorRetrievalHelper"> + <summary> + Interface encapsulating the advisor retrieval strategy used by + an <see cref="T:Spring.Aop.Framework.AutoProxy.AbstractAdvisorAutoProxyCreator"/> to retrieve the + applicable list of advisor objects. + </summary> + </member> + <member name="M:Spring.Aop.Framework.AutoProxy.IAdvisorRetrievalHelper.FindAdvisorObjects(System.Type,System.String)"> + <summary> + Get the list of advisor objects to apply on the target. + </summary> + </member> + <member name="M:Spring.Aop.Framework.AutoProxy.ObjectFactoryAdvisorRetrievalHelper.#ctor(Spring.Objects.Factory.Config.IConfigurableListableObjectFactory)"> + <summary> + Create a new helper for the specified <paramref name="objectFactory"/>. + </summary> + </member> + <member name="M:Spring.Aop.Framework.AutoProxy.ObjectFactoryAdvisorRetrievalHelper.FindAdvisorObjects(System.Type,System.String)"> + <summary> + Find all all eligible advisor objects in the current object factory. + </summary> + <param name="targetType">the type of the object to be advised</param> + <param name="targetName">the name of the object to be advised</param> + <returns>A list of eligible <see cref="T:Spring.Aop.IAdvisor"/> instances</returns> + </member> + <member name="M:Spring.Aop.Framework.AutoProxy.ObjectFactoryAdvisorRetrievalHelper.AddAdvisorCandidate(System.Collections.ArrayList,System.String)"> + <summary> + Add the named advisor instance to the list of advisors. + </summary> + <param name="advisors">the advisor list</param> + <param name="advisorName">the object name of the advisor to add</param> + </member> + <member name="M:Spring.Aop.Framework.AutoProxy.ObjectFactoryAdvisorRetrievalHelper.GetAdvisorCandidateNames(System.Type,System.String)"> + <summary> + Gets the names of advisor candidates + </summary> + <param name="targetType">the type of the object to be advised</param> + <param name="targetName">the name of the object to be advised</param> + <returns>a non-null string array of advisor candidate names</returns> + </member> + <member name="M:Spring.Aop.Framework.AutoProxy.ObjectFactoryAdvisorRetrievalHelper.IsEligibleObject(System.String,System.Type,System.String)"> + <summary> + Determine, whether the specified aspect object is eligible. + The default implementation accepts all except for advisors that are + part of the internal infrastructure. + </summary> + <param name="advisorName">the name of the candidate advisor</param> + <param name="objectType">the type of the object to be advised</param> + <param name="objectName">the name of the object to be advised</param> + </member> + <member name="P:Spring.Aop.Framework.AutoProxy.ObjectFactoryAdvisorRetrievalHelper.ObjectFactory"> + <summary> + The object factory to lookup advisors from + </summary> + </member> <member name="T:Spring.Aop.Framework.AutoProxy.AbstractFilteringAutoProxyCreator"> <summary> The base class for AutoProxyCreator implementations that mark objects @@ -1484,8 +1623,8 @@ <summary> Overridden to call <see cref="M:Spring.Aop.Framework.AutoProxy.AbstractFilteringAutoProxyCreator.IsEligibleForProxying(System.Type,System.String)"/>. </summary> - <param name="objectType">the type of the object</param> - <param name="objectName">the name of the object</param> + <param name="targetType">the type of the object</param> + <param name="targetName">the name of the object</param> <returns>if remarkable to skip</returns> </member> <member name="M:Spring.Aop.Framework.AutoProxy.AbstractFilteringAutoProxyCreator.GetAdvicesAndAdvisorsForObject(System.Type,System.String,Spring.Aop.ITargetSource)"> @@ -1495,8 +1634,8 @@ <remarks> Whether an object shall be proxied or not is determined by the result of <see cref="M:Spring.Aop.Framework.AutoProxy.AbstractFilteringAutoProxyCreator.IsEligibleForProxying(System.Type,System.String)"/>. </remarks> - <param name="objType">ingored</param> - <param name="name">ignored</param> + <param name="targetType">ingored</param> + <param name="targetName">ignored</param> <param name="customTargetSource">ignored</param> <returns> Always <see cref="F:Spring.Aop.Framework.AutoProxy.AbstractAutoProxyCreator.PROXY_WITHOUT_ADDITIONAL_INTERCEPTORS"/> to indicate, that the object shall be proxied. @@ -1510,8 +1649,8 @@ <remarks> Override this method to allow or reject proxying for the given object. </remarks> - <param name="objType">the object's type</param> - <param name="name">the name of the object</param> + <param name="targetType">the object's type</param> + <param name="targetName">the name of the object</param> <seealso cref="M:Spring.Aop.Framework.AutoProxy.AbstractAutoProxyCreator.ShouldSkip(System.Type,System.String)"/> <returns>whether the given object shall be proxied.</returns> </member> @@ -1523,10 +1662,10 @@ </member> <member name="M:Spring.Aop.Framework.AutoProxy.AttributeAutoProxyCreator.IsEligibleForProxying(System.Type,System.String)"> <summary> - Determines, whether the given object shall be proxied by matching <paramref name="objType"/> against <see cref="P:Spring.Aop.Framework.AutoProxy.AttributeAutoProxyCreator.AttributeTypes"/>. + Determines, whether the given object shall be proxied by matching <paramref name="targetType"/> against <see cref="P:Spring.Aop.Framework.AutoProxy.AttributeAutoProxyCreator.AttributeTypes"/>. </summary> - <param name="objType">the object's type</param> - <param name="name">the name of the object</param> + <param name="targetType">the object's type</param> + <param name="targetName">the name of the object</param> </member> <member name="M:Spring.Aop.Framework.AutoProxy.AttributeAutoProxyCreator.IsAnnotatedWithAnyOfAttribute(System.Type,System.Type[],System.Boolean)"> <summary> @@ -1564,22 +1703,32 @@ </summary> <author>Rod Johnson</author> <author>Adhari C Mahendra (.NET)</author> + <author>Erich Eichinger (.NET)</author> </member> <member name="F:Spring.Aop.Framework.AutoProxy.DefaultAdvisorAutoProxyCreator.SEPARATOR"> <summary> Separator between prefix and remainder of object name </summary> </member> - <member name="M:Spring.Aop.Framework.AutoProxy.DefaultAdvisorAutoProxyCreator.FindCandidateAdvisors"> + <member name="M:Spring.Aop.Framework.AutoProxy.DefaultAdvisorAutoProxyCreator.FindCandidateAdvisors(System.Type,System.String)"> <summary> - Find all candidate advices to use in auto proxying. + Find all possible advisor candidates to use in auto-proxying </summary> - <returns>list of Advice</returns> + <param name="targetType">the type of the object to be advised</param> + <param name="targetName">the name of the object to be advised</param> + <returns>the list of candidate advisors</returns> </member> + <member name="M:Spring.Aop.Framework.AutoProxy.DefaultAdvisorAutoProxyCreator.IsEligibleAdvisorObject(System.String,System.Type,System.String)"> + <summary> + Whether the given advisor is eligible for the specified target. + </summary> + <param name="advisorName">the advisor name</param> + <param name="targetType">the target object's type</param> + <param name="targetName">the target object's name</param> + </member> <member name="M:Spring.Aop.Framework.AutoProxy.DefaultAdvisorAutoProxyCreator.AfterPropertiesSet"> <summary> - Invoked by an <see cref="T:Spring.Objects.Factory.IObjectFactory"/> - after it has injected all of an object's dependencies. + Validate configuration </summary> </member> <member name="P:Spring.Aop.Framework.AutoProxy.DefaultAdvisorAutoProxyCreator.UsePrefix"> @@ -1611,6 +1760,21 @@ </p> </remarks> </member> + <member name="T:Spring.Aop.Framework.AutoProxy.InfrastructureAdvisorAutoProxyCreator"> + <summary> + A special version of an APC that explicitely cares for infrastructure (=internal) + advisors only + </summary> + <author>Erich Eichinger</author> + </member> + <member name="M:Spring.Aop.Framework.AutoProxy.InfrastructureAdvisorAutoProxyCreator.CreateAdvisorRetrievalHelper(Spring.Objects.Factory.Config.IConfigurableListableObjectFactory)"> + <summary> + Overridden to create a special version of an <see cref="T:Spring.Aop.Framework.AutoProxy.IAdvisorRetrievalHelper"/> + that accepts only infrastructure advisor definitions + </summary> + <param name="objectFactory"></param> + <returns></returns> + </member> <member name="T:Spring.Aop.Framework.AutoProxy.InheritanceBasedAopConfigurer"> <summary> <see cref="T:Spring.Objects.Factory.Config.IObjectFactoryPostProcessor"/> implementation that replaces a group of objects @@ -1816,6 +1980,7 @@ <seealso cref="M:Spring.Aop.Framework.AutoProxy.ObjectNameAutoProxyCreator.IsMatch(System.String,System.String)"/> <author>Juergen Hoeller</author> <author>Adhari C Mahendra (.NET)</author> + <author>Erich Eichinger</author> </member> <member name="M:Spring.Aop.Framework.AutoProxy.ObjectNameAutoProxyCreator.#ctor"> <summary> @@ -1841,6 +2006,18 @@ <param name="mappedName">the name in the configured list of names</param> <returns>if the names match</returns> </member> + <member name="M:Spring.Aop.Framework.AutoProxy.ObjectNameAutoProxyCreator.IsObjectNameMatch(System.Type,System.String,System.Collections.IList)"> + <summary> + Convenience method that may be used by derived classes. Iterates over the list of <paramref name="objectNamePatterns"/> to match <paramref name="objectName"/> against. + </summary> + <param name="objType">the object's type. Must not be <c>null</c>.</param> + <param name="objectName">the name of the object Must not be <c>null</c>.</param> + <param name="objectNamePatterns">the list of patterns, that <paramref name="objectName"/> shall be matched against. Must not be <c>null</c>.</param> + <returns> + If <paramref name="objectNamePatterns"/> is <c>null</c>, will always return <c>true</c>, otherwise + if <paramref name="objectName"/> matches any of the patterns specified in <paramref name="objectNamePatterns"/>. + </returns> + </member> <member name="P:Spring.Aop.Framework.AutoProxy.ObjectNameAutoProxyCreator.ObjectNames"> <summary> Set the names of the objects in IList fashioned way that should automatically @@ -1878,8 +2055,8 @@ <remarks> Override this method to allow or reject proxying for the given object. </remarks> - <param name="objType">the object's type</param> - <param name="name">the name of the object</param> + <param name="targetType">the object's type</param> + <param name="targetName">the name of the object</param> <seealso cref="M:Spring.Aop.Framework.AutoProxy.AbstractAutoProxyCreator.ShouldSkip(System.Type,System.String)"/> <returns>whether the given object shall be proxied.</returns> </member> @@ -1888,6 +2065,65 @@ The list of patterns to match <see cref="P:System.Type.FullName"/> against. For pattern syntax, see <see cref="T:Spring.Aop.Support.TypeNameTypeFilter"/> </summary> </member> + <member name="T:Spring.Aop.Framework.DynamicProxy.AbstractAopProxyFactory"> + <summary> + A reusable base implementation of <see cref="T:Spring.Aop.Framework.IAopProxyFactory"/>, providing + some useful default implementations + </summary> + <author>Erich Eichinger</author> + </member> + <member name="T:Spring.Aop.Framework.IAopProxyFactory"> + <summary> + Factory interface for the creation of AOP proxies based on + <see cref="T:Spring.Aop.Framework.AdvisedSupport"/> configuration + objects. + </summary> + <author>Rod Johnson</author> + <author>Aleksandar Seovic (.NET)</author> + </member> + <member name="M:Spring.Aop.Framework.IAopProxyFactory.CreateAopProxy(Spring.Aop.Framework.AdvisedSupport)"> + <summary> + Creates an <see cref="T:Spring.Aop.Framework.IAopProxy"/> for the + supplied <paramref name="advisedSupport"/> configuration. + </summary> + <param name="advisedSupport">The AOP configuration.</param> + <returns>An <see cref="T:Spring.Aop.Framework.IAopProxy"/>.</returns> + <exception cref="T:Spring.Aop.Framework.AopConfigException"> + If the supplied <paramref name="advisedSupport"/> configuration is + invalid. + </exception> + </member> + <member name="M:Spring.Aop.Framework.DynamicProxy.AbstractAopProxyFactory.CreateAopProxy(Spring.Aop.Framework.AdvisedSupport)"> + <summary> + Creates an <see cref="T:Spring.Aop.Framework.IAopProxy"/> for the + supplied <paramref name="advisedSupport"/> configuration. + </summary> + <param name="advisedSupport">The AOP configuration.</param> + <returns>An <see cref="T:Spring.Aop.Framework.IAopProxy"/>.</returns> + <exception cref="T:Spring.Aop.Framework.AopConfigException"> + If the supplied <paramref name="advisedSupport"/> configuration is + invalid. + </exception> + <seealso cref="M:Spring.Aop.Framework.IAopProxyFactory.CreateAopProxy(Spring.Aop.Framework.AdvisedSupport)"/> + </member> + <member name="M:Spring.Aop.Framework.DynamicProxy.AbstractAopProxyFactory.DoCreateAopProxyInstance(Spring.Aop.Framework.AdvisedSupport)"> + <summary> + Actually creates the proxy instance based on the supplied <see cref="T:Spring.Aop.Framework.AdvisedSupport"/>. + </summary> + <returns>the proxy instance described by <paramref name="advisedSupport"/>. Must not be <c>null</c></returns> + </member> + <member name="M:Spring.Aop.Framework.DynamicProxy.AbstractAopProxyFactory.EliminateDuplicateAdvisors(Spring.Aop.Framework.AdvisedSupport)"> + <summary> + If possible, checks for advisor duplicates on the supplied <paramref name="advisedSupport"/> and + eliminates them. + </summary> + </member> + <member name="M:Spring.Aop.Framework.DynamicProxy.AbstractAopProxyFactory.IsAopProxyType(Spring.Aop.ITargetSource)"> + <summary> + Checks, if the given <paramref name="targetSource"/> holds a proxy generated by this factory. + </summary> + <returns></returns> + </member> <member name="T:Spring.Aop.Framework.DynamicProxy.AbstractAopProxyMethodBuilder"> <summary> Base class for AOP method builders that contains common functionalities. @@ -2952,46 +3188,20 @@ <author>Rod Johnson</author> <author>Aleksandar Seovic (.NET)</author> <author>Bruno Baia (.NET)</author> + <author>Erich Eichinger (.NET)</author> <seealso cref="T:Spring.Aop.Framework.IAopProxyFactory"/> </member> - <member name="T:Spring.Aop.Framework.IAopProxyFactory"> - <summary> - Factory interface for the creation of AOP proxies based on - <see cref="T:Spring.Aop.Framework.AdvisedSupport"/> configuration - objects. - </summary> - <author>Rod Johnson</author> - <author>Aleksandar Seovic (.NET)</author> - </member> - <member name="M:Spring.Aop.Framework.IAopProxyFactory.CreateAopProxy(Spring.Aop.Framework.AdvisedSupport)"> - <summary> - Creates an <see cref="T:Spring.Aop.Framework.IAopProxy"/> for the - supplied <paramref name="advisedSupport"/> configuration. - </summary> - <param name="advisedSupport">The AOP configuration.</param> - <returns>An <see cref="T:Spring.Aop.Framework.IAopProxy"/>.</returns> - <exception cref="T:Spring.Aop.Framework.AopConfigException"> - If the supplied <paramref name="advisedSupport"/> configuration is - invalid. - </exception> - </member> <member name="M:Spring.Aop.Framework.DynamicProxy.DefaultAopProxyFactory.#cctor"> <summary> Force transient assemblies to be resolvable by <see cref="M:System.Reflection.Assembly.Load(System.String)"/>. </summary> </member> - <member name="M:Spring.Aop.Framework.DynamicProxy.DefaultAopProxyFactory.CreateAopProxy(Spring.Aop.Framework.AdvisedSupport)"> + <member name="M:Spring.Aop.Framework.DynamicProxy.DefaultAopProxyFactory.DoCreateAopProxyInstance(Spring.Aop.Framework.AdvisedSupport)"> <summary> - Creates an <see cref="T:Spring.Aop.Framework.IAopProxy"/> for the - supplied <paramref name="advisedSupport"/> configuration. + Creates an actual proxy instance based on the supplied <paramref name="advisedSupport"/> </summary> - <param name="advisedSupport">The AOP configuration.</param> - <returns>An <see cref="T:Spring.Aop.Framework.IAopProxy"/>.</returns> - <exception cref="T:Spring.Aop.Framework.AopConfigException"> - If the supplied <paramref name="advisedSupport"/> configuration is - invalid. - </exception> - <seealso cref="M:Spring.Aop.Framework.IAopProxyFactory.CreateAopProxy(Spring.Aop.Framework.AdvisedSupport)"/> + <param name="advisedSupport"></param> + <returns></returns> </member> <member name="M:Spring.Aop.Framework.DynamicProxy.DefaultAopProxyFactory.BuildProxyType(Spring.Proxy.IProxyTypeBuilder)"> <summary> @@ -3007,6 +3217,16 @@ The shared <see cref="T:Common.Logging.ILog"/> instance for this class. </summary> </member> + <member name="M:Spring.Aop.Framework.DynamicProxy.CachedAopProxyFactory.ClearCache"> + <summary> + Clears the type cache + </summary> + </member> + <member name="M:Spring.Aop.Framework.DynamicProxy.CachedAopProxyFactory.#ctor"> + <summary> + Creates a new instance + </summary> + </member> <member name="M:Spring.Aop.Framework.DynamicProxy.CachedAopProxyFactory.BuildProxyType(Spring.Proxy.IProxyTypeBuilder)"> <summary> Generates the proxy type and caches the <see cref="T:System.Type"/> @@ -3017,6 +3237,11 @@ </param> <returns>The generated or cached proxy class.</returns> </member> + <member name="P:Spring.Aop.Framework.DynamicProxy.CachedAopProxyFactory.CountCachedTypes"> + <summary> + Returns the number of proxy types in the cache + </summary> + </member> <member name="T:Spring.Aop.Framework.DynamicProxy.CachedAopProxyFactory.ProxyTypeCacheKey"> <summary> Uniquely identifies a proxytype in the cache @@ -3832,12 +4057,6 @@ List of introductions. </summary> </member> - <member name="F:Spring.Aop.Framework.AdvisedSupport._introductionsArray"> - <summary> - Array updated on changes to the advisors list, which is easier to - manipulate internally - </summary> - </member> <member name="F:Spring.Aop.Framework.AdvisedSupport.interfaceMap"> <summary> Interface map specifying which object should interface methods be @@ -3872,6 +4091,12 @@ The advisor chain factory. </summary> </member> + <member name="F:Spring.Aop.Framework.AdvisedSupport.autoDetectInterfaces"> + <summary> + If no explicit interfaces are specified, interfaces will be automatically determined + from the target type + </summary> + </member> <member name="M:Spring.Aop.Framework.AdvisedSupport.#ctor"> <summary> Creates a new instance of the @@ -3889,6 +4114,33 @@ If this </exception> </member> + <member name="M:Spring.Aop.Framework.AdvisedSupport.#ctor(System.Object)"> + <summary> + Creates a new instance of the <see cref="T:Spring.Aop.Framework.ProxyFactory"/> + class that proxys all of the interfaces exposed by the supplied + <paramref name="target"/>. + </summary> + <param name="target">The object to proxy.</param> + <exception cref="T:Spring.Aop.Framework.AopConfigException"> + If the <paramref name="target"/> is <cref lang="null"/>. + </exception> + </member> + <member name="M:Spring.Aop.Framework.AdvisedSupport.#ctor(Spring.Aop.ITargetSource)"> + <summary> + Creates a new instance of the <see cref="T:Spring.Aop.Framework.ProxyFactory"/> + class that proxys all of the interfaces exposed by the supplied + <paramref name="targetSource"/>'s target. + </summary> + <param name="targetSource">The <see cref="T:Spring.Aop.ITargetSource"/> providing access to the object to proxy.</param> + <exception cref="T:Spring.Aop.Framework.AopConfigException"> + If the <paramref name="targetSource"/> is <cref lang="null"/>. + </exception> + </member> + <member name="M:Spring.Aop.Framework.AdvisedSupport.SetInterfacesInternal(System.Type[])"> + <summary> + Set interfaces to be proxied, bypassing locking and <see cref="P:Spring.Aop.Framework.ProxyConfig.IsFrozen"/> + </summary> + </member> <member name="M:Spring.Aop.Framework.AdvisedSupport.IsInterfaceProxied(System.Type)"> <summary> Is the supplied <paramref name="intf"/> (interface) @@ -4179,10 +4431,17 @@ to the advised target, this method returns the <see cref="M:System.Object.ToString"/> equivalent for the AOP proxy itself. </summary> + <remarks>To override this format, override <see cref="M:Spring.Aop.Framework.AdvisedSupport.ToProxyConfigStringInternal"/></remarks> <returns> A <see cref="T:System.String"/> description of the proxy configuration. </returns> </member> + <member name="M:Spring.Aop.Framework.AdvisedSupport.ToProxyConfigStringInternal"> + <summary> + Returns textual information about this configuration object + </summary> + <returns></returns> + </member> <member name="M:Spring.Aop.Framework.AdvisedSupport.AddListener(Spring.Aop.Framework.IAdvisedSupportListener)"> <summary> Registers the supplied <paramref name="listener"/> as a listener for @@ -4392,11 +4651,6 @@ Bring the advisors array up to date with the list. </summary> </member> - <member name="M:Spring.Aop.Framework.AdvisedSupport.UpdateIntroductionsArray"> - <summary> - Bring the introductions array up to date with the list. - </summary> - </member> <member name="M:Spring.Aop.Framework.AdvisedSupport.InterfacesChanged"> <summary> Callback method that is invoked when the list of proxied interfaces @@ -4412,7 +4666,7 @@ </p> </remarks> </member> - <member name="M:Spring.Aop.Framework.AdvisedSupport.InterceptorsChanged"> + <member name="M:Spring.Aop.Framework.AdvisedSupport.AdviceChanged"> <summary> Callback method that is invoked when the interceptor list has changed. </summary> @@ -4436,6 +4690,11 @@ </remarks> <seealso cref="M:Spring.Aop.Framework.IAopProxyFactory.CreateAopProxy(Spring.Aop.Framework.AdvisedSupport)"/> </member> + <member name="M:Spring.Aop.Framework.AdvisedSupport.CountNonIntroductionInterfaces"> + <summary> + Calculates the number of <see cref="P:Spring.Aop.Framework.AdvisedSupport.Interfaces"/> not delegating to one of the <see cref="P:Spring.Aop.Framework.AdvisedSupport.Introductions"/>. + </summary> + </member> <member name="M:Spring.Aop.Framework.AdvisedSupport.CopyConfigurationFrom(Spring.Aop.Framework.AdvisedSupport)"> <summary> Copies the configuration from the supplied other @@ -4455,17 +4714,29 @@ instance. </param> </member> - <member name="M:Spring.Aop.Framework.AdvisedSupport.ToString"> + <member name="M:Spring.Aop.Framework.AdvisedSupport.CopyConfigurationFrom(Spring.Aop.Framework.AdvisedSupport,Spring.Aop.ITargetSource,System.Collections.IList,System.Collections.IList)"> <summary> - A <see cref="T:System.String"/> that represents the current - <see cref="T:Spring.Aop.Framework.ProxyConfig"/> configuration. + Copies the configuration from the supplied other + <see cref="T:Spring.Aop.Framework.AdvisedSupport"/> into this instance. </summary> - <returns> - A <see cref="T:System.String"/> that represents the current - <see cref="T:Spring.Aop.Framework.ProxyConfig"/> configuration. - </returns> + <remarks> + <p> + Useful when this instance has been created using the no-argument + constructor, and needs to get all of its confiuration data from + another <see cref="T:Spring.Aop.Framework.AdvisedSupport"/> (most + usually to have an independant copy of said configuration data). + </p> + </remarks> + <param name="other"> + The <see cref="T:Spring.Aop.Framework.AdvisedSupport"/> instance + containing the configiration data that is to be copied into this + instance. + </param> + <param name="targetSource">the new target source</param> + <param name="advisors">the advisors for the chain</param> + <param name="introductions">the introductions for the chain</param> </member> - <member name="M:Spring.Aop.Framework.AdvisedSupport.ToStringInternal"> + <member name="M:Spring.Aop.Framework.AdvisedSupport.ToString"> <summary> A <see cref="T:System.String"/> that represents the current <see cref="T:Spring.Aop.Framework.ProxyConfig"/> configuration. @@ -4606,6 +4877,12 @@ </summary> <value>The type of the target or null if not known.</value> </member> + <member name="P:Spring.Aop.Framework.AdvisedSupport.AutoDetectInterfaces"> + <summary> + If no explicit interfaces are specified, interfaces will be automatically determined + from the target type on proxy creation. Defaults to true + </summary> + </member> <member name="P:Spring.Aop.Framework.AdvisedSupport.Target"> <summary> Sets the target object that is to be advised. @@ -4868,6 +5145,16 @@ <author>Juergen Hoeller</author> <author>Aleksandar Seovic (.NET)</author> </member> + <member name="M:Spring.Aop.Framework.AopUtils.IsAopProxyType(System.Type)"> + <summary> + Is the supplied <paramref name="objectType"/> an AOP proxy? + </summary> + <remarks> + Return whether the given type is either a composition-based or a decorator-based proxy type. + </remarks> + <param name="objectType">The type to be checked.</param> + <returns><see langword="true"/> if the supplied <paramref name="objectType"/> is an AOP proxy type.</returns> + </member> <member name="M:Spring.Aop.Framework.AopUtils.IsAopProxy(System.Object)"> <summary> Is the supplied <paramref name="instance"/> an AOP proxy? @@ -4892,6 +5179,16 @@ an composition-based AOP proxy. </returns> </member> + <member name="M:Spring.Aop.Framework.AopUtils.IsCompositionAopProxyType(System.Type)"> + <summary> + Is the supplied <paramref name="objectType"/> a composition based AOP proxy type? + </summary> + <remarks> + Return whether the given type is a composition-based proxy type. + </remarks> + <param name="objectType">The type to be checked.</param> + <returns><see langword="true"/> if the supplied <paramref name="objectType"/> is a composition based AOP proxy type.</returns> + </member> <member name="M:Spring.Aop.Framework.AopUtils.IsDecoratorAopProxy(System.Object)"> <summary> Is the supplied <paramref name="instance"/> a decorator-based AOP proxy? @@ -4902,6 +5199,16 @@ an decorator-based AOP proxy. </returns> </member> + <member name="M:Spring.Aop.Framework.AopUtils.IsDecoratorAopProxyType(System.Type)"> + <summary> + Is the supplied <paramref name="objectType"/> a composition based AOP proxy type? + </summary> + <remarks> + Return whether the given type is a composition-based proxy type. + </remarks> + <param name="objectType">The type to be checked.</param> + <returns><see langword="true"/> if the supplied <paramref name="objectType"/> is a composition based AOP proxy type.</returns> + </member> <member name="M:Spring.Aop.Framework.AopUtils.GetAllInterfaces(System.Object)"> <summary> Gets all of the interfaces that the <see cref="T:System.Type"/> of the @@ -4963,6 +5270,33 @@ <see langword="true"/> if the pointcut can apply on any method. </returns> </member> + <member name="M:Spring.Aop.Framework.AopUtils.CanApply(Spring.Aop.IPointcut,System.Type,System.Type[],System.Boolean)"> + <summary> + Can the supplied <paramref name="pointcut"/> apply at all on the + supplied <paramref name="targetType"/>? + </summary> + <remarks> + <p> + This is an important test as it can be used to optimize out a + pointcut for a class. + </p> + <p> + Invoking this method with a <paramref name="targetType"/> that is + an interface type will always yield a <see langword="false"/> + return value. + </p> + </remarks> + <param name="pointcut">The pointcut being tested.</param> + <param name="targetType">The class being tested.</param> + <param name="proxyInterfaces"> + The interfaces being proxied. If <see langword="null"/>, all + methods on a class may be proxied. + </param> + <param name="hasIntroductions">whether or not the advisor chain for the target object includes any introductions.</param> + <returns> + <see langword="true"/> if the pointcut can apply on any method. + </returns> + </member> <member name="M:Spring.Aop.Framework.AopUtils.CanApply(Spring.Aop.IAdvisor,System.Type,System.Type[])"> <summary> Can the supplied <paramref name="advisor"/> apply at all on the @@ -4984,6 +5318,28 @@ <see langword="true"/> if the advisor can apply on any method. </returns> </member> + <member name="M:Spring.Aop.Framework.AopUtils.CanApply(Spring.Aop.IAdvisor,System.Type,System.Type[],System.Boolean)"> + <summary> + Can the supplied <paramref name="advisor"/> apply at all on the + supplied <paramref name="targetType"/>? + </summary> + <remarks> + <p> + This is an important test as it can be used to optimize out an + advisor for a class. + </p> + </remarks> + <param name="advisor">The advisor to check.</param> + <param name="targetType">The class being tested.</param> + <param name="proxyInterfaces"> + The interfaces being proxied. If <see langword="null"/>, all + methods on a class may be proxied. + </param> + <param name="hasIntroductions">whether or not the advisor chain for the target object includes any introductions.</param> + <returns> + <see langword="true"/> if the advisor can apply on any method. + </returns> + </member> <member name="M:Spring.Aop.Framework.AopUtils.#ctor"> <summary> Creates a new instance of the @@ -5306,6 +5662,26 @@ </remarks> <param name="interfaces">The interfaces to implement.</param> </member> + <member name="M:Spring.Aop.Framework.ProxyFactory.#ctor(System.Type,AopAlliance.Intercept.IInterceptor)"> + <summary> + Creates a new instance of the <see cref="T:Spring.Aop.Framework.ProxyFactory"/> class for the + given interface and interceptor. + </summary> + <remarks>Convenience method for creating a proxy for a single interceptor + , assuming that the interceptor handles all calls itself rather than delegating + to a target, like in the case of remoting proxies.</remarks> + <param name="proxyInterface">The interface that the proxy should implement.</param> + <param name="interceptor">The interceptor that the proxy should invoke.</param> + </member> + <member name="M:Spring.Aop.Framework.ProxyFactory.#ctor(System.Type,Spring.Aop.ITargetSource)"> + <summary> + Create a new instance of the <see cref="T:Spring.Aop.Framework.ProxyFactory"/> class for the specified + <see cref="T:Spring.Aop.ITargetSource"/> making the proxy implement the specified interface. + </summary> + <remarks></remarks> + <param name="proxyInterface">The interface that the proxy should implement.</param> + <param name="targetSource">The target source that the proxy should invoek.</param> + </member> <member name="M:Spring.Aop.Framework.ProxyFactory.GetProxy"> <summary> Creates a new proxy according to the settings in this factory. @@ -5395,14 +5771,9 @@ <seealso cref="T:Spring.Aop.IAdvisor"/> <seealso cref="T:Spring.Aop.Target.SingletonTargetSource"/> </member> - <member name="F:Spring.Aop.Framework.ProxyFactoryObject.GlobalInterceptorSuffix"> - <summary> - This suffix in a value in an interceptor list indicates to expand globals. - </summary> - </member> <member name="F:Spring.Aop.Framework.ProxyFactoryObject.logger"> <summary> - The shared <see cref="T:Common.Logging.ILog"/> instance for this class. + The <see cref="T:Common.Logging.ILog"/> instance for this class. </summary> </member> <member name="F:Spring.Aop.Framework.ProxyFactoryObject.singleton"> @@ -5410,6 +5781,11 @@ Is the object managed by this factory a singleton or a prototype? </summary> </member> + <member name="F:Spring.Aop.Framework.ProxyFactoryObject.GlobalInterceptorSuffix"> + <summary> + This suffix in a value in an interceptor list indicates to expand globals. + </summary> + </member> <member name="F:Spring.Aop.Framework.ProxyFactoryObject.singletonInstance"> <summary> The cached instance if this proxy factory object is a singleton. @@ -5420,18 +5796,10 @@ The owning object factory (which cannot be changed after this object is initialized). </summary> </member> - <member name="F:Spring.Aop.Framework.ProxyFactoryObject.sourceDictionary"> - <summary> - The mapping from an <see cref="T:Spring.Aop.IPointcut"/> or interceptor - to an object name (or <see lang="null"/>), depending on where it was - sourced from. + <member name="F:Spring.Aop.Framework.ProxyFactoryObject.advisorAdapterRegistry"> + <summary> + The advisor adapter registry for wrapping pure advices and pointcuts according to needs </summary> - <remarks> - <p> - If it's sourced from object name, it will need to be - refreshed each time a new prototype instance is created. - </p> - </remarks> </member> <member name="F:Spring.Aop.Framework.ProxyFactoryObject.interceptorNames"> <summary> @@ -5459,6 +5827,22 @@ <see cref="T:Spring.Objects.Factory.IObjectFactory"/>). </summary> </member> + <member name="F:Spring.Aop.Framework.ProxyFactoryObject.initialized"> + <summary> + Indicates if the advisor chain has already been initialized + </summary> + </member> + <member name="F:Spring.Aop.Framework.ProxyFactoryObject.freezeProxy"> + <summary> + Indicate whether this config shall be frozen upon creation + of the first proxy instance + </summary> + </member> + <member name="M:Spring.Aop.Framework.ProxyFactoryObject.#ctor"> + <summary> + Creates a new instance of ProxyFactoryObject + </summary> + </member> <member name="M:Spring.Aop.Framework.ProxyFactoryObject.GetObject"> <summary> Creates an instance of the AOP proxy to be returned by this factory @@ -5476,7 +5860,12 @@ </returns> <seealso cref="M:Spring.Objects.Factory.IFactoryObject.GetObject"/> </member> - <member name="M:Spring.Aop.Framework.ProxyFactoryObject.ConfigureAdvisorChain"> + <member name="M:Spring.Aop.Framework.ProxyFactoryObject.Initialize"> + <summary> + Initialize this proxy factory - usually called after all properties are set + </summary> + </member> + <member name="M:Spring.Aop.Framework.ProxyFactoryObject.InitializeAdvisorChain"> <summary>Create the advisor (interceptor) chain.</summary> <remarks> The advisors that are sourced from an ObjectFactory will be refreshed each time @@ -5484,23 +5873,18 @@ the factory API are unaffected by such changes. </remarks> </member> - <member name="M:Spring.Aop.Framework.ProxyFactoryObject.ConfigureIntroductions"> + <member name="M:Spring.Aop.Framework.ProxyFactoryObject.AddGlobalAdvisor(Spring.Objects.Factory.IListableObjectFactory,System.String)"> + <summary> Add all global interceptors and pointcuts.</summary> + </member> + <member name="M:Spring.Aop.Framework.ProxyFactoryObject.InitializeIntroductionChain"> <summary> Configures introductions for this proxy. </summary> </member> - <member name="M:Spring.Aop.Framework.ProxyFactoryObject.AddGlobalAdvisor(Spring.Objects.Factory.IListableObjectFactory,System.String)"> - <summa... [truncated message content] |
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: Colette <yho...@er...> - 2010-09-10 20:08:35
|
http://forex4tv.freehostia.com/dubbin99.html |
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. |