|
From: <fab...@us...> - 2009-11-30 20:31:34
|
Revision: 4879
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4879&view=rev
Author: fabiomaulo
Date: 2009-11-30 20:31:06 +0000 (Mon, 30 Nov 2009)
Log Message:
-----------
binders refactoring
-removed duplicated code
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/ClassBinder.cs
trunk/nhibernate/src/NHibernate/Mapping/Join.cs
trunk/nhibernate/src/NHibernate/Mapping/PersistentClass.cs
trunk/nhibernate/src/NHibernate/NHibernate.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate/Mapping/ISqlCustomizable.cs
Modified: trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/ClassBinder.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/ClassBinder.cs 2009-11-30 17:48:41 UTC (rev 4878)
+++ trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/ClassBinder.cs 2009-11-30 20:31:06 UTC (rev 4879)
@@ -115,6 +115,8 @@
// CUSTOM SQL
HandleCustomSQL(classMapping, model);
+ if (classMapping.SqlLoader != null)
+ model.LoaderName = classMapping.SqlLoader.queryref;
foreach (var synchronize in classMapping.Synchronize)
{
@@ -219,9 +221,8 @@
HandleCustomSQL(joinMapping, join);
}
- private void HandleCustomSQL(IEntitySqlsMapping sqlsMapping, PersistentClass model)
+ private void HandleCustomSQL(IEntitySqlsMapping sqlsMapping, ISqlCustomizable model)
{
- // TODO : common interface between PersistentClass & Join for custom SQL
var sqlInsert = sqlsMapping.SqlInsert;
if (sqlInsert != null)
{
@@ -242,36 +243,8 @@
bool callable = sqlUpdate.callableSpecified && sqlUpdate.callable;
model.SetCustomSQLUpdate(sqlUpdate.Text.LinesToString(), callable, GetResultCheckStyle(sqlUpdate));
}
-
- if (sqlsMapping.SqlLoader != null)
- model.LoaderName = sqlsMapping.SqlLoader.queryref;
}
- private void HandleCustomSQL(IEntitySqlsMapping sqlsMapping, Join model)
- {
- // TODO : common interface between PersistentClass & Join for custom SQL
- var sqlInsert = sqlsMapping.SqlInsert;
- if (sqlInsert != null)
- {
- bool callable = sqlInsert.callableSpecified && sqlInsert.callable;
- model.SetCustomSQLInsert(sqlInsert.Text.LinesToString(), callable, GetResultCheckStyle(sqlInsert));
- }
-
- var sqlDelete = sqlsMapping.SqlDelete;
- if (sqlDelete != null)
- {
- bool callable = sqlDelete.callableSpecified && sqlDelete.callable;
- model.SetCustomSQLDelete(sqlDelete.Text.LinesToString(), callable, GetResultCheckStyle(sqlDelete));
- }
-
- var sqlUpdate = sqlsMapping.SqlUpdate;
- if (sqlUpdate != null)
- {
- bool callable = sqlUpdate.callableSpecified && sqlUpdate.callable;
- model.SetCustomSQLUpdate(sqlUpdate.Text.LinesToString(), callable, GetResultCheckStyle(sqlUpdate));
- }
- }
-
protected PersistentClass GetSuperclass(XmlNode subnode)
{
XmlAttribute extendsAttr = subnode.Attributes["extends"];
Added: trunk/nhibernate/src/NHibernate/Mapping/ISqlCustomizable.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ISqlCustomizable.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/Mapping/ISqlCustomizable.cs 2009-11-30 20:31:06 UTC (rev 4879)
@@ -0,0 +1,11 @@
+using NHibernate.Engine;
+
+namespace NHibernate.Mapping
+{
+ public interface ISqlCustomizable
+ {
+ void SetCustomSQLInsert(string sql, bool callable, ExecuteUpdateResultCheckStyle checkStyle);
+ void SetCustomSQLUpdate(string sql, bool callable, ExecuteUpdateResultCheckStyle checkStyle);
+ void SetCustomSQLDelete(string sql, bool callable, ExecuteUpdateResultCheckStyle checkStyle);
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/Mapping/Join.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/Join.cs 2009-11-30 17:48:41 UTC (rev 4878)
+++ trunk/nhibernate/src/NHibernate/Mapping/Join.cs 2009-11-30 20:31:06 UTC (rev 4879)
@@ -7,7 +7,7 @@
namespace NHibernate.Mapping
{
[Serializable]
- public class Join
+ public class Join : ISqlCustomizable
{
private static readonly Alias PK_ALIAS = new Alias(15, "PK");
Modified: trunk/nhibernate/src/NHibernate/Mapping/PersistentClass.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/PersistentClass.cs 2009-11-30 17:48:41 UTC (rev 4878)
+++ trunk/nhibernate/src/NHibernate/Mapping/PersistentClass.cs 2009-11-30 20:31:06 UTC (rev 4879)
@@ -14,7 +14,7 @@
/// <c><joined-subclass></c>.
/// </summary>
[Serializable]
- public abstract class PersistentClass : IFilterable, IMetaAttributable
+ public abstract class PersistentClass : IFilterable, IMetaAttributable, ISqlCustomizable
{
private static readonly Alias PKAlias = new Alias(15, "PK");
Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2009-11-30 17:48:41 UTC (rev 4878)
+++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2009-11-30 20:31:06 UTC (rev 4879)
@@ -669,6 +669,7 @@
<Compile Include="Loader\Criteria\EntityCriteriaInfoProvider.cs" />
<Compile Include="Loader\Criteria\ICriteriaInfoProvider.cs" />
<Compile Include="Loader\Criteria\ScalarCollectionCriteriaInfoProvider.cs" />
+ <Compile Include="Mapping\ISqlCustomizable.cs" />
<Compile Include="Param\AbstractExplicitParameterSpecification.cs" />
<Compile Include="Param\AggregatedIndexCollectionSelectorParameterSpecifications.cs" />
<Compile Include="Param\CollectionFilterKeyParameterSpecification.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|