From: <aye...@us...> - 2009-05-16 07:30:57
|
Revision: 4327 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4327&view=rev Author: ayenderahien Date: 2009-05-16 07:30:51 +0000 (Sat, 16 May 2009) Log Message: ----------- Fixing NH-1169 - Will only throw an error if SqlCommandSet is actually used (will make using NHibernate with Sql Server on Mono easier) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Impl/SqlClientCommandSet.cs Modified: trunk/nhibernate/src/NHibernate/Impl/SqlClientCommandSet.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Impl/SqlClientCommandSet.cs 2009-05-16 06:17:39 UTC (rev 4326) +++ trunk/nhibernate/src/NHibernate/Impl/SqlClientCommandSet.cs 2009-05-16 07:30:51 UTC (rev 4327) @@ -1,5 +1,6 @@ using System; +using System.Data; using System.Data.SqlClient; using System.Diagnostics; using System.Reflection; @@ -12,13 +13,19 @@ static SqlClientCommandSet() { - Assembly sysData = Assembly.Load("System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); + Assembly sysData = typeof(IDbConnection).Assembly; sqlCmdSetType = sysData.GetType("System.Data.SqlClient.SqlCommandSet"); - Debug.Assert(sqlCmdSetType != null, "Could not find SqlCommandSet!"); } protected override object CreateInternalCommandSet() { + if (sqlCmdSetType == null) + { + throw new HibernateException("Could not find SqlCommandSet"+Environment.NewLine + + "If you are running on Mono, batching support isn't implemented on Mono" + Environment.NewLine + + "If you are running on Microsoft .NET, this probably means that internal details"+Environment.NewLine+ + "of the BCL that we rely on to allow this have changed, this is a bug. Please inform the developers"); + } return Activator.CreateInstance(sqlCmdSetType, true); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |