You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by gb...@apache.org on 2005/05/28 14:35:13 UTC
svn commit: r178869 - in
/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess: ./ Configuration/
DaoSessionHandlers/ Extensions/DaoSessionHandlers/ Interfaces/ Test/
Test/Maps/MSSQL/Odbc/ Test/Maps/MSSQL/OleDb/ Test/Maps/MSSQL/SqlClient/
Test/NUnit/DaoTests/ Test/NUnit/DaoTests/ADO/MSSQL/
Test/NUnit/DaoTests/ADO/MySql/ Test/NUnit/DaoTests/ADO/Oracle/
Test/Scripts/MSSQL/ Test/bin/Debug/
Author: gbayon
Date: Sat May 28 05:35:12 2005
New Revision: 178869
URL: http://svn.apache.org/viewcvs?rev=178869&view=rev
Log:
+ Add new API to DomDaoManagerBuilder.Configure(...)[tell that old API DaoManager.Configure(...) are marked as obsolete]
+ New syntax to configure daoSessionHandler (old is too supported)
<daoSessionHandler id="SqlMap">
<property name="resource" value="SqlMap_MSSQL_SqlClient.config"/>
<property name="url" value="E:\Projet\iBatis\trunk\cs\mapper\IBatisNet.DataAccess.Test\bin\Debug\SqlMap_MSSQL_SqlClient.config"/>
<property name="embedded" value="bin.Debug.SqlMap_MSSQL_SqlClient.config, IBatisNet.DataAccess.Test"/>
</daoSessionHandler>
Modified:
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Extensions/DaoSessionHandlers/NHibernateDaoSessionHandler.cs
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/IBatisNet.DataAccess.Test.csproj
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/Odbc/Complex.xml
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/Odbc/DynamicAccount.xml
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/OleDb/Complex.xml
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/OleDb/DynamicAccount.xml
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/SqlClient/Complex.xml
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/SqlClient/DynamicAccount.xml
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/ADO/MSSQL/AdoDaoTest.cs
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/ADO/MySql/AdoDaoTest.cs
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/ADO/Oracle/AdoDaoTest.cs
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/MutipleDaoTest.cs
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/NHibernateDaoTest.cs
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/SqlMapDaoTest.cs
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Scripts/MSSQL/account-init.sql
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/bin/Debug/dao_MSSQL_Odbc.config
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/bin/Debug/dao_MSSQL_SqlClient.config
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/ChangeLog.txt
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/Configuration/DomDaoManagerBuilder.cs
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoManager.cs
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoSessionHandlers/SimpleDaoSessionHandler.cs
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoSessionHandlers/SqlMapDaoSessionHandler.cs
incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/Interfaces/IDaoSessionHandler.cs
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Extensions/DaoSessionHandlers/NHibernateDaoSessionHandler.cs
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Extensions/DaoSessionHandlers/NHibernateDaoSessionHandler.cs?rev=178869&r1=178868&r2=178869&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Extensions/DaoSessionHandlers/NHibernateDaoSessionHandler.cs (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Extensions/DaoSessionHandlers/NHibernateDaoSessionHandler.cs Sat May 28 05:35:12 2005
@@ -27,7 +27,7 @@
#region Imports
using System;
using System.Collections;
-
+using System.Collections.Specialized;
using IBatisNet.Common;
using IBatisNet.Common.Exceptions;
using IBatisNet.Common.Utilities;
@@ -80,7 +80,8 @@
///
/// </summary>
/// <param name="properties"></param>
- public void Configure(IDictionary properties)
+ /// <param name="resources"></param>
+ public void Configure(NameValueCollection properties,IDictionary resources)
{
string mapping = string.Empty;
@@ -89,9 +90,9 @@
NHibernate.Cfg.Configuration config = new NHibernate.Cfg.Configuration();
// Set the connection string retrieve on the datasource
- config.SetProperty( CONNECTION_STRING, (properties["DataSource"] as DataSource).ConnectionString );
+ config.SetProperty( CONNECTION_STRING, (resources["DataSource"] as DataSource).ConnectionString );
- foreach(DictionaryEntry entry in properties)
+ foreach(DictionaryEntry entry in resources)
{
if ((entry.Key.ToString()).StartsWith("class."))
{
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/IBatisNet.DataAccess.Test.csproj
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/IBatisNet.DataAccess.Test.csproj?rev=178869&r1=178868&r2=178869&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/IBatisNet.DataAccess.Test.csproj (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/IBatisNet.DataAccess.Test.csproj Sat May 28 05:35:12 2005
@@ -193,7 +193,7 @@
/>
<File
RelPath = "bin\Debug\SqlMap_MSSQL_SqlClient.config"
- BuildAction = "None"
+ BuildAction = "EmbeddedResource"
/>
<File
RelPath = "bin\Debug\SqlMap_MySql_ByteFx.config"
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/Odbc/Complex.xml
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/Odbc/Complex.xml?rev=178869&r1=178868&r2=178869&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/Odbc/Complex.xml (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/Odbc/Complex.xml Sat May 28 05:35:12 2005
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
-<sqlMap namespace="Category" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<sqlMap namespace="Complex" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="SqlMap.xsd">
<statements>
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/Odbc/DynamicAccount.xml
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/Odbc/DynamicAccount.xml?rev=178869&r1=178868&r2=178869&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/Odbc/DynamicAccount.xml (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/Odbc/DynamicAccount.xml Sat May 28 05:35:12 2005
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
-<sqlMap namespace="Category" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<sqlMap namespace="Account" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="SqlMap.xsd">
<alias>
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/OleDb/Complex.xml
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/OleDb/Complex.xml?rev=178869&r1=178868&r2=178869&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/OleDb/Complex.xml (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/OleDb/Complex.xml Sat May 28 05:35:12 2005
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
-<sqlMap namespace="Category" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<sqlMap namespace="Complex" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="SqlMap.xsd">
<statements>
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/OleDb/DynamicAccount.xml
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/OleDb/DynamicAccount.xml?rev=178869&r1=178868&r2=178869&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/OleDb/DynamicAccount.xml (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/OleDb/DynamicAccount.xml Sat May 28 05:35:12 2005
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
-<sqlMap namespace="Category" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<sqlMap namespace="Account" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="SqlMap.xsd">
<alias>
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/SqlClient/Complex.xml
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/SqlClient/Complex.xml?rev=178869&r1=178868&r2=178869&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/SqlClient/Complex.xml (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/SqlClient/Complex.xml Sat May 28 05:35:12 2005
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
-<sqlMap namespace="Category" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<sqlMap namespace="Complex" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="SqlMap.xsd">
<statements>
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/SqlClient/DynamicAccount.xml
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/SqlClient/DynamicAccount.xml?rev=178869&r1=178868&r2=178869&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/SqlClient/DynamicAccount.xml (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Maps/MSSQL/SqlClient/DynamicAccount.xml Sat May 28 05:35:12 2005
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
-<sqlMap namespace="Category" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<sqlMap namespace="Account" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="SqlMap.xsd">
<alias>
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/ADO/MSSQL/AdoDaoTest.cs
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/ADO/MSSQL/AdoDaoTest.cs?rev=178869&r1=178868&r2=178869&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/ADO/MSSQL/AdoDaoTest.cs (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/ADO/MSSQL/AdoDaoTest.cs Sat May 28 05:35:12 2005
@@ -1,13 +1,5 @@
-using System;
-using System.IO;
-using System.Reflection;
using System.Configuration;
-
-using IBatisNet.DataAccess;
-using IBatisNet.Common.Utilities;
-
-using IBatisNet.DataAccess.Test.NUnit;
-
+using IBatisNet.DataAccess.Configuration;
using NUnit.Framework;
namespace IBatisNet.DataAccess.Test.NUnit.DaoTests.Ado.MSSQL
@@ -24,7 +16,8 @@
[SetUp]
public void SetUp()
{
- DaoManager.Configure( "dao_MSSQL_"
+ DomDaoManagerBuilder builder = new DomDaoManagerBuilder();
+ builder.Configure( "dao_MSSQL_"
+ ConfigurationSettings.AppSettings["providerType"] + ".config" );
daoManager = DaoManager.GetInstance();
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/ADO/MySql/AdoDaoTest.cs
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/ADO/MySql/AdoDaoTest.cs?rev=178869&r1=178868&r2=178869&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/ADO/MySql/AdoDaoTest.cs (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/ADO/MySql/AdoDaoTest.cs Sat May 28 05:35:12 2005
@@ -1,13 +1,5 @@
-using System;
-using System.IO;
-using System.Reflection;
using System.Configuration;
-
-using IBatisNet.DataAccess;
-using IBatisNet.Common.Utilities;
-
-using IBatisNet.DataAccess.Test.NUnit;
-
+using IBatisNet.DataAccess.Configuration;
using NUnit.Framework;
namespace IBatisNet.DataAccess.Test.NUnit.DaoTests.Ado.MySql
@@ -24,7 +16,8 @@
[SetUp]
public void SetUp()
{
- DaoManager.Configure( "dao_MySql_"
+ DomDaoManagerBuilder builder = new DomDaoManagerBuilder();
+ builder.Configure( "dao_MySql_"
+ ConfigurationSettings.AppSettings["providerType"] + ".config" );
daoManager = DaoManager.GetInstance();
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/ADO/Oracle/AdoDaoTest.cs
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/ADO/Oracle/AdoDaoTest.cs?rev=178869&r1=178868&r2=178869&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/ADO/Oracle/AdoDaoTest.cs (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/ADO/Oracle/AdoDaoTest.cs Sat May 28 05:35:12 2005
@@ -1,13 +1,5 @@
-using System;
-using System.IO;
-using System.Reflection;
using System.Configuration;
-
-using IBatisNet.DataAccess;
-using IBatisNet.Common.Utilities;
-
-using IBatisNet.DataAccess.Test.NUnit;
-
+using IBatisNet.DataAccess.Configuration;
using NUnit.Framework;
namespace IBatisNet.DataAccess.Test.NUnit.DaoTests.Ado.Oracle
@@ -24,7 +16,8 @@
[SetUp]
public void SetUp()
{
- DaoManager.Configure( "dao_Oracle_"
+ DomDaoManagerBuilder builder = new DomDaoManagerBuilder();
+ builder.Configure( "dao_Oracle_"
+ ConfigurationSettings.AppSettings["providerType"] + ".config" );
daoManager = DaoManager.GetInstance();
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/MutipleDaoTest.cs
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/MutipleDaoTest.cs?rev=178869&r1=178868&r2=178869&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/MutipleDaoTest.cs (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/MutipleDaoTest.cs Sat May 28 05:35:12 2005
@@ -1,14 +1,9 @@
using System;
-using System.IO;
-using System.Reflection;
using System.Configuration;
-
using IBatisNet.Common.Transaction;
-using IBatisNet.DataAccess;
+using IBatisNet.DataAccess.Configuration;
using IBatisNet.DataAccess.Test.Dao.Interfaces;
using IBatisNet.DataAccess.Test.Domain;
-using IBatisNet.DataAccess.Test.NUnit;
-
using NUnit.Framework;
namespace IBatisNet.DataAccess.Test.NUnit.DaoTests
@@ -30,7 +25,8 @@
[SetUp]
public void SetUp()
{
- DaoManager.Configure( "dao"+ "_" + ConfigurationSettings.AppSettings["database"] + "_"
+ DomDaoManagerBuilder builder = new DomDaoManagerBuilder();
+ builder.Configure( "dao"+ "_" + ConfigurationSettings.AppSettings["database"] + "_"
+ ConfigurationSettings.AppSettings["providerType"] + ".config" );
daoManager = DaoManager.GetInstance("SqlMapDao");
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/NHibernateDaoTest.cs
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/NHibernateDaoTest.cs?rev=178869&r1=178868&r2=178869&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/NHibernateDaoTest.cs (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/NHibernateDaoTest.cs Sat May 28 05:35:12 2005
@@ -1,16 +1,13 @@
+// DataSource definition
+ // ScriptRunner definition
using System;
-using System.IO;
using System.Configuration;
-
-using IBatisNet.DataAccess;
-using IBatisNet.Common; // DataSource definition
-using IBatisNet.Common.Utilities; // ScriptRunner definition
-
+using System.IO;
+using IBatisNet.Common;
+using IBatisNet.Common.Utilities;
+using IBatisNet.DataAccess.Configuration;
using IBatisNet.DataAccess.Test.Dao.Interfaces;
-
-using IBatisNet.DataAccess.Test.NUnit;
using IBatisNet.DataAccess.Test.Domain;
-
using NUnit.Framework;
namespace IBatisNet.DataAccess.Test.NUnit.DaoTests
@@ -18,31 +15,31 @@
/// <summary>
/// Summary description for NHibernateDaoTest.
/// </summary>
- [TestFixture]
+ [TestFixture]
public class NHibernateDaoTest
{
/// <summary>
/// A daoManager
/// </summary>
- private static DaoManager _daoManager = null;
+ private static DaoManager _daoManager = null;
/// <summary>
/// Initialisation
/// </summary>
- [SetUp]
- public void SetUp()
+ [SetUp]
+ public void SetUp()
{
- string scriptDirectory = Path.Combine( Path.Combine( Path.Combine( Path.Combine(Resources.ApplicationBase, ".."), ".."), "Scripts"), ConfigurationSettings.AppSettings["database"]) + Path.DirectorySeparatorChar;
+ string scriptDirectory = Path.Combine(Path.Combine(Path.Combine(Path.Combine(Resources.ApplicationBase, ".."), ".."), "Scripts"), ConfigurationSettings.AppSettings["database"]) + Path.DirectorySeparatorChar;
// Resources.RootDirectory + Path.DirectorySeparatorChar +
// "Scripts" + Path.DirectorySeparatorChar +
// ConfigurationSettings.AppSettings["database"]+ Path.DirectorySeparatorChar;
- DaoManager.Configure( "dao"+ "_" + ConfigurationSettings.AppSettings["database"] + "_"
- + ConfigurationSettings.AppSettings["providerType"] + ".config" );
+ DomDaoManagerBuilder builder = new DomDaoManagerBuilder();
+ builder.Configure("dao" + "_" + ConfigurationSettings.AppSettings["database"] + "_" + ConfigurationSettings.AppSettings["providerType"] + ".config");
_daoManager = DaoManager.GetInstance("NHibernateDao");
-
- InitScript( _daoManager.LocalDataSource, scriptDirectory + "user-init.sql" );
+
+ InitScript(_daoManager.LocalDataSource, scriptDirectory + "user-init.sql");
}
/// <summary>
@@ -60,11 +57,11 @@
/// <summary>
/// Test Create user
/// </summary>
- [Test]
+ [Test]
[Category("NHibernate")]
- public void TestCreateUser ()
+ public void TestCreateUser()
{
- IUserDao userDao = (IUserDao)_daoManager[typeof(IUserDao)];
+ IUserDao userDao = (IUserDao) _daoManager[typeof (IUserDao)];
User newUser = new User();
newUser.Id = "joe_cool";
@@ -78,10 +75,10 @@
_daoManager.OpenConnection();
userDao.Create(newUser);
}
- catch(Exception e)
+ catch (Exception e)
{
// Ignore
- Console.WriteLine("TestCreateUser, error cause : "+e.Message);
+ Console.WriteLine("TestCreateUser, error cause : " + e.Message);
}
finally
{
@@ -100,15 +97,15 @@
Assert.IsNotNull(joeCool);
Assert.AreEqual("Joseph Cool", joeCool.UserName);
-
+
//Change its properties and it will get persisted to the database on Close.
// set Joe Cool's Last Login property
- joeCool.LastLogon = stamp;
+ joeCool.LastLogon = stamp;
}
- catch(Exception e)
+ catch (Exception e)
{
// Ignore
- Console.WriteLine("TestCreateUser, error cause : "+e.Message);
+ Console.WriteLine("TestCreateUser, error cause : " + e.Message);
}
finally
{
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/SqlMapDaoTest.cs
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/SqlMapDaoTest.cs?rev=178869&r1=178868&r2=178869&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/SqlMapDaoTest.cs (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/NUnit/DaoTests/SqlMapDaoTest.cs Sat May 28 05:35:12 2005
@@ -1,12 +1,5 @@
-using System;
-using System.IO;
-using System.Reflection;
using System.Configuration;
-
-using IBatisNet.DataAccess;
-
-using IBatisNet.DataAccess.Test.NUnit;
-
+using IBatisNet.DataAccess.Configuration;
using NUnit.Framework;
namespace IBatisNet.DataAccess.Test.NUnit.DaoTests
@@ -22,7 +15,8 @@
[SetUp]
public void SetUp()
{
- DaoManager.Configure( "dao"+ "_" + ConfigurationSettings.AppSettings["database"] + "_"
+ DomDaoManagerBuilder builder = new DomDaoManagerBuilder();
+ builder.Configure( "dao"+ "_" + ConfigurationSettings.AppSettings["database"] + "_"
+ ConfigurationSettings.AppSettings["providerType"] + ".config" );
daoManager = DaoManager.GetInstance("SqlMapDao");
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Scripts/MSSQL/account-init.sql
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Scripts/MSSQL/account-init.sql?rev=178869&r1=178868&r2=178869&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Scripts/MSSQL/account-init.sql (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/Scripts/MSSQL/account-init.sql Sat May 28 05:35:12 2005
@@ -14,7 +14,9 @@
[Account_ID] [int] NOT NULL ,
[Account_FirstName] [varchar] (32) NOT NULL ,
[Account_LastName] [varchar] (32) NOT NULL ,
- [Account_Email] [varchar] (128) NULL
+ [Account_Email] [varchar] (128) NULL,
+ [Account_Banner_Option] [varchar] (255),
+ [Account_Cart_Option] [int]
) ON [PRIMARY]
ALTER TABLE [dbo].[Accounts] WITH NOCHECK ADD
@@ -25,16 +27,19 @@
-- Creating Test Data
-INSERT INTO [dbo].[Accounts] VALUES(1,'Joe', 'Dalton', 'Joe.Dalton@somewhere.com');
-INSERT INTO [dbo].[Accounts] VALUES(2,'Averel', 'Dalton', 'Averel.Dalton@somewhere.com');
-INSERT INTO [dbo].[Accounts] VALUES(3,'William', 'Dalton', null);
-INSERT INTO [dbo].[Accounts] VALUES(4,'Jack', 'Dalton', 'Jack.Dalton@somewhere.com');
-INSERT INTO [dbo].[Accounts] VALUES(5,'Gilles', 'Bayon', null);
+INSERT INTO [dbo].[Accounts] VALUES(1,'Joe', 'Dalton', 'Joe.Dalton@somewhere.com', 'Oui', 200);
+INSERT INTO [dbo].[Accounts] VALUES(2,'Averel', 'Dalton', 'Averel.Dalton@somewhere.com', 'Oui', 200);
+INSERT INTO [dbo].[Accounts] VALUES(3,'William', 'Dalton', null, 'Non', 100);
+INSERT INTO [dbo].[Accounts] VALUES(4,'Jack', 'Dalton', 'Jack.Dalton@somewhere.com', 'Non', 100);
+INSERT INTO [dbo].[Accounts] VALUES(5,'Gilles', 'Bayon', null, 'Oui', 100);
-- Store procedure
-if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_InsertAccount]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
-drop procedure [dbo].[sp_InsertAccount]
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ps_InsertAccount]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
+drop procedure [dbo].[ps_InsertAccount]
+
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ps_SelectAccount]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
+drop procedure [dbo].[ps_SelectAccount]
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ps_swap_email_address]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[ps_swap_email_address]
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/bin/Debug/dao_MSSQL_Odbc.config
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/bin/Debug/dao_MSSQL_Odbc.config?rev=178869&r1=178868&r2=178869&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/bin/Debug/dao_MSSQL_Odbc.config (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/bin/Debug/dao_MSSQL_Odbc.config Sat May 28 05:35:12 2005
@@ -32,7 +32,7 @@
<dataSource name="iBatisNet" connectionString="Driver={SQL Server};Server=(local)\NetSDK;Database=IBatisNet;Uid=IBatisNet;Pwd=test;"/>
</database>
<daoSessionHandler id="SqlMap">
- <property name="sqlMapConfigFile" value="SqlMap_MSSQL_Odbc.config"/>
+ <property name="resource" value="SqlMap_MSSQL_Odbc.config"/>
</daoSessionHandler>
<daoFactory>
<dao interface="IBatisNet.DataAccess.Test.Dao.Interfaces.IAccountDao, IBatisNet.DataAccess.Test" implementation="IBatisNet.DataAccess.Test.Dao.Implementations.DataMapper.AccountDao, IBatisNet.DataAccess.Test"/>
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/bin/Debug/dao_MSSQL_SqlClient.config
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/bin/Debug/dao_MSSQL_SqlClient.config?rev=178869&r1=178868&r2=178869&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/bin/Debug/dao_MSSQL_SqlClient.config (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess.Test/bin/Debug/dao_MSSQL_SqlClient.config Sat May 28 05:35:12 2005
@@ -30,7 +30,14 @@
</database>
<daoSessionHandler id="SqlMap">
- <property name="sqlMapConfigFile" value="SqlMap_MSSQL_SqlClient.config"/>
+ <!--
+ <property name="resource" value="SqlMap_MSSQL_SqlClient.config"/>
+ -->
+ <!-- <property name="url" value="E:\Projet\iBatis\trunk\cs\mapper\IBatisNet.DataAccess.Test\bin\Debug\SqlMap_MSSQL_SqlClient.config"/>
+ -->
+ <!-- -->
+ <property name="embedded" value="bin.Debug.SqlMap_MSSQL_SqlClient.config, IBatisNet.DataAccess.Test"/>
+
</daoSessionHandler>
<daoFactory>
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/ChangeLog.txt
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/ChangeLog.txt?rev=178869&r1=178868&r2=178869&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/ChangeLog.txt (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/ChangeLog.txt Sat May 28 05:35:12 2005
@@ -1,5 +1,15 @@
IBatisNet DataAccess Change Log
------------------------------
-1.5.* - XX/XX/XXXX
-------------------------------
\ No newline at end of file
+1.5.1 - 01-June-2005
+------------------------------
+
+- Added new API to DomDaoManagerBuilder.Configure(...)[old API DaoManager.Configure(...) are marked as obsolete]
+- Added New syntax to configure daoSessionHandler (old is too supported)
+<daoSessionHandler id="SqlMap">
+ <property name="resource" value="SqlMap_MSSQL_SqlClient.config"/>
+ <property name="url" value="E:\Projet\iBatis\trunk\cs\mapper\IBatisNet.DataAccess.Test\bin\Debug\SqlMap_MSSQL_SqlClient.config"/>
+ <property name="embedded" value="bin.Debug.SqlMap_MSSQL_SqlClient.config, IBatisNet.DataAccess.Test"/>
+</daoSessionHandler>
+
+- Fixed JIRA-69 Added support for global setting in ressource and url attribute (JIRA-69)
\ No newline at end of file
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/Configuration/DomDaoManagerBuilder.cs
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/Configuration/DomDaoManagerBuilder.cs?rev=178869&r1=178868&r2=178869&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/Configuration/DomDaoManagerBuilder.cs (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/Configuration/DomDaoManagerBuilder.cs Sat May 28 05:35:12 2005
@@ -28,6 +28,8 @@
using System;
using System.Collections;
+using System.IO;
+using System.Threading;
using System.Xml;
using System.Xml.Serialization;
using IBatisNet.Common;
@@ -47,6 +49,10 @@
{
#region Constants
/// <summary>
+ /// Key for default config name
+ /// </summary>
+ public const string DEFAULT_FILE_CONFIG_NAME = "dao.config";
+ /// <summary>
/// Key for default provider name
/// </summary>
public const string DEFAULT_PROVIDER_NAME = "_DEFAULT_PROVIDER_NAME";
@@ -75,6 +81,165 @@
#endregion
+ #region Configure
+
+ /// <summary>
+ /// Configure DaoManagers from via the default file config.
+ /// (accesd as relative ressource path from your Application root)
+ /// </summary>
+ public void Configure()
+ {
+ Configure( DomDaoManagerBuilder.DEFAULT_FILE_CONFIG_NAME );
+ }
+
+
+ /// <summary>
+ /// Configure DaoManagers from a file path.
+ /// </summary>
+ /// <param name="resource">
+ /// A relative ressource path from your Application root
+ /// or a absolue file path file:\\c:\dir\a.config
+ /// </param>
+ public void Configure(string resource)
+ {
+ XmlDocument document = null;
+ if (resource.StartsWith("file://"))
+ {
+ document = Resources.GetUrlAsXmlDocument( resource.Remove(0, 7) );
+ }
+ else
+ {
+ document = Resources.GetResourceAsXmlDocument( resource );
+ }
+ BuildDaoManagers( document, false );
+ }
+
+
+ /// <summary>
+ /// Configure DaoManagers from a stream.
+ /// </summary>
+ /// <param name="resource">A stream resource</param>
+ public void Configure(Stream resource)
+ {
+ XmlDocument document = Resources.GetStreamAsXmlDocument( resource );
+ BuildDaoManagers( document, false );
+ }
+
+ /// <summary>
+ /// Configure DaoManagers from a FileInfo.
+ /// </summary>
+ /// <param name="resource">A FileInfo resource</param>
+ /// <returns>An SqlMap</returns>
+ public void Configure(FileInfo resource)
+ {
+ XmlDocument document = Resources.GetFileInfoAsXmlDocument( resource );
+ BuildDaoManagers( document, false );
+ }
+
+ /// <summary>
+ /// Configure DaoManagers from an Uri.
+ /// </summary>
+ /// <param name="resource">A Uri resource</param>
+ /// <returns></returns>
+ public void Configure(Uri resource)
+ {
+ XmlDocument document = Resources.GetUriAsXmlDocument( resource );
+ BuildDaoManagers( document, false );
+ }
+
+ /// <summary>
+ /// Configure and monitor the configuration file for modifications and
+ /// automatically reconfigure
+ /// </summary>
+ /// <param name="configureDelegate">
+ /// Delegate called when a file is changed to rebuild the
+ /// </param>
+ public void ConfigureAndWatch(ConfigureHandler configureDelegate)
+ {
+ ConfigureAndWatch( DomDaoManagerBuilder.DEFAULT_FILE_CONFIG_NAME, configureDelegate );
+ }
+
+
+ /// <summary>
+ /// Configure and monitor the configuration file for modifications and
+ /// automatically reconfigure
+ /// </summary>
+ /// <param name="resource">
+ /// A relative ressource path from your Application root
+ /// or an absolue file path file:\\c:\dir\a.config
+ /// </param>
+ ///<param name="configureDelegate">
+ /// Delegate called when the file has changed, to rebuild the dal.
+ /// </param>
+ public void ConfigureAndWatch(string resource, ConfigureHandler configureDelegate)
+ {
+ XmlDocument document = null;
+ if (resource.StartsWith("file://"))
+ {
+ document = Resources.GetUrlAsXmlDocument( resource.Remove(0, 7) );
+ }
+ else
+ {
+ document = Resources.GetResourceAsXmlDocument( resource );
+ }
+
+ ConfigWatcherHandler.ClearFilesMonitored();
+ ConfigWatcherHandler.AddFileToWatch( Resources.GetFileInfo( resource ) );
+
+ BuildDaoManagers( document, true );
+
+ TimerCallback callBakDelegate = new TimerCallback( DomDaoManagerBuilder.OnConfigFileChange );
+
+ StateConfig state = new StateConfig();
+ state.FileName = resource;
+ state.ConfigureHandler = configureDelegate;
+
+ new ConfigWatcherHandler( callBakDelegate, state );
+ }
+
+
+ /// <summary>
+ /// Configure and monitor the configuration file for modifications
+ /// and automatically reconfigure SqlMap.
+ /// </summary>
+ /// <param name="resource">
+ /// A FileInfo to your config file.
+ /// </param>
+ ///<param name="configureDelegate">
+ /// Delegate called when the file has changed, to rebuild the dal.
+ /// </param>
+ /// <returns>An SqlMap</returns>
+ public void ConfigureAndWatch( FileInfo resource, ConfigureHandler configureDelegate )
+ {
+ XmlDocument document = Resources.GetFileInfoAsXmlDocument(resource);
+
+ ConfigWatcherHandler.ClearFilesMonitored();
+ ConfigWatcherHandler.AddFileToWatch( resource );
+
+ BuildDaoManagers( document, true );
+
+ TimerCallback callBakDelegate = new TimerCallback( DomDaoManagerBuilder.OnConfigFileChange );
+
+ StateConfig state = new StateConfig();
+ state.FileName = resource.FullName;
+ state.ConfigureHandler = configureDelegate;
+
+ new ConfigWatcherHandler( callBakDelegate, state );
+ }
+
+ /// <summary>
+ /// Called when the configuration has been updated.
+ /// </summary>
+ /// <param name="obj">The state config.</param>
+ public static void OnConfigFileChange(object obj)
+ {
+ StateConfig state = (StateConfig)obj;
+ state.ConfigureHandler(null);
+ }
+
+
+ #endregion
+
#region Methods
/// <summary>
@@ -281,12 +446,12 @@
configurationScope.ErrorContext.MoreInfo = "configure DaoSessionHandler";
- // The properties use to initialize the SessionHandler
- IDictionary properties = new Hashtable();
+ // The resources use to initialize the SessionHandler
+ IDictionary resources = new Hashtable();
// By default, add the DataSource
- properties.Add( "DataSource", daoManager.DataSource);
+ resources.Add( "DataSource", daoManager.DataSource);
// By default, add the useConfigFileWatcher
- properties.Add( "UseConfigFileWatcher", configurationScope.UseConfigFileWatcher);
+ resources.Add( "UseConfigFileWatcher", configurationScope.UseConfigFileWatcher);
IDaoSessionHandler sessionHandler = null;
@@ -299,7 +464,7 @@
// Parse property node
foreach(XmlNode nodeProperty in nodeSessionHandler.SelectNodes("property"))
{
- properties.Add(nodeProperty.Attributes["name"].Value,
+ resources.Add(nodeProperty.Attributes["name"].Value,
Resources.ParsePropertyTokens(nodeProperty.Attributes["value"].Value, configurationScope.Properties));
}
}
@@ -311,7 +476,7 @@
// Configure the sessionHandler
configurationScope.ErrorContext.ObjectId = sessionHandler.GetType().FullName;
- sessionHandler.Configure( properties );
+ sessionHandler.Configure(configurationScope.Properties, resources );
daoManager.DaoSessionHandler = sessionHandler;
@@ -515,7 +680,6 @@
XmlSerializer serializer = null;
Dao dao = null;
XmlNode xmlDaoFactory = null;
- string currentDirectory = Resources.BaseDirectory;
xmlDaoFactory = configurationScope.NodeContext.SelectSingleNode("daoFactory");
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoManager.cs
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoManager.cs?rev=178869&r1=178868&r2=178869&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoManager.cs (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoManager.cs Sat May 28 05:35:12 2005
@@ -96,13 +96,9 @@
{
#region Constants
/// <summary>
- ///
+ /// Key for default context name
/// </summary>
public static string DEFAULT_CONTEXT_NAME = "_DEFAULT_CONTEXT_NAME";
- /// <summary>
- ///
- /// </summary>
- private const string DEFAULT_FILE_CONFIG_NAME = "dao.config";
#endregion
#region Fields
@@ -228,10 +224,12 @@
/// <summary>
/// Configure an DaoManager from via the default file config.
+ /// (accesd as relative ressource path from your Application root)
/// </summary>
+ [Obsolete("This method will be remove in future version, use DomSqlMapBuilder.Configure.", false)]
public static void Configure()
{
- Configure( DEFAULT_FILE_CONFIG_NAME );
+ Configure( DomDaoManagerBuilder.DEFAULT_FILE_CONFIG_NAME );
}
@@ -241,6 +239,7 @@
/// <param name="resource">
/// A relative ressource path from your Application root.
/// </param>
+ [Obsolete("This method will be remove in future version, use DomSqlMapBuilder.Configure.", false)]
public static void Configure(string resource)
{
XmlDocument document = Resources.GetResourceAsXmlDocument( resource );
@@ -255,9 +254,10 @@
/// <param name="configureDelegate">
/// Delegate called when a file is changed to rebuild the
/// </param>
+ [Obsolete("This method will be remove in future version, use DomSqlMapBuilder.Configure.", false)]
public static void ConfigureAndWatch(ConfigureHandler configureDelegate)
{
- ConfigureAndWatch( DEFAULT_FILE_CONFIG_NAME, configureDelegate );
+ ConfigureAndWatch( DomDaoManagerBuilder.DEFAULT_FILE_CONFIG_NAME, configureDelegate );
}
@@ -271,6 +271,7 @@
///<param name="configureDelegate">
/// Delegate called when the file has changed, to rebuild the dal.
/// </param>
+ [Obsolete("This method will be remove in future version, use DomSqlMapBuilder.Configure.", false)]
public static void ConfigureAndWatch(string resource, ConfigureHandler configureDelegate)
{
ConfigWatcherHandler.ClearFilesMonitored();
@@ -279,25 +280,13 @@
XmlDocument document = Resources.GetConfigAsXmlDocument( resource );
new DomDaoManagerBuilder().BuildDaoManagers( document, true );
- TimerCallback callBakDelegate = new TimerCallback( DaoManager.OnConfigFileChange );
+ TimerCallback callBakDelegate = new TimerCallback( DomDaoManagerBuilder.OnConfigFileChange );
StateConfig state = new StateConfig();
- state.fileName = resource;
- state.configureHandler = configureDelegate;
+ state.FileName = resource;
+ state.ConfigureHandler = configureDelegate;
new ConfigWatcherHandler( callBakDelegate, state );
- }
-
- /// <summary>
- /// Called when the configuration has been updated.
- /// </summary>
- /// <param name="obj">The state config.</param>
- public static void OnConfigFileChange(object obj)
- {
- StateConfig state = (StateConfig)obj;
-
- //ConfigureAndWatch( state.fileName, state.configureHandler );
- state.configureHandler(null);
}
#endregion
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoSessionHandlers/SimpleDaoSessionHandler.cs
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoSessionHandlers/SimpleDaoSessionHandler.cs?rev=178869&r1=178868&r2=178869&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoSessionHandlers/SimpleDaoSessionHandler.cs (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoSessionHandlers/SimpleDaoSessionHandler.cs Sat May 28 05:35:12 2005
@@ -24,15 +24,14 @@
********************************************************************************/
#endregion
-#region Imports
-using System;
-using System.Collections;
+#region Using
+using System.Collections;
+using System.Collections.Specialized;
using IBatisNet.Common;
-
-using IBatisNet.DataAccess;
-using IBatisNet.DataAccess.Exceptions;
+using IBatisNet.DataAccess.Exceptions;
using IBatisNet.DataAccess.Interfaces;
+
#endregion
namespace IBatisNet.DataAccess.DaoSessionHandlers
@@ -60,9 +59,10 @@
///
/// </summary>
/// <param name="properties"></param>
- public void Configure(IDictionary properties)
+ /// <param name="resources"></param>
+ public void Configure(NameValueCollection properties, IDictionary resources)
{
- _dataSource = (DataSource) properties["DataSource"];
+ _dataSource = (DataSource) resources["DataSource"];
}
/// <summary>
@@ -79,7 +79,6 @@
return (new SimpleDaoSession(daoManager,_dataSource));
}
#endregion
-
}
}
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoSessionHandlers/SqlMapDaoSessionHandler.cs
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoSessionHandlers/SqlMapDaoSessionHandler.cs?rev=178869&r1=178868&r2=178869&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoSessionHandlers/SqlMapDaoSessionHandler.cs (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoSessionHandlers/SqlMapDaoSessionHandler.cs Sat May 28 05:35:12 2005
@@ -24,20 +24,19 @@
********************************************************************************/
#endregion
-#region Imports
+#region Using
+
using System;
using System.Collections;
-
+using System.Collections.Specialized;
+using System.Xml;
using IBatisNet.Common;
using IBatisNet.Common.Exceptions;
using IBatisNet.Common.Utilities;
-
-using IBatisNet.DataAccess;
-using IBatisNet.DataAccess.Exceptions;
using IBatisNet.DataAccess.Interfaces;
-
using IBatisNet.DataMapper;
using IBatisNet.DataMapper.Configuration;
+
#endregion
namespace IBatisNet.DataAccess.DaoSessionHandlers
@@ -75,20 +74,47 @@
///
/// </summary>
/// <param name="properties"></param>
- public void Configure(IDictionary properties)
+ /// <param name="resources"></param>
+ public void Configure(NameValueCollection properties, IDictionary resources)
{
+ DomSqlMapBuilder builder = new DomSqlMapBuilder();
+ XmlDocument document = null;
+
try
{
- string fileName = (string) properties["sqlMapConfigFile"];
- DataSource dataSource = (DataSource) properties["DataSource"];
- bool useConfigFileWatcher = (bool) properties["UseConfigFileWatcher"];
+// string fileName = (string) resources["sqlMapConfigFile"];
+ DataSource dataSource = (DataSource) resources["DataSource"];
+ bool useConfigFileWatcher = (bool) resources["UseConfigFileWatcher"];
- if (useConfigFileWatcher == true)
+ if (resources.Contains("resource")||resources.Contains("sqlMapConfigFile"))
{
- ConfigWatcherHandler.AddFileToWatch( Resources.GetFileInfo( fileName ) );
+ string fileName = string.Empty;
+ if (resources.Contains("resource"))
+ {
+ fileName = (string) resources["resource"];
+ }else
+ {
+ fileName = (string) resources["sqlMapConfigFile"];
+ }
+ if (useConfigFileWatcher == true)
+ {
+ ConfigWatcherHandler.AddFileToWatch( Resources.GetFileInfo( fileName ) );
+ }
+ document = Resources.GetResourceAsXmlDocument(fileName);
}
-
- _sqlMap = new DomSqlMapBuilder().Build( Resources.GetConfigAsXmlDocument(fileName), dataSource, useConfigFileWatcher);
+ else if ( resources.Contains("url") )
+ {
+ document = Resources.GetUrlAsXmlDocument( (string) resources["url"] );
+ }
+ else if ( resources.Contains("embedded") )
+ {
+ document = Resources.GetEmbeddedResourceAsXmlDocument( (string) resources["embedded"] );
+ }
+ else
+ {
+ throw new ConfigurationException("Invalid attribute on daoSessionHandler/property ");
+ }
+ _sqlMap = builder.Build( document, dataSource, useConfigFileWatcher, properties);
}
catch(Exception e)
{
Modified: incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/Interfaces/IDaoSessionHandler.cs
URL: http://svn.apache.org/viewcvs/incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/Interfaces/IDaoSessionHandler.cs?rev=178869&r1=178868&r2=178869&view=diff
==============================================================================
--- incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/Interfaces/IDaoSessionHandler.cs (original)
+++ incubator/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/Interfaces/IDaoSessionHandler.cs Sat May 28 05:35:12 2005
@@ -24,11 +24,11 @@
********************************************************************************/
#endregion
-#region Imports
-using System;
+#region Using
+
using System.Collections;
+using System.Collections.Specialized;
-using IBatisNet.DataAccess;
#endregion
@@ -49,7 +49,8 @@
/// <summary>
///
/// </summary>
- /// <param name="properties"></param>
- void Configure(IDictionary properties);
+ /// <param name="properties">The properties scope</param>
+ /// <param name="resources">A collection of object useful to init</param>
+ void Configure(NameValueCollection properties, IDictionary resources);
}
}