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: <fab...@us...> - 2011-04-10 18:32:41
|
Revision: 5653
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5653&view=rev
Author: fabiomaulo
Date: 2011-04-10 18:32:35 +0000 (Sun, 10 Apr 2011)
Log Message:
-----------
SimpleModelInspector with default pattern to discover Components
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/SimpleModelInspector.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/MappingByCode/MixAutomapping/ComponentsTests.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/SimpleModelInspector.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/SimpleModelInspector.cs 2011-04-10 18:15:26 UTC (rev 5652)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/SimpleModelInspector.cs 2011-04-10 18:32:35 UTC (rev 5653)
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Reflection;
namespace NHibernate.Mapping.ByCode
@@ -18,7 +19,7 @@
private Func<System.Type, bool, bool> isTablePerClassHierarchy = (t, declared) => declared;
private Func<System.Type, bool, bool> isTablePerConcreteClass = (t, declared) => declared;
private Func<System.Type, IEnumerable<string>, IEnumerable<string>> splitsForType = (t, declared) => declared;
- private Func<System.Type, bool, bool> isComponent = (t, declared) => declared;
+ private Func<System.Type, bool, bool> isComponent;
private Func<MemberInfo, bool, bool> isPersistentId;
private Func<MemberInfo, bool, bool> isPersistentProperty = (m, declared) => declared;
@@ -42,6 +43,7 @@
public SimpleModelInspector()
{
isPersistentId = (m, declared) => declared || MatchPoIdPattern(m);
+ isComponent = (t, declared) => declared || MatchComponentPattern(t);
}
protected bool MatchPoIdPattern(MemberInfo subject)
@@ -53,6 +55,18 @@
|| (name.StartsWith(subject.DeclaringType.Name) && name.Equals(subject.DeclaringType.Name + "id", StringComparison.InvariantCultureIgnoreCase));
}
+ protected bool MatchComponentPattern(System.Type subject)
+ {
+ const BindingFlags flattenHierarchyMembers =
+ BindingFlags.FlattenHierarchy | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
+
+ var modelInspector = (IModelInspector) this;
+ return !subject.IsEnum && !subject.Namespace.StartsWith("System") /* hack */&& !modelInspector.IsEntity(subject)
+ &&
+ !subject.GetProperties(flattenHierarchyMembers).Cast<MemberInfo>().Concat(
+ subject.GetFields(flattenHierarchyMembers)).Any(m => modelInspector.IsPersistentId(m));
+ }
+
#region IModelExplicitDeclarationsHolder Members
IEnumerable<System.Type> IModelExplicitDeclarationsHolder.RootEntities
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/MixAutomapping/ComponentsTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/MixAutomapping/ComponentsTests.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/MixAutomapping/ComponentsTests.cs 2011-04-10 18:32:35 UTC (rev 5653)
@@ -0,0 +1,79 @@
+using NHibernate.Mapping.ByCode;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.MappingByCode.MixAutomapping
+{
+ public class ComponentsTests
+ {
+ // a class without Poid is a Component
+ private class AComponent
+ {
+ public string S { get; set; }
+ }
+ private class AEntity
+ {
+ public int Id { get; set; }
+ }
+ private class Entity
+ {
+ private int id;
+ }
+
+ private enum Something
+ {
+
+ }
+
+ [Test]
+ public void WhenAClassIsExplicitlyDeclaredAsComponentThenIsComponent()
+ {
+ var autoinspector = new SimpleModelInspector();
+ var mapper = new ModelMapper(autoinspector);
+ mapper.Component<AEntity>(map => { });
+
+ var inspector = (IModelInspector)autoinspector;
+ inspector.IsComponent(typeof(AEntity)).Should().Be.True();
+ }
+
+ [Test]
+ public void ClassWithoutPoidIsComponent()
+ {
+ var autoinspector = new SimpleModelInspector();
+ var inspector = (IModelInspector)autoinspector;
+ inspector.IsComponent(typeof(AComponent)).Should().Be.True();
+ }
+
+ [Test]
+ public void ClassWithPoidIsNotComponent()
+ {
+ var autoinspector = new SimpleModelInspector();
+ var inspector = (IModelInspector)autoinspector;
+ inspector.IsComponent(typeof(AEntity)).Should().Be.False();
+ }
+
+ [Test]
+ public void ClassWithPoidFieldIsNotComponent()
+ {
+ var autoinspector = new SimpleModelInspector();
+ var inspector = (IModelInspector)autoinspector;
+ inspector.IsComponent(typeof(Entity)).Should().Be.False();
+ }
+
+ [Test]
+ public void EnumIsNotComponent()
+ {
+ var autoinspector = new SimpleModelInspector();
+ var inspector = (IModelInspector)autoinspector;
+ inspector.IsComponent(typeof(Something)).Should().Be.False();
+ }
+
+ [Test]
+ public void StringIsNotComponent()
+ {
+ var autoinspector = new SimpleModelInspector();
+ var inspector = (IModelInspector)autoinspector;
+ inspector.IsComponent(typeof(string)).Should().Be.False();
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-10 18:15:26 UTC (rev 5652)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-10 18:32:35 UTC (rev 5653)
@@ -541,6 +541,7 @@
<Compile Include="MappingByCode\MappersTests\IdBagMapperTest.cs" />
<Compile Include="MappingByCode\MappersTests\JoinMapperTests.cs" />
<Compile Include="MappingByCode\MappersTests\SubclassMapperWithJoinPropertiesTest.cs" />
+ <Compile Include="MappingByCode\MixAutomapping\ComponentsTests.cs" />
<Compile Include="MappingByCode\MixAutomapping\PoidTests.cs" />
<Compile Include="MappingByCode\ModelExplicitDeclarationsHolderMergeTest.cs" />
<Compile Include="MappingByCode\NatureDemo\Naturalness\Address.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-10 18:15:32
|
Revision: 5652
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5652&view=rev
Author: fabiomaulo
Date: 2011-04-10 18:15:26 +0000 (Sun, 10 Apr 2011)
Log Message:
-----------
SimpleModelInspector with default pattern to discover POID
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/SimpleModelInspector.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/MappingByCode/MixAutomapping/
trunk/nhibernate/src/NHibernate.Test/MappingByCode/MixAutomapping/PoidTests.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/SimpleModelInspector.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/SimpleModelInspector.cs 2011-04-10 17:55:04 UTC (rev 5651)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/SimpleModelInspector.cs 2011-04-10 18:15:26 UTC (rev 5652)
@@ -20,7 +20,7 @@
private Func<System.Type, IEnumerable<string>, IEnumerable<string>> splitsForType = (t, declared) => declared;
private Func<System.Type, bool, bool> isComponent = (t, declared) => declared;
- private Func<MemberInfo, bool, bool> isPersistentId = (m, declared) => declared;
+ private Func<MemberInfo, bool, bool> isPersistentId;
private Func<MemberInfo, bool, bool> isPersistentProperty = (m, declared) => declared;
private Func<MemberInfo, bool, bool> isVersion = (m, declared) => declared;
@@ -39,6 +39,20 @@
private Func<MemberInfo, bool, bool> isIdBag = (m, declared) => declared;
private Func<MemberInfo, bool, bool> isList = (m, declared) => declared;
+ public SimpleModelInspector()
+ {
+ isPersistentId = (m, declared) => declared || MatchPoIdPattern(m);
+ }
+
+ protected bool MatchPoIdPattern(MemberInfo subject)
+ {
+ var name = subject.Name;
+ return name.Equals("id", StringComparison.InvariantCultureIgnoreCase)
+ || name.Equals("poid", StringComparison.InvariantCultureIgnoreCase)
+ || name.Equals("oid", StringComparison.InvariantCultureIgnoreCase)
+ || (name.StartsWith(subject.DeclaringType.Name) && name.Equals(subject.DeclaringType.Name + "id", StringComparison.InvariantCultureIgnoreCase));
+ }
+
#region IModelExplicitDeclarationsHolder Members
IEnumerable<System.Type> IModelExplicitDeclarationsHolder.RootEntities
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/MixAutomapping/PoidTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/MixAutomapping/PoidTests.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/MixAutomapping/PoidTests.cs 2011-04-10 18:15:26 UTC (rev 5652)
@@ -0,0 +1,60 @@
+using NHibernate.Mapping.ByCode;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.MappingByCode.MixAutomapping
+{
+ public class PoidTests
+ {
+ private class MyClass
+ {
+ public int EntityIdentificator { get; set; }
+ }
+ private class TestEntity
+ {
+ public int Id { get; set; }
+ public int id { get; set; }
+ public int PoId { get; set; }
+ public int POID { get; set; }
+ public int OId { get; set; }
+ public int TestEntityId { get; set; }
+ public int testEntityId { get; set; }
+ public int Something { get; set; }
+ }
+
+ [Test]
+ public void WhenExplicitDeclaredThenMatch()
+ {
+ var autoinspector = new SimpleModelInspector();
+ var mapper = new ModelMapper(autoinspector);
+ mapper.Class<MyClass>(map => map.Id(x => x.EntityIdentificator));
+
+ var inspector = (IModelInspector)autoinspector;
+ inspector.IsPersistentId(typeof(MyClass).GetProperty("EntityIdentificator")).Should().Be.True();
+ }
+
+ [Test]
+ public void WhenNotExplicitlyDeclaredMatchDefaultDelegate()
+ {
+ var autoinspector = new SimpleModelInspector();
+
+ var inspector = (IModelInspector)autoinspector;
+ inspector.IsPersistentId(typeof(TestEntity).GetProperty("Id")).Should().Be.True();
+ inspector.IsPersistentId(typeof(TestEntity).GetProperty("id")).Should().Be.True();
+ inspector.IsPersistentId(typeof(TestEntity).GetProperty("PoId")).Should().Be.True();
+ inspector.IsPersistentId(typeof(TestEntity).GetProperty("POID")).Should().Be.True();
+ inspector.IsPersistentId(typeof(TestEntity).GetProperty("OId")).Should().Be.True();
+ inspector.IsPersistentId(typeof(TestEntity).GetProperty("TestEntityId")).Should().Be.True();
+ }
+
+ [Test]
+ public void WhenNotExplicitlyDeclaredThenNoMatchPropertiesOutOfDefaultDelegate()
+ {
+ var autoinspector = new SimpleModelInspector();
+
+ var inspector = (IModelInspector)autoinspector;
+ inspector.IsPersistentId(typeof(TestEntity).GetProperty("testEntityId")).Should().Be.False();
+ inspector.IsPersistentId(typeof(TestEntity).GetProperty("Something")).Should().Be.False();
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-10 17:55:04 UTC (rev 5651)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-10 18:15:26 UTC (rev 5652)
@@ -541,6 +541,7 @@
<Compile Include="MappingByCode\MappersTests\IdBagMapperTest.cs" />
<Compile Include="MappingByCode\MappersTests\JoinMapperTests.cs" />
<Compile Include="MappingByCode\MappersTests\SubclassMapperWithJoinPropertiesTest.cs" />
+ <Compile Include="MappingByCode\MixAutomapping\PoidTests.cs" />
<Compile Include="MappingByCode\ModelExplicitDeclarationsHolderMergeTest.cs" />
<Compile Include="MappingByCode\NatureDemo\Naturalness\Address.cs" />
<Compile Include="MappingByCode\NatureDemo\Naturalness\Animal.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-10 17:55:11
|
Revision: 5651
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5651&view=rev
Author: fabiomaulo
Date: 2011-04-10 17:55:04 +0000 (Sun, 10 Apr 2011)
Log Message:
-----------
SimpleModelInspector (only as forward to explicit declaration) with minor refactoring
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/FakeModelExplicitDeclarationsHolder.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/IModelExplicitDeclarationsHolder.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/JoinCustomizer.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/ExplicitDeclarationsHolder.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/ModelExplicitDeclarationsHolderExtensions.cs
trunk/nhibernate/src/NHibernate/NHibernate.csproj
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SplitPropertiesRegistrationTests.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ModelExplicitDeclarationsHolderMergeTest.cs
Added Paths:
-----------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/SimpleModelInspector.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-10 16:38:24 UTC (rev 5650)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-10 17:55:04 UTC (rev 5651)
@@ -382,11 +382,17 @@
persistentMembers.Add(member);
}
- public void AddAsPropertySplit(System.Type propertyContainer, string splitGroupId, MemberInfo member)
+ public void AddAsPropertySplit(SplitDefinition definition)
{
+ if (definition == null)
+ {
+ return;
+ }
/* Note: if the user "jump/exclude" a class and then map the property in two subclasses the usage of GetMemberFromDeclaringType() may cause a problem
for a legal usage... we will see when the case happen */
-
+ System.Type propertyContainer = definition.On;
+ string splitGroupId = definition.GroupId;
+ MemberInfo member = definition.Member;
var memberKey = member.GetMemberFromDeclaringType();
string splitGroup;
if (!memberSplitGroup.TryGetValue(memberKey, out splitGroup))
@@ -395,7 +401,7 @@
memberSplitGroup[memberKey] = splitGroupId;
}
- splitDefinitions.Add(new SplitDefinition(propertyContainer, splitGroup, member));
+ splitDefinitions.Add(definition);
}
private void AddTypeSplits(System.Type propertyContainer, string splitGroupId)
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/FakeModelExplicitDeclarationsHolder.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/FakeModelExplicitDeclarationsHolder.cs 2011-04-10 16:38:24 UTC (rev 5650)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/FakeModelExplicitDeclarationsHolder.cs 2011-04-10 17:55:04 UTC (rev 5651)
@@ -200,9 +200,8 @@
public void AddAsProperty(MemberInfo member) {}
public void AddAsPersistentMember(MemberInfo member){}
+ public void AddAsPropertySplit(SplitDefinition definition) {}
- public void AddAsPropertySplit(System.Type propertyContainer, string splitGroupId, MemberInfo member) {}
-
#endregion
}
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/IModelExplicitDeclarationsHolder.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/IModelExplicitDeclarationsHolder.cs 2011-04-10 16:38:24 UTC (rev 5650)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/IModelExplicitDeclarationsHolder.cs 2011-04-10 17:55:04 UTC (rev 5651)
@@ -72,6 +72,6 @@
void AddAsMap(MemberInfo member);
void AddAsProperty(MemberInfo member);
void AddAsPersistentMember(MemberInfo member);
- void AddAsPropertySplit(System.Type propertyContainer, string splitGroupId, MemberInfo member);
+ void AddAsPropertySplit(SplitDefinition definition);
}
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/JoinCustomizer.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/JoinCustomizer.cs 2011-04-10 16:38:24 UTC (rev 5650)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/JoinCustomizer.cs 2011-04-10 17:55:04 UTC (rev 5651)
@@ -85,90 +85,90 @@
public override void Set<TElement>(Expression<Func<TEntity, IEnumerable<TElement>>> property, Action<ISetPropertiesMapper<TEntity, TElement>> collectionMapping, Action<ICollectionElementRelation<TElement>> mapping)
{
MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property);
- ExplicitDeclarationsHolder.AddAsPropertySplit(typeof (TEntity), splitGroupId, member);
+ ExplicitDeclarationsHolder.AddAsPropertySplit(new SplitDefinition(typeof (TEntity), splitGroupId, member));
base.Set(property, collectionMapping, mapping);
}
public override void Bag<TElement>(Expression<Func<TEntity, IEnumerable<TElement>>> property, Action<IBagPropertiesMapper<TEntity, TElement>> collectionMapping, Action<ICollectionElementRelation<TElement>> mapping)
{
MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property);
- ExplicitDeclarationsHolder.AddAsPropertySplit(typeof (TEntity), splitGroupId, member);
+ ExplicitDeclarationsHolder.AddAsPropertySplit(new SplitDefinition(typeof(TEntity), splitGroupId, member));
base.Bag(property, collectionMapping, mapping);
}
public override void List<TElement>(Expression<Func<TEntity, IEnumerable<TElement>>> property, Action<IListPropertiesMapper<TEntity, TElement>> collectionMapping, Action<ICollectionElementRelation<TElement>> mapping)
{
MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property);
- ExplicitDeclarationsHolder.AddAsPropertySplit(typeof (TEntity), splitGroupId, member);
+ ExplicitDeclarationsHolder.AddAsPropertySplit(new SplitDefinition(typeof(TEntity), splitGroupId, member));
base.List(property, collectionMapping, mapping);
}
public override void Map<TKey, TElement>(Expression<Func<TEntity, IDictionary<TKey, TElement>>> property, Action<IMapPropertiesMapper<TEntity, TKey, TElement>> collectionMapping, Action<IMapKeyRelation<TKey>> keyMapping, Action<ICollectionElementRelation<TElement>> mapping)
{
MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property);
- ExplicitDeclarationsHolder.AddAsPropertySplit(typeof (TEntity), splitGroupId, member);
+ ExplicitDeclarationsHolder.AddAsPropertySplit(new SplitDefinition(typeof(TEntity), splitGroupId, member));
base.Map(property, collectionMapping, keyMapping, mapping);
}
public override void Map<TKey, TElement>(Expression<Func<TEntity, IDictionary<TKey, TElement>>> property, Action<IMapPropertiesMapper<TEntity, TKey, TElement>> collectionMapping, Action<ICollectionElementRelation<TElement>> mapping)
{
MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property);
- ExplicitDeclarationsHolder.AddAsPropertySplit(typeof (TEntity), splitGroupId, member);
+ ExplicitDeclarationsHolder.AddAsPropertySplit(new SplitDefinition(typeof(TEntity), splitGroupId, member));
base.Map(property, collectionMapping, mapping);
}
public override void Property<TProperty>(Expression<Func<TEntity, TProperty>> property)
{
MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property);
- ExplicitDeclarationsHolder.AddAsPropertySplit(typeof (TEntity), splitGroupId, member);
+ ExplicitDeclarationsHolder.AddAsPropertySplit(new SplitDefinition(typeof(TEntity), splitGroupId, member));
base.Property(property);
}
public override void Property<TProperty>(Expression<Func<TEntity, TProperty>> property, Action<IPropertyMapper> mapping)
{
MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property);
- ExplicitDeclarationsHolder.AddAsPropertySplit(typeof (TEntity), splitGroupId, member);
+ ExplicitDeclarationsHolder.AddAsPropertySplit(new SplitDefinition(typeof(TEntity), splitGroupId, member));
base.Property(property, mapping);
}
public override void Property(FieldInfo member, Action<IPropertyMapper> mapping)
{
- ExplicitDeclarationsHolder.AddAsPropertySplit(typeof (TEntity), splitGroupId, member);
+ ExplicitDeclarationsHolder.AddAsPropertySplit(new SplitDefinition(typeof(TEntity), splitGroupId, member));
base.Property(member, mapping);
}
public override void Component<TComponent>(Expression<Func<TEntity, TComponent>> property, Action<IComponentMapper<TComponent>> mapping)
{
MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property);
- ExplicitDeclarationsHolder.AddAsPropertySplit(typeof (TEntity), splitGroupId, member);
+ ExplicitDeclarationsHolder.AddAsPropertySplit(new SplitDefinition(typeof(TEntity), splitGroupId, member));
base.Component(property, mapping);
}
public override void ManyToOne<TProperty>(Expression<Func<TEntity, TProperty>> property, Action<IManyToOneMapper> mapping)
{
MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property);
- ExplicitDeclarationsHolder.AddAsPropertySplit(typeof (TEntity), splitGroupId, member);
+ ExplicitDeclarationsHolder.AddAsPropertySplit(new SplitDefinition(typeof(TEntity), splitGroupId, member));
base.ManyToOne(property, mapping);
}
public override void ManyToOne<TProperty>(Expression<Func<TEntity, TProperty>> property)
{
MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property);
- ExplicitDeclarationsHolder.AddAsPropertySplit(typeof (TEntity), splitGroupId, member);
+ ExplicitDeclarationsHolder.AddAsPropertySplit(new SplitDefinition(typeof(TEntity), splitGroupId, member));
base.ManyToOne(property);
}
public override void Any<TProperty>(Expression<Func<TEntity, TProperty>> property, System.Type idTypeOfMetaType, Action<IAnyMapper> mapping)
{
MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property);
- ExplicitDeclarationsHolder.AddAsPropertySplit(typeof (TEntity), splitGroupId, member);
+ ExplicitDeclarationsHolder.AddAsPropertySplit(new SplitDefinition(typeof(TEntity), splitGroupId, member));
base.Any(property, idTypeOfMetaType, mapping);
}
public override void IdBag<TElement>(Expression<Func<TEntity, IEnumerable<TElement>>> property, Action<IIdBagPropertiesMapper<TEntity, TElement>> collectionMapping, Action<ICollectionElementRelation<TElement>> mapping)
{
MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property);
- ExplicitDeclarationsHolder.AddAsPropertySplit(typeof(TEntity), splitGroupId, member);
+ ExplicitDeclarationsHolder.AddAsPropertySplit(new SplitDefinition(typeof(TEntity), splitGroupId, member));
base.IdBag(property, collectionMapping, mapping);
}
}
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/ExplicitDeclarationsHolder.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/ExplicitDeclarationsHolder.cs 2011-04-10 16:38:24 UTC (rev 5650)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/ExplicitDeclarationsHolder.cs 2011-04-10 17:55:04 UTC (rev 5651)
@@ -257,9 +257,9 @@
persistentMembers.Add(member);
}
- public void AddAsPropertySplit(System.Type propertyContainer, string splitGroupId, MemberInfo member)
+ public void AddAsPropertySplit(SplitDefinition definition)
{
- splitDefinitions.Add(new SplitDefinition(propertyContainer, splitGroupId, member));
+ splitDefinitions.Add(definition);
}
#endregion
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/ModelExplicitDeclarationsHolderExtensions.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/ModelExplicitDeclarationsHolderExtensions.cs 2011-04-10 16:38:24 UTC (rev 5650)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/ModelExplicitDeclarationsHolderExtensions.cs 2011-04-10 17:55:04 UTC (rev 5651)
@@ -35,7 +35,7 @@
System.Array.ForEach(source.Dictionaries.ToArray(), destination.AddAsMap);
System.Array.ForEach(source.Properties.ToArray(), destination.AddAsProperty);
System.Array.ForEach(source.PersistentMembers.ToArray(), destination.AddAsPersistentMember);
- System.Array.ForEach(source.SplitDefinitions.ToArray(), x => destination.AddAsPropertySplit(x.On, x.GroupId, x.Member));
+ System.Array.ForEach(source.SplitDefinitions.ToArray(), destination.AddAsPropertySplit);
}
}
}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate/Mapping/ByCode/SimpleModelInspector.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/SimpleModelInspector.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/SimpleModelInspector.cs 2011-04-10 17:55:04 UTC (rev 5651)
@@ -0,0 +1,640 @@
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+
+namespace NHibernate.Mapping.ByCode
+{
+ /// <summary>
+ /// A <see cref="IModelInspector"/> which allows customization of conditions with explicitly declared members.
+ /// </summary>
+ public class SimpleModelInspector : IModelInspector, IModelExplicitDeclarationsHolder
+ {
+ private readonly ExplicitlyDeclaredModel declaredModel = new ExplicitlyDeclaredModel();
+
+ private Func<System.Type, bool, bool> isEntity = (t, declared) => declared;
+ private Func<System.Type, bool, bool> isRootEntity = (t, declared) => declared;
+ private Func<System.Type, bool, bool> isTablePerClass = (t, declared) => declared;
+ private Func<SplitDefinition, bool, bool> isTablePerClassSplit = (sd, declared) => declared;
+ private Func<System.Type, bool, bool> isTablePerClassHierarchy = (t, declared) => declared;
+ private Func<System.Type, bool, bool> isTablePerConcreteClass = (t, declared) => declared;
+ private Func<System.Type, IEnumerable<string>, IEnumerable<string>> splitsForType = (t, declared) => declared;
+ private Func<System.Type, bool, bool> isComponent = (t, declared) => declared;
+
+ private Func<MemberInfo, bool, bool> isPersistentId = (m, declared) => declared;
+ private Func<MemberInfo, bool, bool> isPersistentProperty = (m, declared) => declared;
+ private Func<MemberInfo, bool, bool> isVersion = (m, declared) => declared;
+
+ private Func<MemberInfo, bool, bool> isProperty = (m, declared) => declared;
+ private Func<MemberInfo, bool, bool> isAny = (m, declared) => declared;
+ private Func<MemberInfo, bool, bool> isManyToMany = (m, declared) => declared;
+ private Func<MemberInfo, bool, bool> isManyToOne = (m, declared) => declared;
+ private Func<MemberInfo, bool, bool> isMemberOfNaturalId = (m, declared) => declared;
+ private Func<MemberInfo, bool, bool> isOneToMany = (m, declared) => declared;
+ private Func<MemberInfo, bool, bool> isOneToOne = (m, declared) => declared;
+
+ private Func<MemberInfo, bool, bool> isSet = (m, declared) => declared;
+ private Func<MemberInfo, bool, bool> isArray = (m, declared) => declared;
+ private Func<MemberInfo, bool, bool> isBag = (m, declared) => declared;
+ private Func<MemberInfo, bool, bool> isDictionary = (m, declared) => declared;
+ private Func<MemberInfo, bool, bool> isIdBag = (m, declared) => declared;
+ private Func<MemberInfo, bool, bool> isList = (m, declared) => declared;
+
+ #region IModelExplicitDeclarationsHolder Members
+
+ IEnumerable<System.Type> IModelExplicitDeclarationsHolder.RootEntities
+ {
+ get { return declaredModel.RootEntities; }
+ }
+
+ IEnumerable<System.Type> IModelExplicitDeclarationsHolder.Components
+ {
+ get { return declaredModel.Components; }
+ }
+
+ IEnumerable<System.Type> IModelExplicitDeclarationsHolder.TablePerClassEntities
+ {
+ get { return declaredModel.TablePerClassEntities; }
+ }
+
+ IEnumerable<System.Type> IModelExplicitDeclarationsHolder.TablePerClassHierarchyEntities
+ {
+ get { return declaredModel.TablePerClassHierarchyEntities; }
+ }
+
+ IEnumerable<System.Type> IModelExplicitDeclarationsHolder.TablePerConcreteClassEntities
+ {
+ get { return declaredModel.TablePerConcreteClassEntities; }
+ }
+
+ IEnumerable<MemberInfo> IModelExplicitDeclarationsHolder.OneToOneRelations
+ {
+ get { return declaredModel.OneToOneRelations; }
+ }
+
+ IEnumerable<MemberInfo> IModelExplicitDeclarationsHolder.ManyToOneRelations
+ {
+ get { return declaredModel.ManyToManyRelations; }
+ }
+
+ IEnumerable<MemberInfo> IModelExplicitDeclarationsHolder.ManyToManyRelations
+ {
+ get { return declaredModel.ManyToManyRelations; }
+ }
+
+ IEnumerable<MemberInfo> IModelExplicitDeclarationsHolder.OneToManyRelations
+ {
+ get { return declaredModel.OneToManyRelations; }
+ }
+
+ IEnumerable<MemberInfo> IModelExplicitDeclarationsHolder.Any
+ {
+ get { return declaredModel.Any; }
+ }
+
+ IEnumerable<MemberInfo> IModelExplicitDeclarationsHolder.Poids
+ {
+ get { return declaredModel.Poids; }
+ }
+
+ IEnumerable<MemberInfo> IModelExplicitDeclarationsHolder.VersionProperties
+ {
+ get { return declaredModel.VersionProperties; }
+ }
+
+ IEnumerable<MemberInfo> IModelExplicitDeclarationsHolder.NaturalIds
+ {
+ get { return declaredModel.NaturalIds; }
+ }
+
+ IEnumerable<MemberInfo> IModelExplicitDeclarationsHolder.Sets
+ {
+ get { return declaredModel.Sets; }
+ }
+
+ IEnumerable<MemberInfo> IModelExplicitDeclarationsHolder.Bags
+ {
+ get { return declaredModel.Bags; }
+ }
+
+ IEnumerable<MemberInfo> IModelExplicitDeclarationsHolder.IdBags
+ {
+ get { return declaredModel.IdBags; }
+ }
+
+ IEnumerable<MemberInfo> IModelExplicitDeclarationsHolder.Lists
+ {
+ get { return declaredModel.Lists; }
+ }
+
+ IEnumerable<MemberInfo> IModelExplicitDeclarationsHolder.Arrays
+ {
+ get { return declaredModel.Arrays; }
+ }
+
+ IEnumerable<MemberInfo> IModelExplicitDeclarationsHolder.Dictionaries
+ {
+ get { return declaredModel.Dictionaries; }
+ }
+
+ IEnumerable<MemberInfo> IModelExplicitDeclarationsHolder.Properties
+ {
+ get { return declaredModel.Properties; }
+ }
+
+ IEnumerable<MemberInfo> IModelExplicitDeclarationsHolder.PersistentMembers
+ {
+ get { return declaredModel.PersistentMembers; }
+ }
+
+ IEnumerable<SplitDefinition> IModelExplicitDeclarationsHolder.SplitDefinitions
+ {
+ get { return declaredModel.SplitDefinitions; }
+ }
+
+ IEnumerable<string> IModelExplicitDeclarationsHolder.GetSplitGroupsFor(System.Type type)
+ {
+ return declaredModel.GetSplitGroupsFor(type);
+ }
+
+ string IModelExplicitDeclarationsHolder.GetSplitGroupFor(MemberInfo member)
+ {
+ return declaredModel.GetSplitGroupFor(member);
+ }
+
+ void IModelExplicitDeclarationsHolder.AddAsRootEntity(System.Type type)
+ {
+ declaredModel.AddAsRootEntity(type);
+ }
+
+ void IModelExplicitDeclarationsHolder.AddAsComponent(System.Type type)
+ {
+ declaredModel.AddAsComponent(type);
+ }
+
+ void IModelExplicitDeclarationsHolder.AddAsTablePerClassEntity(System.Type type)
+ {
+ declaredModel.AddAsTablePerClassEntity(type);
+ }
+
+ void IModelExplicitDeclarationsHolder.AddAsTablePerClassHierarchyEntity(System.Type type)
+ {
+ declaredModel.AddAsTablePerClassHierarchyEntity(type);
+ }
+
+ void IModelExplicitDeclarationsHolder.AddAsTablePerConcreteClassEntity(System.Type type)
+ {
+ declaredModel.AddAsTablePerConcreteClassEntity(type);
+ }
+
+ void IModelExplicitDeclarationsHolder.AddAsOneToOneRelation(MemberInfo member)
+ {
+ declaredModel.AddAsOneToOneRelation(member);
+ }
+
+ void IModelExplicitDeclarationsHolder.AddAsManyToOneRelation(MemberInfo member)
+ {
+ declaredModel.AddAsManyToOneRelation(member);
+ }
+
+ void IModelExplicitDeclarationsHolder.AddAsManyToManyRelation(MemberInfo member)
+ {
+ declaredModel.AddAsManyToManyRelation(member);
+ }
+
+ void IModelExplicitDeclarationsHolder.AddAsOneToManyRelation(MemberInfo member)
+ {
+ declaredModel.AddAsOneToManyRelation(member);
+ }
+
+ void IModelExplicitDeclarationsHolder.AddAsAny(MemberInfo member)
+ {
+ declaredModel.AddAsAny(member);
+ }
+
+ void IModelExplicitDeclarationsHolder.AddAsPoid(MemberInfo member)
+ {
+ declaredModel.AddAsPoid(member);
+ }
+
+ void IModelExplicitDeclarationsHolder.AddAsVersionProperty(MemberInfo member)
+ {
+ declaredModel.AddAsVersionProperty(member);
+ }
+
+ void IModelExplicitDeclarationsHolder.AddAsNaturalId(MemberInfo member)
+ {
+ declaredModel.AddAsNaturalId(member);
+ }
+
+ void IModelExplicitDeclarationsHolder.AddAsSet(MemberInfo member)
+ {
+ declaredModel.AddAsSet(member);
+ }
+
+ void IModelExplicitDeclarationsHolder.AddAsBag(MemberInfo member)
+ {
+ declaredModel.AddAsBag(member);
+ }
+
+ void IModelExplicitDeclarationsHolder.AddAsIdBag(MemberInfo member)
+ {
+ declaredModel.AddAsIdBag(member);
+ }
+
+ void IModelExplicitDeclarationsHolder.AddAsList(MemberInfo member)
+ {
+ declaredModel.AddAsList(member);
+ }
+
+ void IModelExplicitDeclarationsHolder.AddAsArray(MemberInfo member)
+ {
+ declaredModel.AddAsArray(member);
+ }
+
+ void IModelExplicitDeclarationsHolder.AddAsMap(MemberInfo member)
+ {
+ declaredModel.AddAsMap(member);
+ }
+
+ void IModelExplicitDeclarationsHolder.AddAsProperty(MemberInfo member)
+ {
+ declaredModel.AddAsProperty(member);
+ }
+
+ void IModelExplicitDeclarationsHolder.AddAsPersistentMember(MemberInfo member)
+ {
+ declaredModel.AddAsPersistentMember(member);
+ }
+
+ void IModelExplicitDeclarationsHolder.AddAsPropertySplit(SplitDefinition definition)
+ {
+ declaredModel.AddAsPropertySplit(definition);
+ }
+
+ #endregion
+
+ #region Implementation of IModelInspector
+
+ bool IModelInspector.IsRootEntity(System.Type type)
+ {
+ bool declaredResult = declaredModel.IsRootEntity(type);
+ return isRootEntity(type, declaredResult);
+ }
+
+ bool IModelInspector.IsComponent(System.Type type)
+ {
+ bool declaredResult = declaredModel.IsComponent(type);
+ return isComponent(type, declaredResult);
+ }
+
+ bool IModelInspector.IsEntity(System.Type type)
+ {
+ bool declaredResult = declaredModel.IsEntity(type);
+ return isEntity(type, declaredResult);
+ }
+
+ bool IModelInspector.IsTablePerClass(System.Type type)
+ {
+ bool declaredResult = declaredModel.IsTablePerClass(type);
+ return isTablePerClass(type, declaredResult);
+ }
+
+ bool IModelInspector.IsTablePerClassSplit(System.Type type, object splitGroupId, MemberInfo member)
+ {
+ bool declaredResult = declaredModel.IsTablePerClassSplit(type, splitGroupId, member);
+ return isTablePerClassSplit(new SplitDefinition(type, splitGroupId.ToString(), member), declaredResult);
+ }
+
+ bool IModelInspector.IsTablePerClassHierarchy(System.Type type)
+ {
+ bool declaredResult = declaredModel.IsTablePerClassHierarchy(type);
+ return isTablePerClassHierarchy(type, declaredResult);
+ }
+
+ bool IModelInspector.IsTablePerConcreteClass(System.Type type)
+ {
+ bool declaredResult = declaredModel.IsTablePerConcreteClass(type);
+ return isTablePerConcreteClass(type, declaredResult);
+ }
+
+ bool IModelInspector.IsOneToOne(MemberInfo member)
+ {
+ bool declaredResult = declaredModel.IsOneToOne(member);
+ return isOneToOne(member, declaredResult);
+ }
+
+ bool IModelInspector.IsManyToOne(MemberInfo member)
+ {
+ bool declaredResult = declaredModel.IsManyToOne(member);
+ return isManyToOne(member, declaredResult);
+ }
+
+ bool IModelInspector.IsManyToMany(MemberInfo member)
+ {
+ bool declaredResult = declaredModel.IsManyToMany(member);
+ return isManyToMany(member, declaredResult);
+ }
+
+ bool IModelInspector.IsOneToMany(MemberInfo member)
+ {
+ bool declaredResult = declaredModel.IsOneToMany(member);
+ return isOneToMany(member, declaredResult);
+ }
+
+ bool IModelInspector.IsAny(MemberInfo member)
+ {
+ bool declaredResult = declaredModel.IsAny(member);
+ return isAny(member, declaredResult);
+ }
+
+ bool IModelInspector.IsPersistentId(MemberInfo member)
+ {
+ bool declaredResult = declaredModel.IsPersistentId(member);
+ return isPersistentId(member, declaredResult);
+ }
+
+ bool IModelInspector.IsVersion(MemberInfo member)
+ {
+ bool declaredResult = declaredModel.IsVersion(member);
+ return isVersion(member, declaredResult);
+ }
+
+ bool IModelInspector.IsMemberOfNaturalId(MemberInfo member)
+ {
+ bool declaredResult = declaredModel.IsMemberOfNaturalId(member);
+ return isMemberOfNaturalId(member, declaredResult);
+ }
+
+ bool IModelInspector.IsPersistentProperty(MemberInfo member)
+ {
+ bool declaredResult = declaredModel.IsPersistentProperty(member);
+ return isPersistentProperty(member, declaredResult);
+ }
+
+ bool IModelInspector.IsSet(MemberInfo role)
+ {
+ bool declaredResult = declaredModel.IsSet(role);
+ return isSet(role, declaredResult);
+ }
+
+ bool IModelInspector.IsBag(MemberInfo role)
+ {
+ bool declaredResult = declaredModel.IsBag(role);
+ return isBag(role, declaredResult);
+ }
+
+ bool IModelInspector.IsIdBag(MemberInfo role)
+ {
+ bool declaredResult = declaredModel.IsIdBag(role);
+ return isIdBag(role, declaredResult);
+ }
+
+ bool IModelInspector.IsList(MemberInfo role)
+ {
+ bool declaredResult = declaredModel.IsList(role);
+ return isList(role, declaredResult);
+ }
+
+ bool IModelInspector.IsArray(MemberInfo role)
+ {
+ bool declaredResult = declaredModel.IsArray(role);
+ return isArray(role, declaredResult);
+ }
+
+ bool IModelInspector.IsDictionary(MemberInfo role)
+ {
+ bool declaredResult = declaredModel.IsDictionary(role);
+ return isDictionary(role, declaredResult);
+ }
+
+ bool IModelInspector.IsProperty(MemberInfo member)
+ {
+ bool declaredResult = declaredModel.IsProperty(member);
+ return isProperty(member, declaredResult);
+ }
+
+ IEnumerable<string> IModelInspector.GetPropertiesSplits(System.Type type)
+ {
+ IEnumerable<string> declaredResult = declaredModel.GetPropertiesSplits(type);
+ return splitsForType(type, declaredResult);
+ }
+
+ #endregion
+
+ public void IsRootEntity(Func<System.Type, bool, bool> match)
+ {
+ if (match == null)
+ {
+ return;
+ }
+ isRootEntity = match;
+ }
+
+ public void IsComponent(Func<System.Type, bool, bool> match)
+ {
+ if (match == null)
+ {
+ return;
+ }
+ isComponent = match;
+ }
+
+ public void IsEntity(Func<System.Type, bool, bool> match)
+ {
+ if (match == null)
+ {
+ return;
+ }
+ isEntity = match;
+ }
+
+ public void IsTablePerClass(Func<System.Type, bool, bool> match)
+ {
+ if (match == null)
+ {
+ return;
+ }
+ isTablePerClass = match;
+ }
+
+ public void IsTablePerClassHierarchy(Func<System.Type, bool, bool> match)
+ {
+ if (match == null)
+ {
+ return;
+ }
+ isTablePerClassHierarchy = match;
+ }
+
+ public void IsTablePerConcreteClass(Func<System.Type, bool, bool> match)
+ {
+ if (match == null)
+ {
+ return;
+ }
+ isTablePerConcreteClass = match;
+ }
+
+ public void IsOneToOne(Func<MemberInfo, bool, bool> match)
+ {
+ if (match == null)
+ {
+ return;
+ }
+ isOneToOne = match;
+ }
+
+ public void IsManyToOne(Func<MemberInfo, bool, bool> match)
+ {
+ if (match == null)
+ {
+ return;
+ }
+ isManyToOne = match;
+ }
+
+ public void IsManyToMany(Func<MemberInfo, bool, bool> match)
+ {
+ if (match == null)
+ {
+ return;
+ }
+ isManyToMany = match;
+ }
+
+ public void IsOneToMany(Func<MemberInfo, bool, bool> match)
+ {
+ if (match == null)
+ {
+ return;
+ }
+ isOneToMany = match;
+ }
+
+ public void IsAny(Func<MemberInfo, bool, bool> match)
+ {
+ if (match == null)
+ {
+ return;
+ }
+ isAny = match;
+ }
+
+ public void IsPersistentId(Func<MemberInfo, bool, bool> match)
+ {
+ if (match == null)
+ {
+ return;
+ }
+ isPersistentId = match;
+ }
+
+ public void IsVersion(Func<MemberInfo, bool, bool> match)
+ {
+ if (match == null)
+ {
+ return;
+ }
+ isVersion = match;
+ }
+
+ public void IsMemberOfNaturalId(Func<MemberInfo, bool, bool> match)
+ {
+ if (match == null)
+ {
+ return;
+ }
+ isMemberOfNaturalId = match;
+ }
+
+ public void IsPersistentProperty(Func<MemberInfo, bool, bool> match)
+ {
+ if (match == null)
+ {
+ return;
+ }
+ isPersistentProperty = match;
+ }
+
+ public void IsSet(Func<MemberInfo, bool, bool> match)
+ {
+ if (match == null)
+ {
+ return;
+ }
+ isSet = match;
+ }
+
+ public void IsBag(Func<MemberInfo, bool, bool> match)
+ {
+ if (match == null)
+ {
+ return;
+ }
+ isBag = match;
+ }
+
+ public void IsIdBag(Func<MemberInfo, bool, bool> match)
+ {
+ if (match == null)
+ {
+ return;
+ }
+ isIdBag = match;
+ }
+
+ public void IsList(Func<MemberInfo, bool, bool> match)
+ {
+ if (match == null)
+ {
+ return;
+ }
+ isList = match;
+ }
+
+ public void IsArray(Func<MemberInfo, bool, bool> match)
+ {
+ if (match == null)
+ {
+ return;
+ }
+ isArray = match;
+ }
+
+ public void IsDictionary(Func<MemberInfo, bool, bool> match)
+ {
+ if (match == null)
+ {
+ return;
+ }
+ isDictionary = match;
+ }
+
+ public void IsProperty(Func<MemberInfo, bool, bool> match)
+ {
+ if (match == null)
+ {
+ return;
+ }
+ isProperty = match;
+ }
+
+ public void SplitsFor(Func<System.Type, IEnumerable<string>, IEnumerable<string>> getPropertiesSplitsId)
+ {
+ if (getPropertiesSplitsId == null)
+ {
+ return;
+ }
+ splitsForType = getPropertiesSplitsId;
+ }
+
+ public void IsTablePerClassSplit(Func<SplitDefinition, bool, bool> match)
+ {
+ if (match == null)
+ {
+ return;
+ }
+ isTablePerClassSplit = match;
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-04-10 16:38:24 UTC (rev 5650)
+++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-04-10 17:55:04 UTC (rev 5651)
@@ -290,6 +290,7 @@
<Compile Include="Mapping\ByCode\Conformist\JoinedSubclassMapping.cs" />
<Compile Include="Mapping\ByCode\Conformist\SubclassMapping.cs" />
<Compile Include="Mapping\ByCode\Conformist\UnionSubclassMapping.cs" />
+ <Compile Include="Mapping\ByCode\SimpleModelInspector.cs" />
<Compile Include="Mapping\ByCode\ExplicitlyDeclaredModel.cs" />
<Compile Include="Mapping\ByCode\FakeModelExplicitDeclarationsHolder.cs" />
<Compile Include="Mapping\ByCode\FetchKind.cs" />
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SplitPropertiesRegistrationTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SplitPropertiesRegistrationTests.cs 2011-04-10 16:38:24 UTC (rev 5650)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SplitPropertiesRegistrationTests.cs 2011-04-10 17:55:04 UTC (rev 5651)
@@ -20,8 +20,8 @@
public void WhenRegisterPropertySplitsThenTypeHasSplitGroups()
{
var inspector = new ExplicitlyDeclaredModel();
- inspector.AddAsPropertySplit(typeof(MyClass), "group", For<MyClass>.Property(x => x.Something));
- inspector.AddAsPropertySplit(typeof(Inherited), "group1", For<Inherited>.Property(x => x.SomethingElse));
+ inspector.AddAsPropertySplit(new SplitDefinition(typeof(MyClass), "group", For<MyClass>.Property(x => x.Something)));
+ inspector.AddAsPropertySplit(new SplitDefinition(typeof(Inherited), "group1", For<Inherited>.Property(x => x.SomethingElse)));
inspector.GetSplitGroupsFor(typeof(MyClass)).Should().Have.SameValuesAs("group");
inspector.GetSplitGroupsFor(typeof(Inherited)).Should().Have.SameValuesAs("group1");
@@ -34,8 +34,8 @@
var memberFromDeclaringType = For<MyClass>.Property(x=> x.Something);
var memberFromReferencedType = typeof(Inherited).GetProperty("Something");
- inspector.AddAsPropertySplit(typeof(MyClass), "group", memberFromDeclaringType);
- inspector.AddAsPropertySplit(typeof(Inherited), "group1", memberFromReferencedType);
+ inspector.AddAsPropertySplit(new SplitDefinition(typeof(MyClass), "group", memberFromDeclaringType));
+ inspector.AddAsPropertySplit(new SplitDefinition(typeof(Inherited), "group1", memberFromReferencedType));
inspector.GetSplitGroupsFor(typeof(MyClass)).Should().Have.SameValuesAs("group");
inspector.GetSplitGroupsFor(typeof(Inherited)).Should().Be.Empty();
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ModelExplicitDeclarationsHolderMergeTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ModelExplicitDeclarationsHolderMergeTest.cs 2011-04-10 16:38:24 UTC (rev 5650)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ModelExplicitDeclarationsHolderMergeTest.cs 2011-04-10 17:55:04 UTC (rev 5651)
@@ -22,7 +22,7 @@
{
var destination = new ExplicitDeclarationsHolder();
var source = new ExplicitDeclarationsHolder();
- source.AddAsPropertySplit(typeof (MyClass), "foo", property);
+ source.AddAsPropertySplit(new SplitDefinition(typeof (MyClass), "foo", property));
destination.Merge(source);
destination.SplitDefinitions.Should().Have.Count.EqualTo(1);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jul...@us...> - 2011-04-10 16:38:32
|
Revision: 5650
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5650&view=rev
Author: julian-maughan
Date: 2011-04-10 16:38:24 +0000 (Sun, 10 Apr 2011)
Log Message:
-----------
Deprecated badly-named Sybase ASA/SQLAnywhere drivers. Updated dialects to use non-deprecated drivers.
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Dialect/SybaseASA9Dialect.cs
trunk/nhibernate/src/NHibernate/Dialect/SybaseSQLAnywhere10Dialect.cs
trunk/nhibernate/src/NHibernate/Dialect/SybaseSQLAnywhere11Dialect.cs
trunk/nhibernate/src/NHibernate/Driver/ASA10ClientDriver.cs
trunk/nhibernate/src/NHibernate/Driver/ASAClientDriver.cs
trunk/nhibernate/src/NHibernate/NHibernate.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate/Driver/SybaseAsaClientDriver.cs
trunk/nhibernate/src/NHibernate/Driver/SybaseSQLAnywhereDriver.cs
Modified: trunk/nhibernate/src/NHibernate/Dialect/SybaseASA9Dialect.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Dialect/SybaseASA9Dialect.cs 2011-04-10 16:12:26 UTC (rev 5649)
+++ trunk/nhibernate/src/NHibernate/Dialect/SybaseASA9Dialect.cs 2011-04-10 16:38:24 UTC (rev 5650)
@@ -24,7 +24,7 @@
/// </listheader>
/// <item>
/// <term>connection.driver_class</term>
- /// <description><see cref="NHibernate.Driver.ASAClientDriver" /></description>
+ /// <description><see cref="NHibernate.Driver.SybaseAsaClientDriver" /></description>
/// </item>
/// <item>
/// <term>prepare_sql</term>
@@ -36,7 +36,7 @@
{
public SybaseASA9Dialect()
{
- DefaultProperties[Environment.ConnectionDriver] = "NHibernate.Driver.ASAClientDriver";
+ DefaultProperties[Environment.ConnectionDriver] = "NHibernate.Driver.SybaseAsaClientDriver";
DefaultProperties[Environment.PrepareSql] = "false";
RegisterColumnType(DbType.AnsiStringFixedLength, 255, "CHAR($l)");
@@ -77,7 +77,6 @@
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");
@@ -96,7 +95,7 @@
public override SqlString GetLimitString(SqlString querySqlString, int offset, int limit)
{
int intSelectInsertPoint = GetAfterSelectInsertPoint(querySqlString);
- string strLimit = string.Format(" TOP {0} START AT {1}", limit, offset + 1);
+ string strLimit = string.Format(" top {0} start at {1}", limit, offset + 1);
return querySqlString.Insert(intSelectInsertPoint, strLimit);
}
@@ -135,16 +134,14 @@
get { return "select @@identity"; }
}
- /// <summary></summary>
public override string IdentityColumnString
{
- get { return "IDENTITY NOT NULL"; }
+ get { return "identity not null"; }
}
- /// <summary></summary>
public override string NoColumnsInsertString
{
- get { return "DEFAULT VALUES"; }
+ get { return "default values"; }
}
/// <summary>
Modified: trunk/nhibernate/src/NHibernate/Dialect/SybaseSQLAnywhere10Dialect.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Dialect/SybaseSQLAnywhere10Dialect.cs 2011-04-10 16:12:26 UTC (rev 5649)
+++ trunk/nhibernate/src/NHibernate/Dialect/SybaseSQLAnywhere10Dialect.cs 2011-04-10 16:38:24 UTC (rev 5650)
@@ -38,30 +38,29 @@
/// 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 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.ASA10ClientDriver" /></description>
- /// </item>
- /// <item>
- /// <term>prepare_sql</term>
- /// <description><see langword="false" /></description>
- /// </item>
+ /// <listheader>
+ /// <term>Property</term>
+ /// <description>Default Value</description>
+ /// </listheader>
+ /// <item>
+ /// <term>connection.driver_class</term>
+ /// <description><see cref="NHibernate.Driver.SybaseSQLAnywhereDriver" /></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.ConnectionDriver] = "NHibernate.Driver.SybaseSQLAnywhereDriver";
DefaultProperties[Environment.PrepareSql] = "false";
RegisterCharacterTypeMappings();
@@ -72,298 +71,298 @@
RegisterKeywords();
}
- protected void RegisterCharacterTypeMappings()
+ protected virtual 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");
+ 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()
+ protected virtual 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
+ 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()
+ protected virtual void RegisterDateTimeTypeMappings()
{
- RegisterColumnType( DbType.Date, "DATE" );
- RegisterColumnType( DbType.Time, "TIME" );
- RegisterColumnType( DbType.DateTime, "TIMESTAMP" );
+ RegisterColumnType(DbType.Date, "DATE");
+ RegisterColumnType(DbType.Time, "TIME");
+ RegisterColumnType(DbType.DateTime, "TIMESTAMP");
}
- protected void RegisterReverseNHibernateTypeMappings() {}
+ protected virtual void RegisterReverseNHibernateTypeMappings() {}
- protected void RegisterFunctions()
+ protected virtual void RegisterFunctions()
{
RegisterMathFunctions();
- RegisterXMLFunctions();
+ RegisterXmlFunctions();
RegisterAggregationFunctions();
RegisterBitFunctions();
RegisterDateFunctions();
RegisterStringFunctions();
- RegisterSOAPFunctions();
+ RegisterSoapFunctions();
RegisterMiscellaneousFunctions();
}
- protected void RegisterMathFunctions()
+ protected virtual 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") );
+ 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()
+ protected virtual 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(", ",", ")" ) );
+ 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()
+ protected virtual 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") );
+ 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()
+ protected virtual 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(", ",", ")" ));
+ 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()
+ protected virtual 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) );
+ 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 ) );
+ 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()
+ protected virtual 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) );
+ 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("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) );
+ 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()
+ protected virtual 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(",",",")" ) );
+ 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()
+ protected virtual 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) );
+ 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()
+ protected virtual void RegisterKeywords()
{
- RegisterKeyword( "TOP" );
- RegisterKeyword( "FIRST" );
- RegisterKeyword( "FETCH" );
- RegisterKeyword( "START" );
- RegisterKeyword( "AT" );
- RegisterKeyword( "WITH" );
- RegisterKeyword( "CONTAINS" );
- RegisterKeyword( "REGEXP" );
- RegisterKeyword( "SIMILAR" );
- RegisterKeyword( "SEQUENCE" );
+ 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
@@ -375,7 +374,7 @@
public override string IdentitySelectString
{
- get { return "SELECT @@IDENTITY"; }
+ get { return "select @@identity"; }
}
/// <summary>
@@ -384,12 +383,12 @@
/// </summary>
public override string IdentityColumnString
{
- get { return "NOT NULL DEFAULT AUTOINCREMENT"; }
+ get { return "not null default autoincrement"; }
}
- public override SqlString AppendIdentitySelectToInsert( SqlString insertSql )
+ public override SqlString AppendIdentitySelectToInsert(SqlString insertSql)
{
- return insertSql.Append( "; " + IdentitySelectString );
+ return insertSql.Append("; " + IdentitySelectString);
}
public override bool SupportsInsertSelectIdentity
@@ -401,29 +400,16 @@
#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; }
@@ -446,14 +432,14 @@
get { return true; }
}
- private static int GetAfterSelectInsertPoint( SqlString sql )
+ private static int GetAfterSelectInsertPoint(SqlString sql)
{
// Assume no common table expressions with the statement.
- if ( sql.StartsWithCaseInsensitive( "SELECT DISTINCT" ) )
+ if (sql.StartsWithCaseInsensitive("select distinct"))
{
return 15;
}
- else if ( sql.StartsWithCaseInsensitive( "SELECT" ) )
+ else if (sql.StartsWithCaseInsensitive("select"))
{
return 6;
}
@@ -467,27 +453,27 @@
/// Produce a parametertized SQL query using positional parameters for
/// TOP and START AT (if specified).
/// </summary>
- public override SqlString GetLimitString( SqlString sql, bool hasOffset )
+ public override SqlString GetLimitString(SqlString sql, bool hasOffset)
{
- int InsertionPoint = GetAfterSelectInsertPoint( sql );
+ int insertionPoint = GetAfterSelectInsertPoint(sql);
- if ( InsertionPoint > 0 )
+ if (insertionPoint > 0)
{
- SqlStringBuilder LimitBuilder = new SqlStringBuilder();
- LimitBuilder.Add( "SELECT" );
- if ( InsertionPoint > 6 )
+ SqlStringBuilder limitBuilder = new SqlStringBuilder();
+ limitBuilder.Add("select");
+ if (insertionPoint > 6)
{
- LimitBuilder.Add( " DISTINCT " );
+ limitBuilder.Add(" distinct ");
}
- LimitBuilder.Add( " TOP ");
- LimitBuilder.Add( Parameter.Placeholder );
- if ( hasOffset )
+ limitBuilder.Add(" top ");
+ limitBuilder.Add(Parameter.Placeholder);
+ if (hasOffset)
{
- LimitBuilder.Add( " START AT ");
- LimitBuilder.Add( Parameter.Placeholder );
+ limitBuilder.Add(" start at ");
+ limitBuilder.Add(Parameter.Placeholder);
}
- LimitBuilder.Add( sql.Substring( InsertionPoint ) );
- return LimitBuilder.ToSqlString();
+ limitBuilder.Add(sql.Substring(insertionPoint));
+ return limitBuilder.ToSqlString();
}
else
{
@@ -502,17 +488,17 @@
/// 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)
+ public override SqlString GetLimitString(SqlString sql, int offset, int limit)
{
- if ( offset < 0 )
+ if (offset < 0)
{
throw new NotSupportedException("SQL Anywhere does not support negative offsets");
}
- if ( limit <= 0 )
+ if (limit <= 0)
{
- throw new NotSupportedException( "negative or zero TOP n (SQL limit) is not supported" );
+ throw new NotSupportedException("negative or zero TOP n (SQL limit) is not supported");
}
- return GetLimitString( sql, offset > 0 );
+ return GetLimitString(sql, offset > 0);
}
#endregion
@@ -544,27 +530,27 @@
/// 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 )
+ public override string GetForUpdateString(LockMode lockMode)
{
- if( lockMode == LockMode.Read )
+ if (lockMode == LockMode.Read)
{
return ForReadOnlyString;
}
- else if( lockMode == LockMode.Upgrade )
+ else if (lockMode == LockMode.Upgrade)
{
return ForUpdateByLockString;
}
- else if( lockMode == LockMode.UpgradeNoWait )
+ else if (lockMode == LockMode.UpgradeNoWait)
{
return ForUpdateNowaitString;
}
- else if( lockMode == LockMode.Force )
+ else if (lockMode == LockMode.Force)
{
return ForUpdateNowaitString;
}
else
{
- return string.Empty;
+ return String.Empty;
}
}
@@ -608,7 +594,7 @@
/// </summary>
public string ForReadOnlyString
{
- get { return " FOR READ ONLY"; }
+ get { return " for read only"; }
}
/// <summary>
@@ -616,7 +602,7 @@
/// </summary>
public string ForUpdateByLockString
{
- get { return " FOR UPDATE BY LOCK"; }
+ get { return " for update by lock"; }
}
/// <summary>
@@ -657,7 +643,7 @@
public override string CurrentTimestampSQLFunctionName
{
- get { return "GETDATE"; }
+ get { return "getdate"; }
}
public override bool IsCurrentTimestampSelectStringCallable
@@ -667,7 +653,7 @@
public override string CurrentTimestampSelectString
{
- get { return "SELECT GETDATE()"; }
+ get { return "select getdate()"; }
}
/// <summary>
@@ -695,9 +681,6 @@
#region Informational metadata
- /// <summary>
- /// SQL Anywhere Does not support empty IN lists.
- /// </summary>
public override bool SupportsEmptyInList
{
get { return false; }
@@ -716,10 +699,6 @@
get { return false; }
}
- /// <summary>
- /// SQL Anywhere does not support an EXISTS clause within a
- /// SELECT list.
- /// </summary>
public override bool SupportsExistsInSelect
{
get { return false; }
@@ -763,17 +742,14 @@
public override string AddColumnString
{
- get { return "ADD "; }
+ get { return "add "; }
}
public override string NullColumnString
{
- get { return " NULL"; }
+ get { return " null"; }
}
- /// <summary>
- /// SQL Anywhere does not require qualification of index names.
- /// </summary>
public override bool QualifyIndexName
{
get { return false; }
@@ -787,7 +763,7 @@
/// </summary>
public override string NoColumnsInsertString
{
- get { return " VALUES (DEFAULT) "; }
+ get { return " values (default) "; }
}
/// <summary>
@@ -801,9 +777,8 @@
}
public override string DropForeignKeyString
- // ALTER TABLE DROP FOREIGN KEY <foo>
{
- get { return " DROP FOREIGN KEY "; }
+ get { return " drop foreign key "; }
}
#endregion
@@ -816,16 +791,13 @@
}
/// <summary>
- /// In SQL Anywhere, the syntax
- ///
- /// DECLARE LOCAL TEMPORARY TABLE ...
- ///
+ /// 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 "; }
+ get { return "create local temporary table "; }
}
/// <summary>
@@ -833,7 +805,7 @@
/// </summary>
public override string CreateTemporaryTablePostfix
{
- get { return " ON COMMIT PRESERVE ROWS "; }
+ get { return " on commit preserve rows "; }
}
/// <summary>
@@ -854,12 +826,12 @@
/// <summary>
/// SQL Anywhere does support OUT parameters with callable stored procedures.
/// </summary>
- public override int RegisterResultSetOutParameter( DbCommand statement, int position )
+ public override int RegisterResultSetOutParameter(DbCommand statement, int position)
{
- return position;
+ return position;
}
- public override DbDataReader GetResultSet( DbCommand statement )
+ public override DbDataReader GetResultSet(DbCommand statement)
{
DbDataReader rdr = statement.ExecuteReader();
return rdr;
@@ -870,11 +842,8 @@
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; }
@@ -883,6 +852,6 @@
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 2011-04-10 16:12:26 UTC (rev 5649)
+++ trunk/nhibernate/src/NHibernate/Dialect/SybaseSQLAnywhere11Dialect.cs 2011-04-10 16:38:24 UTC (rev 5650)
@@ -22,23 +22,22 @@
/// 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 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.ASA10ClientDriver" /></description>
- /// </item>
- /// <item>
- /// <term>prepare_sql</term>
- /// <description><see langword="false" /></description>
- /// </item>
+ /// <listheader>
+ /// <term>Property</term>
+ /// <description>Default Value</description>
+ /// </listheader>
+ /// <item>
+ /// <term>connection.driver_class</term>
+ /// <description><see cref="NHibernate.Driver.SybaseSQLAnywhereDriver" /></description>
+ /// </item>
+ /// <item>
+ /// <term>prepare_sql</term>
+ /// <description><see langword="false" /></description>
+ /// </item>
/// </list>
/// </remarks>
public class SybaseSQLAnywhere11Dialect : SybaseSQLAnywhere10Dialect
Modified: trunk/nhibernate/src/NHibernate/Driver/ASA10ClientDriver.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Driver/ASA10ClientDriver.cs 2011-04-10 16:12:26 UTC (rev 5649)
+++ trunk/nhibernate/src/NHibernate/Driver/ASA10ClientDriver.cs 2011-04-10 16:38:24 UTC (rev 5650)
@@ -1,41 +1,10 @@
+using System;
+
namespace NHibernate.Driver
{
- /// <summary>
- /// The ASAClientDriver Driver provides a database driver for Adaptive Server Anywhere 10.0.
- /// </summary>
- public class ASA10ClientDriver : ReflectionBasedDriver
+ [Obsolete("Please use SybaseSQLAnywhereDriver instead. This dialect will be removed in a future release.")]
+ public class ASA10ClientDriver : SybaseSQLAnywhereDriver
{
- /// <summary>
- /// Initializes a new instance of the <see cref="ASAClientDriver"/> class.
- /// </summary>
- /// <exception cref="HibernateException">
- /// Thrown when the iAnywhere.Data.SQLAnywhere assembly is not and can not be loaded.
- /// </exception>
- public ASA10ClientDriver()
- : base("iAnywhere.Data.SQLAnywhere", "iAnywhere.Data.SQLAnywhere.SAConnection", "iAnywhere.Data.SQLAnywhere.SACommand")
- {
- }
-
- /// <summary>
- /// iAnywhere.Data.SQLAnywhere uses named parameters in the sql.
- /// </summary>
- /// <value><see langword="true" /> - Sybase uses <c>String.Empty</c> in the sql.</value>
- public override bool UseNamedPrefixInSql
- {
- get { return false; }
- }
-
- public override bool UseNamedPrefixInParameter
- {
- get { return false; }
- }
-
- /// <summary>
- /// iAnywhere.Data.SQLAnywhere use the <c>string.Empty</c> to locate parameters in sql.
- /// </summary>
- public override string NamedPrefix
- {
- get { return string.Empty; }
- }
+ public ASA10ClientDriver() : base() { }
}
-}
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/Driver/ASAClientDriver.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Driver/ASAClientDriver.cs 2011-04-10 16:12:26 UTC (rev 5649)
+++ trunk/nhibernate/src/NHibernate/Driver/ASAClientDriver.cs 2011-04-10 16:38:24 UTC (rev 5650)
@@ -1,41 +1,10 @@
+using System;
+
namespace NHibernate.Driver
{
- /// <summary>
- /// The ASAClientDriver Driver provides a database driver for Adaptive Server Anywhere 9.0.
- /// </summary>
- public class ASAClientDriver : ReflectionBasedDriver
+ [Obsolete("Please use SybaseASADriver instead. This dialect will be removed in a future release.")]
+ public class ASAClientDriver : SybaseAsaClientDriver
{
- /// <summary>
- /// Initializes a new instance of the <see cref="ASAClientDriver"/> class.
- /// </summary>
- /// <exception cref="HibernateException">
- /// Thrown when the ASA.Data.AsaClient assembly is not and can not be loaded.
- /// </exception>
- public ASAClientDriver()
- : base("iAnywhere.Data.AsaClient", "iAnywhere.Data.AsaClient.AsaConnection", "iAnywhere.Data.AsaClient.AsaCommand")
- {
- }
-
- /// <summary>
- /// iAnywhere.Data.AsaClient uses named parameters in the sql.
- /// </summary>
- /// <value><see langword="true" /> - Sybase uses <c>String.Empty</c> in the sql.</value>
- public override bool UseNamedPrefixInSql
- {
- get { return false; }
- }
-
- public override bool UseNamedPrefixInParameter
- {
- get { return false; }
- }
-
- /// <summary>
- /// iAnywhere.Data.AsaClient use the <c>string.Empty</c> to locate parameters in sql.
- /// </summary>
- public override string NamedPrefix
- {
- get { return string.Empty; }
- }
+ public ASAClientDriver() : base() { }
}
-}
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate/Driver/SybaseAsaClientDriver.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Driver/SybaseAsaClientDriver.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/Driver/SybaseAsaClientDriver.cs 2011-04-10 16:38:24 UTC (rev 5650)
@@ -0,0 +1,36 @@
+using System;
+
+namespace NHibernate.Driver
+{
+ /// <summary>
+ /// The SybaseAsaClientDriver driver provides a database driver for Adaptive Server Anywhere 9.0.
+ /// </summary>
+ public class SybaseAsaClientDriver : ReflectionBasedDriver
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SybaseAsaClientDriver" /> class.
+ /// </summary>
+ /// <exception cref="HibernateException">
+ /// Thrown when the iAnywhere.Data.AsaClient assembly is not and can not be loaded.
+ /// </exception>
+ public SybaseAsaClientDriver()
+ : base("iAnywhere.Data.Asa...
[truncated message content] |
|
From: <jul...@us...> - 2011-04-10 16:12:32
|
Revision: 5649
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5649&view=rev
Author: julian-maughan
Date: 2011-04-10 16:12:26 +0000 (Sun, 10 Apr 2011)
Log Message:
-----------
Added Sybase ASE 15 support (NH-2526). Predominantly a port from Hibernate, with some refinements.
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/NHibernate.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate/Dialect/SybaseASE15Dialect.cs
trunk/nhibernate/src/NHibernate/Driver/SybaseAseClientDriver.cs
trunk/nhibernate/src/NHibernate.Config.Templates/SybaseASE.cfg.xml
Added: trunk/nhibernate/src/NHibernate/Dialect/SybaseASE15Dialect.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Dialect/SybaseASE15Dialect.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/Dialect/SybaseASE15Dialect.cs 2011-04-10 16:12:26 UTC (rev 5649)
@@ -0,0 +1,331 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.Common;
+using System.Text;
+using Environment = NHibernate.Cfg.Environment;
+using NHibernate.Dialect.Function;
+using NHibernate.SqlCommand;
+
+namespace NHibernate.Dialect
+{
+ /// <summary>
+ /// An SQL dialect targeting Sybase Adaptive Server Enterprise (ASE) 15 and higher.
+ /// </summary>
+ /// <remarks>
+ /// 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.SybaseAseClientDriver" /></description>
+ /// </item>
+ /// </list>
+ /// </remarks>
+ public class SybaseASE15Dialect : Dialect
+ {
+ public SybaseASE15Dialect()
+ {
+ DefaultProperties[Environment.ConnectionDriver] = "NHibernate.Driver.SybaseAseClientDriver";
+
+ RegisterColumnType(DbType.Boolean, "tinyint"); // Sybase BIT type does not support null values
+ RegisterColumnType(DbType.Int16, "smallint");
+ RegisterColumnType(DbType.Int16, 255, "tinyint");
+ RegisterColumnType(DbType.Int32, "int");
+ RegisterColumnType(DbType.Int64, "bigint");
+ RegisterColumnType(DbType.Decimal, "numeric(18,0)");
+ RegisterColumnType(DbType.Single, "real");
+ RegisterColumnType(DbType.Double, "float");
+ RegisterColumnType(DbType.AnsiStringFixedLength, "char(1)");
+ RegisterColumnType(DbType.AnsiStringFixedLength, 255, "char($l)");
+ RegisterColumnType(DbType.StringFixedLength, "nchar(1)");
+ RegisterColumnType(DbType.StringFixedLength, 255, "nchar($l)");
+ RegisterColumnType(DbType.AnsiString, "varchar(255)");
+ RegisterColumnType(DbType.AnsiString, 16384, "varchar($l)");
+ RegisterColumnType(DbType.String, "nvarchar(255)");
+ RegisterColumnType(DbType.String, 16384, "nvarchar($l)");
+ RegisterColumnType(DbType.String, int.MaxValue, "text");
+ RegisterColumnType(DbType.DateTime, "datetime");
+ RegisterColumnType(DbType.Time, "time");
+ RegisterColumnType(DbType.Date, "date");
+ RegisterColumnType(DbType.Binary, 8000, "varbinary($l)");
+ RegisterColumnType(DbType.Binary, "varbinary");
+
+ RegisterFunction("abs", new StandardSQLFunction("abs"));
+ RegisterFunction("acos", new StandardSQLFunction("acos", NHibernateUtil.Double));
+ RegisterFunction("ascii", new StandardSQLFunction("ascii", NHibernateUtil.Int32));
+ RegisterFunction("asin", new StandardSQLFunction("asin", NHibernateUtil.Double));
+ RegisterFunction("atan", new StandardSQLFunction("atan", NHibernateUtil.Double));
+ RegisterFunction("bit_length", new SQLFunctionTemplate(NHibernateUtil.Int32, "datalength(?1) * 8"));
+ RegisterFunction("ceiling", new StandardSQLFunction("ceiling"));
+ RegisterFunction("char", new StandardSQLFunction("char", NHibernateUtil.String));
+ RegisterFunction("concat", new VarArgsSQLFunction(NHibernateUtil.String, "(","+",")"));
+ RegisterFunction("cos", new StandardSQLFunction("cos", NHibernateUtil.Double));
+ RegisterFunction("cot", new StandardSQLFunction("cot", NHibernateUtil.Double));
+ RegisterFunction("current_date", new NoArgSQLFunction("getdate", NHibernateUtil.Date));
+ RegisterFunction("current_time", new NoArgSQLFunction("getdate", NHibernateUtil.Time));
+ RegisterFunction("current_timestamp", new NoArgSQLFunction("getdate", NHibernateUtil.Timestamp));
+ RegisterFunction("datename", new StandardSQLFunction("datename", NHibernateUtil.String));
+ RegisterFunction("day", new StandardSQLFunction("day", NHibernateUtil.Int32));
+ RegisterFunction("degrees", new StandardSQLFunction("degrees", NHibernateUtil.Double));
+ RegisterFunction("exp", new StandardSQLFunction("exp", NHibernateUtil.Double));
+ RegisterFunction("extract", new SQLFunctionTemplate(NHibernateUtil.Int32, "datepart(?1, ?3)"));
+ RegisterFunction("floor", new StandardSQLFunction("floor"));
+ RegisterFunction("getdate", new NoArgSQLFunction("getdate", NHibernateUtil.Timestamp));
+ RegisterFunction("getutcdate", new NoArgSQLFunction("getutcdate", NHibernateUtil.Timestamp));
+ RegisterFunction("hour", new SQLFunctionTemplate(NHibernateUtil.Int32, "datepart(hour, ?1)"));
+ RegisterFunction("isnull", new StandardSQLFunction("isnull"));
+ RegisterFunction("len", new StandardSQLFunction("len", NHibernateUtil.Int64));
+ RegisterFunction("length", new StandardSQLFunction("len", NHibernateUtil.Int32));
+ RegisterFunction("locate", new CharIndexFunction());
+ RegisterFunction("log", new StandardSQLFunction("log", NHibernateUtil.Double));
+ RegisterFunction("log10", new StandardSQLFunction("log10", NHibernateUtil.Double));
+ RegisterFunction("lower", new StandardSQLFunction("lower"));
+ RegisterFunction("ltrim", new StandardSQLFunction("ltrim"));
+ RegisterFunction("minute", new SQLFunctionTemplate(NHibernateUtil.Int32, "datepart(minute, ?1)"));
+ RegisterFunction("mod", new SQLFunctionTemplate(NHibernateUtil.Int32, "?1 % ?2"));
+ RegisterFunction("month", new StandardSQLFunction("month", NHibernateUtil.Int32));
+ RegisterFunction("pi", new NoArgSQLFunction("pi", NHibernateUtil.Double));
+ RegisterFunction("radians", new StandardSQLFunction("radians", NHibernateUtil.Double));
+ RegisterFunction("rand", new StandardSQLFunction("rand", NHibernateUtil.Double));
+ RegisterFunction("reverse", new StandardSQLFunction("reverse"));
+ RegisterFunction("round", new StandardSQLFunction("round"));
+ RegisterFunction("rtrim", new StandardSQLFunction("rtrim"));
+ RegisterFunction("second", new SQLFunctionTemplate(NHibernateUtil.Int32, "datepart(second, ?1)"));
+ RegisterFunction("sign", new StandardSQLFunction("sign", NHibernateUtil.Int32));
+ RegisterFunction("sin", new StandardSQLFunction("sin", NHibernateUtil.Double));
+ RegisterFunction("space", new StandardSQLFunction("space", NHibernateUtil.String));
+ RegisterFunction("sqrt", new StandardSQLFunction("sqrt", NHibernateUtil.Double));
+ RegisterFunction("square", new StandardSQLFunction("square"));
+ RegisterFunction("str", new StandardSQLFunction("str", NHibernateUtil.String));
+ RegisterFunction("tan", new StandardSQLFunction("tan", NHibernateUtil.Double));
+ // TODO RegisterFunction("trim", new SQLFunctionTemplate(NHibernateUtil.String, "ltrim(rtrim(?1))"));
+ RegisterFunction("upper", new StandardSQLFunction("upper"));
+ RegisterFunction("user", new NoArgSQLFunction("user", NHibernateUtil.String));
+ RegisterFunction("year", new StandardSQLFunction("year", NHibernateUtil.Int32));
+ }
+
+ public override string AddColumnString
+ {
+ get { return "add"; }
+ }
+
+ public override string NullColumnString
+ {
+ get { return " null"; }
+ }
+
+ public override bool QualifyIndexName
+ {
+ get { return false; }
+ }
+
+ public override bool SupportsIdentityColumns
+ {
+ get { return true; }
+ }
+
+ public override string IdentitySelectString
+ {
+ get { return "select @@identity"; }
+ }
+
+ public override string IdentityColumnString
+ {
+ get { return "identity not null"; } // starts with 1, implicitly
+ }
+
+ public override bool SupportsInsertSelectIdentity
+ {
+ get { return true; }
+ }
+
+ public override bool SupportsCurrentTimestampSelection
+ {
+ get { return true; }
+ }
+
+ public override bool IsCurrentTimestampSelectStringCallable
+ {
+ get { return false; }
+ }
+
+ public override string CurrentTimestampSelectString
+ {
+ get { return "select getdate()"; }
+ }
+
+ /// <summary>
+ /// Sybase ASE 15 temporary tables are not supported
+ /// </summary>
+ /// <remarks>
+ /// By default, temporary tables in Sybase ASE 15 can only be created outside a transaction.
+ /// This is not supported by NHibernate. Temporary tables (and other DDL) statements can only
+ /// be run in a transaction if the 'ddl in tran' database option on tempdb is set to 'true'.
+ /// However, Sybase does not recommend this setting due to the performance impact arising from
+ /// locking and contention on tempdb system tables.
+ /// </remarks>
+ public override bool SupportsTemporaryTables
+ {
+ get { return false; }
+ }
+
+ public override string SelectGUIDString
+ {
+ get { return "select newid()"; }
+ }
+
+ public override bool SupportsEmptyInList
+ {
+ get { return false; }
+ }
+
+ public override bool SupportsUnionAll
+ {
+ get { return true; }
+ }
+
+ public override bool SupportsExistsInSelect
+ {
+ get { return false; }
+ }
+
+ public override bool DoesReadCommittedCauseWritersToBlockReaders
+ {
+ get { return true; }
+ }
+
+ public override bool DoesRepeatableReadCauseReadersToBlockWriters
+ {
+ get { return true; }
+ }
+
+ public override bool SupportsCascadeDelete
+ {
+ get { return false; }
+ }
+
+ public override int MaxAliasLength
+ {
+ get { return 30; }
+ }
+
+ /// <summary>
+ /// This is false only by default. The database can be configured to be
+ /// case-insensitive.
+ /// </summary>
+ public override bool AreStringComparisonsCaseInsensitive
+ {
+ get { return false; }
+ }
+
+ public override string CurrentTimestampSQLFunctionName
+ {
+ get { return "getdate()"; }
+ }
+
+ public override bool SupportsExpectedLobUsagePattern
+ {
+ get { return false; }
+ }
+
+ public override char OpenQuote
+ {
+ get { return '['; }
+ }
+
+ public override char CloseQuote
+ {
+ get { return ']'; }
+ }
+
+ public override string ForUpdateString
+ {
+ get { return String.Empty; }
+ }
+
+ public override string GenerateTemporaryTableName(string baseTableName)
+ {
+ return "#" + baseTableName;
+ }
+
+ public override bool DropTemporaryTableAfterUse()
+ {
+ return true;
+ }
+
+ public override SqlString AppendIdentitySelectToInsert(SqlString insertString)
+ {
+ return insertString.Append("\nselect @@identity");
+ }
+
+ public override string AppendLockHint(LockMode lockMode, string tableName)
+ {
+ if (lockMode.GreaterThan(LockMode.Read))
+ return tableName + " holdlock";
+
+ return tableName;
+ }
+
+ public override SqlString ApplyLocksToSql(SqlString sql, IDictionary<string, LockMode> aliasedLockModes, IDictionary<string, string[]> keyColumnNames)
+ {
+ // TODO: merge additional lockoptions support in Dialect.applyLocksToSql
+
+ var buffer = new StringBuilder(sql.ToString());
+ int correction = 0;
+
+ foreach (KeyValuePair<string, LockMode> entry in aliasedLockModes)
+ {
+ LockMode mode = entry.Value;
+
+ if (mode.GreaterThan(LockMode.Read))
+ {
+ string alias = entry.Key;
+ int start = -1;
+ int end = -1;
+
+ if (sql.EndsWith(" " + alias))
+ {
+ start = (sql.Length - alias.Length) + correction;
+ end = start + alias.Length;
+ }
+ else
+ {
+ int position = sql.IndexOfCaseInsensitive(" " + alias + " ");
+
+ if (position <= -1)
+ position = sql.IndexOfCaseInsensitive(" " + alias + ",");
+
+ if (position > -1)
+ {
+ start = position + correction + 1;
+ end = start + alias.Length;
+ }
+ }
+
+ if (start > -1)
+ {
+ string lockHint = AppendLockHint(mode, alias);
+ buffer.Remove(start, end - start + 1);
+ buffer.Insert(start, lockHint);
+ correction += (lockHint.Length - alias.Length);
+ }
+ }
+ }
+ return new SqlString(buffer.ToString());
+ }
+
+ public override int RegisterResultSetOutParameter(DbCommand statement, int position)
+ {
+ return position;
+ }
+
+ public override DbDataReader GetResultSet(DbCommand statement)
+ {
+ return statement.ExecuteReader();
+ }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate/Driver/SybaseAseClientDriver.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Driver/SybaseAseClientDriver.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/Driver/SybaseAseClientDriver.cs 2011-04-10 16:12:26 UTC (rev 5649)
@@ -0,0 +1,36 @@
+using System;
+
+namespace NHibernate.Driver
+{
+ /// <summary>
+ /// This provides a driver for Sybase ASE 15 using the ADO.NET driver.
+ /// </summary>
+ /// <remarks>
+ /// You will need the following libraries available to your application:
+ /// <ul>
+ /// <li>Sybase.AdoNet2.AseClient.dll</li>
+ /// <li>sybdrvado20.dll</li>
+ /// </ul>
+ /// </remarks>
+ public class SybaseAseClientDriver : ReflectionBasedDriver
+ {
+ public SybaseAseClientDriver() : base("Sybase.AdoNet2.AseClient", "Sybase.Data.AseClient.AseConnection", "Sybase.Data.AseClient.AseCommand")
+ {
+ }
+
+ public override string NamedPrefix
+ {
+ get { return "@"; }
+ }
+
+ public override bool UseNamedPrefixInParameter
+ {
+ get { return true; }
+ }
+
+ public override bool UseNamedPrefixInSql
+ {
+ get { return true; }
+ }
+ }
+}
Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-04-09 16:01:06 UTC (rev 5648)
+++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-04-10 16:12:26 UTC (rev 5649)
@@ -140,6 +140,7 @@
<Compile Include="Dialect\PostgreSQLDialect.cs" />
<Compile Include="Dialect\Schema\PostgreSQLMetadata.cs" />
<Compile Include="Dialect\SQLiteDialect.cs" />
+ <Compile Include="Dialect\SybaseASE15Dialect.cs" />
<Compile Include="Dialect\SybaseSQLAnywhere10Dialect.cs" />
<Compile Include="Dialect\SybaseSQLAnywhere11Dialect.cs" />
<Compile Include="Dialect\TypeNames.cs" />
@@ -159,6 +160,7 @@
<Compile Include="Driver\SqlClientDriver.cs" />
<Compile Include="Driver\BasicResultSetsCommand.cs" />
<Compile Include="Driver\SQLiteDriver.cs" />
+ <Compile Include="Driver\SybaseAseClientDriver.cs" />
<Compile Include="Engine\Cascade.cs" />
<Compile Include="Engine\IBatcher.cs" />
<Compile Include="Engine\IMapping.cs" />
Added: trunk/nhibernate/src/NHibernate.Config.Templates/SybaseASE.cfg.xml
===================================================================
--- trunk/nhibernate/src/NHibernate.Config.Templates/SybaseASE.cfg.xml (rev 0)
+++ trunk/nhibernate/src/NHibernate.Config.Templates/SybaseASE.cfg.xml 2011-04-10 16:12:26 UTC (rev 5649)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+This template was written to work with NHibernate.Test.
+Copy the template to your NHibernate.Test project folder and rename it hibernate.cfg.xml. Change it
+for your own use before compiling tests in Visual Studio.
+-->
+<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
+ <session-factory name="NHibernate.Test">
+ <property name="connection.driver_class">NHibernate.Driver.SybaseAseClientDriver</property>
+ <property name="connection.connection_string">
+ Data Source=10.0.0.1;Port=5000;Database=nhibernate;User ID=nhibernate;Password=password
+ </property>
+ <property name="dialect">NHibernate.Dialect.SybaseASE15Dialect</property>
+ <property name="query.substitutions">true=1;false=0</property>
+ </session-factory>
+</hibernate-configuration>
\ 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: <pa...@us...> - 2011-04-09 16:01:14
|
Revision: 5648
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5648&view=rev
Author: patearl
Date: 2011-04-09 16:01:06 +0000 (Sat, 09 Apr 2011)
Log Message:
-----------
ReLinq upgraded to 1.13.100.2.
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Linq/Clauses/LeftJoinClause.cs
trunk/nhibernate/src/NHibernate/Linq/EagerFetchingExtensionMethods.cs
trunk/nhibernate/src/NHibernate/Linq/GroupBy/AggregatingGroupByRewriter.cs
trunk/nhibernate/src/NHibernate/Linq/GroupBy/GroupByAggregateDetectionVisitor.cs
trunk/nhibernate/src/NHibernate/Linq/GroupBy/GroupBySelectClauseRewriter.cs
trunk/nhibernate/src/NHibernate/Linq/GroupBy/NonAggregatingGroupByRewriter.cs
trunk/nhibernate/src/NHibernate/Linq/GroupJoin/AggregatingGroupJoinRewriter.cs
trunk/nhibernate/src/NHibernate/Linq/GroupJoin/GroupJoinAggregateDetectionVisitor.cs
trunk/nhibernate/src/NHibernate/Linq/GroupJoin/GroupJoinSelectClauseRewriter.cs
trunk/nhibernate/src/NHibernate/Linq/GroupJoin/IsAggregatingResults.cs
trunk/nhibernate/src/NHibernate/Linq/GroupJoin/LocateGroupJoinQuerySource.cs
trunk/nhibernate/src/NHibernate/Linq/GroupJoin/NonAggregatingGroupJoinRewriter.cs
trunk/nhibernate/src/NHibernate/Linq/NhLinqExpression.cs
trunk/nhibernate/src/NHibernate/Linq/NhQueryable.cs
trunk/nhibernate/src/NHibernate/Linq/NhRelinqQueryParser.cs
trunk/nhibernate/src/NHibernate/Linq/ReWriters/AddLeftJoinsReWriter.cs
trunk/nhibernate/src/NHibernate/Linq/ReWriters/MergeAggregatingResultsRewriter.cs
trunk/nhibernate/src/NHibernate/Linq/ReWriters/MoveOrderByToEndRewriter.cs
trunk/nhibernate/src/NHibernate/Linq/ReWriters/QueryReferenceExpressionFlattener.cs
trunk/nhibernate/src/NHibernate/Linq/ReWriters/RemoveUnnecessaryBodyOperators.cs
trunk/nhibernate/src/NHibernate/Linq/ReWriters/ResultOperatorRewriter.cs
trunk/nhibernate/src/NHibernate/Linq/ReWriters/ResultOperatorRewriterResult.cs
trunk/nhibernate/src/NHibernate/Linq/ResultOperators/ClientSideTransformOperator.cs
trunk/nhibernate/src/NHibernate/Linq/ResultOperators/NonAggregatingGroupBy.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/ExpressionTreeVisitor.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/GroupByKeySelectorVisitor.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/HqlGeneratorExpressionTreeVisitor.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/LeftJoinDetector.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/NameGenerator.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/NhThrowingExpressionTreeVisitor.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/QueryModelVisitor.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/QuerySourceLocator.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessAggregate.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessAggregateFromSeed.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessAll.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessAny.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessCast.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessContains.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessFetch.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessFetchMany.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessFetchOne.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessFirst.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessGroupBy.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessNonAggregatingGroupBy.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessOfType.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessSingle.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessSkip.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessTake.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ResultOperatorMap.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ResultOperatorProcessor.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ResultOperatorProcessorBase.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/SwapQuerySourceVisitor.cs
trunk/nhibernate/src/NHibernate/NHibernate.build
trunk/nhibernate/src/NHibernate/NHibernate.csproj
Added Paths:
-----------
trunk/nhibernate/lib/net/3.5/Remotion.Linq.dll
trunk/nhibernate/lib/net/3.5/Remotion.Linq.pdb
Removed Paths:
-------------
trunk/nhibernate/lib/net/3.5/Remotion.Data.Linq.dll
trunk/nhibernate/lib/net/3.5/Remotion.Data.Linq.pdb
Deleted: trunk/nhibernate/lib/net/3.5/Remotion.Data.Linq.dll
===================================================================
(Binary files differ)
Deleted: trunk/nhibernate/lib/net/3.5/Remotion.Data.Linq.pdb
===================================================================
(Binary files differ)
Added: trunk/nhibernate/lib/net/3.5/Remotion.Linq.dll
===================================================================
(Binary files differ)
Property changes on: trunk/nhibernate/lib/net/3.5/Remotion.Linq.dll
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/nhibernate/lib/net/3.5/Remotion.Linq.pdb
===================================================================
(Binary files differ)
Property changes on: trunk/nhibernate/lib/net/3.5/Remotion.Linq.pdb
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/nhibernate/src/NHibernate/Linq/Clauses/LeftJoinClause.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Clauses/LeftJoinClause.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Clauses/LeftJoinClause.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,5 +1,5 @@
using System.Linq.Expressions;
-using Remotion.Data.Linq.Clauses;
+using Remotion.Linq.Clauses;
namespace NHibernate.Linq.Visitors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/EagerFetchingExtensionMethods.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/EagerFetchingExtensionMethods.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/EagerFetchingExtensionMethods.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -3,8 +3,8 @@
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
-using Remotion.Data.Linq;
-using Remotion.Data.Linq.Utilities;
+using Remotion.Linq;
+using Remotion.Linq.Utilities;
namespace NHibernate.Linq
{
Modified: trunk/nhibernate/src/NHibernate/Linq/GroupBy/AggregatingGroupByRewriter.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/GroupBy/AggregatingGroupByRewriter.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/GroupBy/AggregatingGroupByRewriter.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,10 +1,10 @@
using System;
using System.Linq;
using NHibernate.Linq.Visitors;
-using Remotion.Data.Linq;
-using Remotion.Data.Linq.Clauses;
-using Remotion.Data.Linq.Clauses.Expressions;
-using Remotion.Data.Linq.Clauses.ResultOperators;
+using Remotion.Linq;
+using Remotion.Linq.Clauses;
+using Remotion.Linq.Clauses.Expressions;
+using Remotion.Linq.Clauses.ResultOperators;
namespace NHibernate.Linq.GroupBy
{
Modified: trunk/nhibernate/src/NHibernate/Linq/GroupBy/GroupByAggregateDetectionVisitor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/GroupBy/GroupByAggregateDetectionVisitor.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/GroupBy/GroupByAggregateDetectionVisitor.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -2,7 +2,7 @@
using System.Linq.Expressions;
using NHibernate.Linq.Expressions;
using NHibernate.Linq.Visitors;
-using Remotion.Data.Linq.Clauses.Expressions;
+using Remotion.Linq.Clauses.Expressions;
namespace NHibernate.Linq.GroupBy
{
Modified: trunk/nhibernate/src/NHibernate/Linq/GroupBy/GroupBySelectClauseRewriter.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/GroupBy/GroupBySelectClauseRewriter.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/GroupBy/GroupBySelectClauseRewriter.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,10 +1,10 @@
using System;
using System.Linq.Expressions;
using NHibernate.Linq.Visitors;
-using Remotion.Data.Linq;
-using Remotion.Data.Linq.Clauses;
-using Remotion.Data.Linq.Clauses.Expressions;
-using Remotion.Data.Linq.Clauses.ResultOperators;
+using Remotion.Linq;
+using Remotion.Linq.Clauses;
+using Remotion.Linq.Clauses.Expressions;
+using Remotion.Linq.Clauses.ResultOperators;
namespace NHibernate.Linq.GroupBy
{
Modified: trunk/nhibernate/src/NHibernate/Linq/GroupBy/NonAggregatingGroupByRewriter.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/GroupBy/NonAggregatingGroupByRewriter.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/GroupBy/NonAggregatingGroupByRewriter.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -3,10 +3,10 @@
using System.Linq.Expressions;
using NHibernate.Linq.ResultOperators;
using NHibernate.Linq.Visitors;
-using Remotion.Data.Linq;
-using Remotion.Data.Linq.Clauses;
-using Remotion.Data.Linq.Clauses.Expressions;
-using Remotion.Data.Linq.Clauses.ResultOperators;
+using Remotion.Linq;
+using Remotion.Linq.Clauses;
+using Remotion.Linq.Clauses.Expressions;
+using Remotion.Linq.Clauses.ResultOperators;
namespace NHibernate.Linq.GroupBy
{
Modified: trunk/nhibernate/src/NHibernate/Linq/GroupJoin/AggregatingGroupJoinRewriter.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/GroupJoin/AggregatingGroupJoinRewriter.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/GroupJoin/AggregatingGroupJoinRewriter.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;
-using Remotion.Data.Linq;
-using Remotion.Data.Linq.Clauses;
+using Remotion.Linq;
+using Remotion.Linq.Clauses;
namespace NHibernate.Linq.GroupJoin
{
Modified: trunk/nhibernate/src/NHibernate/Linq/GroupJoin/GroupJoinAggregateDetectionVisitor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/GroupJoin/GroupJoinAggregateDetectionVisitor.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/GroupJoin/GroupJoinAggregateDetectionVisitor.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -3,8 +3,8 @@
using System.Linq.Expressions;
using NHibernate.Linq.Expressions;
using NHibernate.Linq.Visitors;
-using Remotion.Data.Linq.Clauses;
-using Remotion.Data.Linq.Clauses.Expressions;
+using Remotion.Linq.Clauses;
+using Remotion.Linq.Clauses.Expressions;
namespace NHibernate.Linq.GroupJoin
{
Modified: trunk/nhibernate/src/NHibernate/Linq/GroupJoin/GroupJoinSelectClauseRewriter.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/GroupJoin/GroupJoinSelectClauseRewriter.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/GroupJoin/GroupJoinSelectClauseRewriter.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,8 +1,8 @@
using System.Linq.Expressions;
using NHibernate.Linq.Visitors;
-using Remotion.Data.Linq;
-using Remotion.Data.Linq.Clauses;
-using Remotion.Data.Linq.Clauses.Expressions;
+using Remotion.Linq;
+using Remotion.Linq.Clauses;
+using Remotion.Linq.Clauses.Expressions;
namespace NHibernate.Linq.GroupJoin
{
Modified: trunk/nhibernate/src/NHibernate/Linq/GroupJoin/IsAggregatingResults.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/GroupJoin/IsAggregatingResults.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/GroupJoin/IsAggregatingResults.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using System.Linq.Expressions;
-using Remotion.Data.Linq.Clauses;
+using Remotion.Linq.Clauses;
namespace NHibernate.Linq.GroupJoin
{
Modified: trunk/nhibernate/src/NHibernate/Linq/GroupJoin/LocateGroupJoinQuerySource.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/GroupJoin/LocateGroupJoinQuerySource.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/GroupJoin/LocateGroupJoinQuerySource.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,7 +1,7 @@
using System.Linq.Expressions;
using NHibernate.Linq.Visitors;
-using Remotion.Data.Linq.Clauses;
-using Remotion.Data.Linq.Clauses.Expressions;
+using Remotion.Linq.Clauses;
+using Remotion.Linq.Clauses.Expressions;
namespace NHibernate.Linq.GroupJoin
{
Modified: trunk/nhibernate/src/NHibernate/Linq/GroupJoin/NonAggregatingGroupJoinRewriter.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/GroupJoin/NonAggregatingGroupJoinRewriter.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/GroupJoin/NonAggregatingGroupJoinRewriter.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -3,9 +3,9 @@
using System.Linq;
using System.Linq.Expressions;
using NHibernate.Linq.GroupJoin;
-using Remotion.Data.Linq;
-using Remotion.Data.Linq.Clauses;
-using Remotion.Data.Linq.Clauses.Expressions;
+using Remotion.Linq;
+using Remotion.Linq.Clauses;
+using Remotion.Linq.Clauses.Expressions;
namespace NHibernate.Linq.Visitors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/NhLinqExpression.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/NhLinqExpression.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/NhLinqExpression.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -6,7 +6,7 @@
using NHibernate.Hql.Ast.ANTLR.Tree;
using NHibernate.Linq.Visitors;
using NHibernate.Type;
-using Remotion.Data.Linq.Parsing.ExpressionTreeVisitors;
+using Remotion.Linq.Parsing.ExpressionTreeVisitors;
namespace NHibernate.Linq
{
Modified: trunk/nhibernate/src/NHibernate/Linq/NhQueryable.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/NhQueryable.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/NhQueryable.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,7 +1,7 @@
using System.Linq;
using System.Linq.Expressions;
using NHibernate.Engine;
-using Remotion.Data.Linq;
+using Remotion.Linq;
namespace NHibernate.Linq
{
Modified: trunk/nhibernate/src/NHibernate/Linq/NhRelinqQueryParser.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/NhRelinqQueryParser.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/NhRelinqQueryParser.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -4,14 +4,14 @@
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
-using Remotion.Data.Linq;
-using Remotion.Data.Linq.Clauses;
-using Remotion.Data.Linq.Clauses.StreamedData;
-using Remotion.Data.Linq.EagerFetching.Parsing;
-using Remotion.Data.Linq.Parsing.ExpressionTreeVisitors.Transformation;
-using Remotion.Data.Linq.Parsing.Structure;
-using Remotion.Data.Linq.Parsing.Structure.IntermediateModel;
-using Remotion.Data.Linq.Parsing.Structure.NodeTypeProviders;
+using Remotion.Linq;
+using Remotion.Linq.Clauses;
+using Remotion.Linq.Clauses.StreamedData;
+using Remotion.Linq.EagerFetching.Parsing;
+using Remotion.Linq.Parsing.ExpressionTreeVisitors.Transformation;
+using Remotion.Linq.Parsing.Structure;
+using Remotion.Linq.Parsing.Structure.IntermediateModel;
+using Remotion.Linq.Parsing.Structure.NodeTypeProviders;
namespace NHibernate.Linq
{
Modified: trunk/nhibernate/src/NHibernate/Linq/ReWriters/AddLeftJoinsReWriter.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/ReWriters/AddLeftJoinsReWriter.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/ReWriters/AddLeftJoinsReWriter.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,8 +1,8 @@
using System.Collections.Generic;
using System.Linq.Expressions;
using NHibernate.Linq.Visitors;
-using Remotion.Data.Linq;
-using Remotion.Data.Linq.Clauses;
+using Remotion.Linq;
+using Remotion.Linq.Clauses;
namespace NHibernate.Linq.ReWriters
{
Modified: trunk/nhibernate/src/NHibernate/Linq/ReWriters/MergeAggregatingResultsRewriter.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/ReWriters/MergeAggregatingResultsRewriter.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/ReWriters/MergeAggregatingResultsRewriter.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -3,11 +3,11 @@
using System.Linq.Expressions;
using NHibernate.Linq.Expressions;
using NHibernate.Linq.Visitors;
-using Remotion.Data.Linq;
-using Remotion.Data.Linq.Clauses;
-using Remotion.Data.Linq.Clauses.Expressions;
-using Remotion.Data.Linq.Clauses.ResultOperators;
-using Remotion.Data.Linq.Parsing.ExpressionTreeVisitors;
+using Remotion.Linq;
+using Remotion.Linq.Clauses;
+using Remotion.Linq.Clauses.Expressions;
+using Remotion.Linq.Clauses.ResultOperators;
+using Remotion.Linq.Parsing.ExpressionTreeVisitors;
namespace NHibernate.Linq.ReWriters
{
Modified: trunk/nhibernate/src/NHibernate/Linq/ReWriters/MoveOrderByToEndRewriter.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/ReWriters/MoveOrderByToEndRewriter.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/ReWriters/MoveOrderByToEndRewriter.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -2,8 +2,8 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
-using Remotion.Data.Linq;
-using Remotion.Data.Linq.Clauses;
+using Remotion.Linq;
+using Remotion.Linq.Clauses;
namespace NHibernate.Linq.ReWriters
{
Modified: trunk/nhibernate/src/NHibernate/Linq/ReWriters/QueryReferenceExpressionFlattener.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/ReWriters/QueryReferenceExpressionFlattener.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/ReWriters/QueryReferenceExpressionFlattener.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,8 +1,8 @@
using System.Linq.Expressions;
using NHibernate.Linq.Visitors;
-using Remotion.Data.Linq;
-using Remotion.Data.Linq.Clauses;
-using Remotion.Data.Linq.Clauses.Expressions;
+using Remotion.Linq;
+using Remotion.Linq.Clauses;
+using Remotion.Linq.Clauses.Expressions;
namespace NHibernate.Linq.ReWriters
{
Modified: trunk/nhibernate/src/NHibernate/Linq/ReWriters/RemoveUnnecessaryBodyOperators.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/ReWriters/RemoveUnnecessaryBodyOperators.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/ReWriters/RemoveUnnecessaryBodyOperators.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -2,10 +2,10 @@
using System.Linq;
using System.Linq.Expressions;
using NHibernate.Linq.Expressions;
-using Remotion.Data.Linq;
-using Remotion.Data.Linq.Clauses;
-using Remotion.Data.Linq.Clauses.ResultOperators;
-using Remotion.Data.Linq.Parsing;
+using Remotion.Linq;
+using Remotion.Linq.Clauses;
+using Remotion.Linq.Clauses.ResultOperators;
+using Remotion.Linq.Parsing;
namespace NHibernate.Linq.ReWriters
{
Modified: trunk/nhibernate/src/NHibernate/Linq/ReWriters/ResultOperatorRewriter.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/ReWriters/ResultOperatorRewriter.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/ReWriters/ResultOperatorRewriter.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -6,12 +6,12 @@
using NHibernate.Linq.Visitors;
- using Remotion.Data.Linq;
- using Remotion.Data.Linq.Clauses;
- using Remotion.Data.Linq.Clauses.Expressions;
- using Remotion.Data.Linq.Clauses.ResultOperators;
- using Remotion.Data.Linq.Clauses.StreamedData;
- using Remotion.Data.Linq.EagerFetching;
+ using Remotion.Linq;
+ using Remotion.Linq.Clauses;
+ using Remotion.Linq.Clauses.Expressions;
+ using Remotion.Linq.Clauses.ResultOperators;
+ using Remotion.Linq.Clauses.StreamedData;
+ using Remotion.Linq.EagerFetching;
/// <summary>
/// Removes various result operators from a query so that they can be processed at the same
Modified: trunk/nhibernate/src/NHibernate/Linq/ReWriters/ResultOperatorRewriterResult.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/ReWriters/ResultOperatorRewriterResult.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/ReWriters/ResultOperatorRewriterResult.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -2,8 +2,8 @@
{
using System.Collections.Generic;
- using Remotion.Data.Linq.Clauses;
- using Remotion.Data.Linq.Clauses.StreamedData;
+ using Remotion.Linq.Clauses;
+ using Remotion.Linq.Clauses.StreamedData;
/// <summary>
/// Result of <see cref="ResultOperatorRewriter.Rewrite" />.
Modified: trunk/nhibernate/src/NHibernate/Linq/ResultOperators/ClientSideTransformOperator.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/ResultOperators/ClientSideTransformOperator.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/ResultOperators/ClientSideTransformOperator.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,7 +1,7 @@
using System;
using System.Linq.Expressions;
-using Remotion.Data.Linq.Clauses;
-using Remotion.Data.Linq.Clauses.StreamedData;
+using Remotion.Linq.Clauses;
+using Remotion.Linq.Clauses.StreamedData;
namespace NHibernate.Linq.ResultOperators
{
Modified: trunk/nhibernate/src/NHibernate/Linq/ResultOperators/NonAggregatingGroupBy.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/ResultOperators/NonAggregatingGroupBy.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/ResultOperators/NonAggregatingGroupBy.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,4 +1,4 @@
-using Remotion.Data.Linq.Clauses.ResultOperators;
+using Remotion.Linq.Clauses.ResultOperators;
namespace NHibernate.Linq.ResultOperators
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/ExpressionTreeVisitor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/ExpressionTreeVisitor.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/ExpressionTreeVisitor.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,7 +1,7 @@
using System;
using System.Collections.ObjectModel;
using System.Linq.Expressions;
-using Remotion.Data.Linq.Clauses.Expressions;
+using Remotion.Linq.Clauses.Expressions;
namespace NHibernate.Linq.Visitors
{
@@ -9,7 +9,7 @@
/// This class is used to expose the members from the base class that get internalized when the other class is ilmerged.
/// We do this instead of exposing the base class directly by name, since we don't want it to be part of our public API.
/// </summary>
- public class ExpressionTreeVisitor : Remotion.Data.Linq.Parsing.ExpressionTreeVisitor
+ public class ExpressionTreeVisitor : Remotion.Linq.Parsing.ExpressionTreeVisitor
{
public override ReadOnlyCollection<T> VisitAndConvert<T>(ReadOnlyCollection<T> expressions, string callerName)
{
@@ -126,12 +126,12 @@
return base.VisitParameterExpression(expression);
}
- protected override Expression VisitQuerySourceReferenceExpression(Remotion.Data.Linq.Clauses.Expressions.QuerySourceReferenceExpression expression)
+ protected override Expression VisitQuerySourceReferenceExpression(Remotion.Linq.Clauses.Expressions.QuerySourceReferenceExpression expression)
{
return base.VisitQuerySourceReferenceExpression(expression);
}
- protected override Expression VisitSubQueryExpression(Remotion.Data.Linq.Clauses.Expressions.SubQueryExpression expression)
+ protected override Expression VisitSubQueryExpression(Remotion.Linq.Clauses.Expressions.SubQueryExpression expression)
{
return base.VisitSubQueryExpression(expression);
}
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/GroupByKeySelectorVisitor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/GroupByKeySelectorVisitor.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/GroupByKeySelectorVisitor.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,5 +1,5 @@
using System.Linq.Expressions;
-using Remotion.Data.Linq.Clauses.Expressions;
+using Remotion.Linq.Clauses.Expressions;
namespace NHibernate.Linq.Visitors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/HqlGeneratorExpressionTreeVisitor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/HqlGeneratorExpressionTreeVisitor.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/HqlGeneratorExpressionTreeVisitor.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -4,7 +4,7 @@
using NHibernate.Hql.Ast;
using NHibernate.Linq.Expressions;
using NHibernate.Linq.Functions;
-using Remotion.Data.Linq.Clauses.Expressions;
+using Remotion.Linq.Clauses.Expressions;
namespace NHibernate.Linq.Visitors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/LeftJoinDetector.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/LeftJoinDetector.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/LeftJoinDetector.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using System.Linq.Expressions;
-using Remotion.Data.Linq.Clauses.Expressions;
+using Remotion.Linq.Clauses.Expressions;
namespace NHibernate.Linq.Visitors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/NameGenerator.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/NameGenerator.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/NameGenerator.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,4 +1,4 @@
-using Remotion.Data.Linq;
+using Remotion.Linq;
namespace NHibernate.Linq.Visitors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/NhThrowingExpressionTreeVisitor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/NhThrowingExpressionTreeVisitor.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/NhThrowingExpressionTreeVisitor.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,7 +1,7 @@
using System;
using System.Linq.Expressions;
using NHibernate.Linq.Expressions;
-using Remotion.Data.Linq.Parsing;
+using Remotion.Linq.Parsing;
namespace NHibernate.Linq.Visitors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/QueryModelVisitor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/QueryModelVisitor.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/QueryModelVisitor.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -7,12 +7,12 @@
using NHibernate.Linq.ResultOperators;
using NHibernate.Linq.ReWriters;
using NHibernate.Linq.Visitors.ResultOperatorProcessors;
-using Remotion.Data.Linq;
-using Remotion.Data.Linq.Clauses;
-using Remotion.Data.Linq.Clauses.Expressions;
-using Remotion.Data.Linq.Clauses.ResultOperators;
-using Remotion.Data.Linq.Clauses.StreamedData;
-using Remotion.Data.Linq.EagerFetching;
+using Remotion.Linq;
+using Remotion.Linq.Clauses;
+using Remotion.Linq.Clauses.Expressions;
+using Remotion.Linq.Clauses.ResultOperators;
+using Remotion.Linq.Clauses.StreamedData;
+using Remotion.Linq.EagerFetching;
namespace NHibernate.Linq.Visitors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/QuerySourceLocator.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/QuerySourceLocator.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/QuerySourceLocator.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,5 +1,5 @@
-using Remotion.Data.Linq;
-using Remotion.Data.Linq.Clauses;
+using Remotion.Linq;
+using Remotion.Linq.Clauses;
namespace NHibernate.Linq.Visitors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessAggregate.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessAggregate.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessAggregate.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -2,9 +2,9 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
-using Remotion.Data.Linq.Clauses.ResultOperators;
-using Remotion.Data.Linq.Clauses.StreamedData;
-using Remotion.Data.Linq.Parsing.ExpressionTreeVisitors;
+using Remotion.Linq.Clauses.ResultOperators;
+using Remotion.Linq.Clauses.StreamedData;
+using Remotion.Linq.Parsing.ExpressionTreeVisitors;
namespace NHibernate.Linq.Visitors.ResultOperatorProcessors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessAggregateFromSeed.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessAggregateFromSeed.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessAggregateFromSeed.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -4,10 +4,10 @@
using System.Linq;
using System.Linq.Expressions;
using System.Text;
-using Remotion.Data.Linq.Clauses.ExpressionTreeVisitors;
-using Remotion.Data.Linq.Clauses.ResultOperators;
-using Remotion.Data.Linq.Clauses.StreamedData;
-using Remotion.Data.Linq.Parsing.ExpressionTreeVisitors;
+using Remotion.Linq.Clauses.ExpressionTreeVisitors;
+using Remotion.Linq.Clauses.ResultOperators;
+using Remotion.Linq.Clauses.StreamedData;
+using Remotion.Linq.Parsing.ExpressionTreeVisitors;
namespace NHibernate.Linq.Visitors.ResultOperatorProcessors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessAll.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessAll.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessAll.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,5 +1,5 @@
using NHibernate.Hql.Ast;
-using Remotion.Data.Linq.Clauses.ResultOperators;
+using Remotion.Linq.Clauses.ResultOperators;
namespace NHibernate.Linq.Visitors.ResultOperatorProcessors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessAny.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessAny.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessAny.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,5 +1,5 @@
using NHibernate.Hql.Ast;
-using Remotion.Data.Linq.Clauses.ResultOperators;
+using Remotion.Linq.Clauses.ResultOperators;
namespace NHibernate.Linq.Visitors.ResultOperatorProcessors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessCast.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessCast.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessCast.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,4 +1,4 @@
-using Remotion.Data.Linq.Clauses.ResultOperators;
+using Remotion.Linq.Clauses.ResultOperators;
namespace NHibernate.Linq.Visitors.ResultOperatorProcessors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessContains.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessContains.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessContains.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,7 +1,7 @@
using System.Collections;
using System.Linq;
using NHibernate.Hql.Ast;
-using Remotion.Data.Linq.Clauses.ResultOperators;
+using Remotion.Linq.Clauses.ResultOperators;
namespace NHibernate.Linq.Visitors.ResultOperatorProcessors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessFetch.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessFetch.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessFetch.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,4 +1,4 @@
-using Remotion.Data.Linq.EagerFetching;
+using Remotion.Linq.EagerFetching;
namespace NHibernate.Linq.Visitors.ResultOperatorProcessors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessFetchMany.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessFetchMany.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessFetchMany.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,4 +1,4 @@
-using Remotion.Data.Linq.EagerFetching;
+using Remotion.Linq.EagerFetching;
namespace NHibernate.Linq.Visitors.ResultOperatorProcessors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessFetchOne.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessFetchOne.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessFetchOne.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,4 +1,4 @@
-using Remotion.Data.Linq.EagerFetching;
+using Remotion.Linq.EagerFetching;
namespace NHibernate.Linq.Visitors.ResultOperatorProcessors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessFirst.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessFirst.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessFirst.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,5 +1,5 @@
using System.Linq;
-using Remotion.Data.Linq.Clauses.ResultOperators;
+using Remotion.Linq.Clauses.ResultOperators;
namespace NHibernate.Linq.Visitors.ResultOperatorProcessors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessGroupBy.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessGroupBy.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessGroupBy.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq.Expressions;
using NHibernate.Hql.Ast;
-using Remotion.Data.Linq.Clauses.ResultOperators;
+using Remotion.Linq.Clauses.ResultOperators;
using System.Linq;
namespace NHibernate.Linq.Visitors.ResultOperatorProcessors
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessNonAggregatingGroupBy.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessNonAggregatingGroupBy.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessNonAggregatingGroupBy.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -3,7 +3,7 @@
using System.Collections.Generic;
using System.Linq.Expressions;
using NHibernate.Linq.ResultOperators;
-using Remotion.Data.Linq.Clauses.Expressions;
+using Remotion.Linq.Clauses.Expressions;
namespace NHibernate.Linq.Visitors.ResultOperatorProcessors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessOfType.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessOfType.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessOfType.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,6 +1,6 @@
using System.Linq.Expressions;
using NHibernate.Hql.Ast;
-using Remotion.Data.Linq.Clauses.ResultOperators;
+using Remotion.Linq.Clauses.ResultOperators;
namespace NHibernate.Linq.Visitors.ResultOperatorProcessors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessSingle.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessSingle.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessSingle.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,5 +1,5 @@
using System.Linq;
-using Remotion.Data.Linq.Clauses.ResultOperators;
+using Remotion.Linq.Clauses.ResultOperators;
namespace NHibernate.Linq.Visitors.ResultOperatorProcessors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessSkip.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessSkip.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessSkip.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,5 +1,5 @@
using System.Linq.Expressions;
-using Remotion.Data.Linq.Clauses.ResultOperators;
+using Remotion.Linq.Clauses.ResultOperators;
namespace NHibernate.Linq.Visitors.ResultOperatorProcessors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessTake.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessTake.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessTake.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,5 +1,5 @@
using System.Linq.Expressions;
-using Remotion.Data.Linq.Clauses.ResultOperators;
+using Remotion.Linq.Clauses.ResultOperators;
namespace NHibernate.Linq.Visitors.ResultOperatorProcessors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ResultOperatorMap.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ResultOperatorMap.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ResultOperatorMap.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using Remotion.Data.Linq.Clauses;
+using Remotion.Linq.Clauses;
namespace NHibernate.Linq.Visitors.ResultOperatorProcessors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ResultOperatorProcessor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ResultOperatorProcessor.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ResultOperatorProcessor.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,4 +1,4 @@
-using Remotion.Data.Linq.Clauses;
+using Remotion.Linq.Clauses;
namespace NHibernate.Linq.Visitors.ResultOperatorProcessors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ResultOperatorProcessorBase.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ResultOperatorProcessorBase.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ResultOperatorProcessorBase.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,4 +1,4 @@
-using Remotion.Data.Linq.Clauses;
+using Remotion.Linq.Clauses;
namespace NHibernate.Linq.Visitors.ResultOperatorProcessors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/SwapQuerySourceVisitor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/SwapQuerySourceVisitor.cs 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/SwapQuerySourceVisitor.cs 2011-04-09 16:01:06 UTC (rev 5648)
@@ -1,6 +1,6 @@
using System.Linq.Expressions;
-using Remotion.Data.Linq.Clauses;
-using Remotion.Data.Linq.Clauses.Expressions;
+using Remotion.Linq.Clauses;
+using Remotion.Linq.Clauses.Expressions;
namespace NHibernate.Linq.Visitors
{
Modified: trunk/nhibernate/src/NHibernate/NHibernate.build
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernate.build 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/NHibernate.build 2011-04-09 16:01:06 UTC (rev 5648)
@@ -24,7 +24,7 @@
<include name="System.Data.dll" />
<include name="Iesi.Collections.dll" />
<include name="Antlr3.Runtime.dll" />
- <include name="Remotion.Data.Linq.dll" />
+ <include name="Remotion.Linq.dll" />
</assemblyfileset>
<resourcefileset id="project.resources" prefix="NHibernate" dynamicprefix="true">
@@ -62,14 +62,14 @@
<arg value="/out:${bin.dir}/merged/NHibernate.dll" />
<arg value="${bin.dir}/NHibernate.dll" />
<arg value="${bin.dir}/Antlr3.Runtime.dll" />
- <arg value="${bin.dir}/Remotion.Data.Linq.dll" />
+ <arg value="${bin.dir}/Remotion.Linq.dll" />
</exec>
<move file="${bin.dir}/merged/NHibernate.dll" tofile="${bin.dir}/NHibernate.dll" />
<move file="${bin.dir}/merged/NHibernate.pdb" tofile="${bin.dir}/NHibernate.pdb" />
<delete dir="${bin.dir}/merged" />
<delete file="${bin.dir}/Antlr3.Runtime.dll" />
- <delete file="${bin.dir}/Remotion.Data.Linq.dll" />
+ <delete file="${bin.dir}/Remotion.Linq.dll" />
</if>
</target>
Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-04-08 20:12:11 UTC (rev 5647)
+++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-04-09 16:01:06 UTC (rev 5648)
@@ -78,9 +78,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\net\3.5\Iesi.Collections.dll</HintPath>
</Reference>
- <Reference Include="Remotion.Data.Linq, Version=1.13.41.2, Culture=neutral, PublicKeyToken=cab60358ab4081ea">
+ <Reference Include="Remotion.Linq, Version=1.13.100.2, Culture=neutral, PublicKeyToken=cab60358ab4081ea">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\net\3.5\Remotion.Data.Linq.dll</HintPath>
+ <HintPath>..\..\lib\net\3.5\Remotion.Linq.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Xml.Linq">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-08 20:12:18
|
Revision: 5647
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5647&view=rev
Author: fabiomaulo
Date: 2011-04-08 20:12:11 +0000 (Fri, 08 Apr 2011)
Log Message:
-----------
ExplicitlyDeclaredModel relax
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-08 17:57:05 UTC (rev 5646)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-08 20:12:11 UTC (rev 5647)
@@ -414,127 +414,132 @@
#region Implementation of IModelInspector
- public bool IsRootEntity(System.Type type)
+ public virtual bool IsRootEntity(System.Type type)
{
return rootEntities.Contains(type);
}
- public bool IsComponent(System.Type type)
+ public virtual bool IsComponent(System.Type type)
{
return components.Contains(type);
}
- public bool IsEntity(System.Type type)
+ public virtual bool IsEntity(System.Type type)
{
return rootEntities.Contains(type) || type.GetBaseTypes().Any(t => rootEntities.Contains(t)) || HasDelayedEntityRegistration(type);
}
- public bool IsTablePerClass(System.Type type)
+ public virtual bool IsTablePerClass(System.Type type)
{
ExecuteDelayedTypeRegistration(type);
return IsMappedFor(tablePerClassEntities, type);
}
- public bool IsTablePerClassSplit(System.Type type, object splitGroupId, MemberInfo member)
+ public virtual bool IsTablePerClassSplit(System.Type type, object splitGroupId, MemberInfo member)
{
return Equals(splitGroupId, GetSplitGroupFor(member));
}
- public bool IsTablePerClassHierarchy(System.Type type)
+ public virtual bool IsTablePerClassHierarchy(System.Type type)
{
ExecuteDelayedTypeRegistration(type);
return IsMappedFor(tablePerClassHierarchyEntities, type);
}
- public bool IsTablePerConcreteClass(System.Type type)
+ public virtual bool IsTablePerConcreteClass(System.Type type)
{
ExecuteDelayedTypeRegistration(type);
return IsMappedFor(tablePerConcreteClassEntities, type);
}
- public bool IsOneToOne(MemberInfo member)
+ public virtual bool IsOneToOne(MemberInfo member)
{
return oneToOneRelations.Contains(member);
}
- public bool IsManyToOne(MemberInfo member)
+ public virtual bool IsManyToOne(MemberInfo member)
{
return manyToOneRelations.Contains(member);
}
- public bool IsManyToMany(MemberInfo member)
+ public virtual bool IsManyToMany(MemberInfo member)
{
return manyToManyRelations.Contains(member);
}
- public bool IsOneToMany(MemberInfo member)
+ public virtual bool IsOneToMany(MemberInfo member)
{
return oneToManyRelations.Contains(member);
}
- public bool IsAny(MemberInfo member)
+ public virtual bool IsAny(MemberInfo member)
{
return any.Contains(member);
}
- public bool IsPersistentId(MemberInfo member)
+ public virtual bool IsPersistentId(MemberInfo member)
{
return poids.Contains(member);
}
- public bool IsVersion(MemberInfo member)
+ public virtual bool IsVersion(MemberInfo member)
{
return versionProperties.Contains(member);
}
- public bool IsMemberOfNaturalId(MemberInfo member)
+ public virtual bool IsMemberOfNaturalId(MemberInfo member)
{
return naturalIds.Contains(member);
}
- public bool IsPersistentProperty(MemberInfo member)
+ public virtual bool IsPersistentProperty(MemberInfo member)
{
return persistentMembers.Contains(member);
}
- public bool IsSet(MemberInfo role)
+ public virtual bool IsSet(MemberInfo role)
{
return sets.Contains(role);
}
- public bool IsBag(MemberInfo role)
+ public virtual bool IsBag(MemberInfo role)
{
return bags.Contains(role);
}
- public bool IsIdBag(MemberInfo role)
+ public virtual bool IsIdBag(MemberInfo role)
{
return idBags.Contains(role);
}
- public bool IsList(MemberInfo role)
+ public virtual bool IsList(MemberInfo role)
{
return lists.Contains(role);
}
- public bool IsArray(MemberInfo role)
+ public virtual bool IsArray(MemberInfo role)
{
return arrays.Contains(role);
}
- public bool IsDictionary(MemberInfo role)
+ public virtual bool IsDictionary(MemberInfo role)
{
return dictionaries.Contains(role);
}
- public bool IsProperty(MemberInfo member)
+ public virtual bool IsProperty(MemberInfo member)
{
return properties.Contains(member);
}
+ public IEnumerable<string> GetPropertiesSplits(System.Type type)
+ {
+ return GetSplitGroupsFor(type);
+ }
+
#endregion
- private System.Type GetRootEntityOrNull(System.Type entityType)
+ protected System.Type GetRootEntityOrNull(System.Type entityType)
{
if (entityType == null)
{
@@ -563,12 +568,12 @@
return isExplicitMapped || isDerived;
}
- private void EnlistTypeRegistration(System.Type type, Action<System.Type> registration)
+ protected void EnlistTypeRegistration(System.Type type, Action<System.Type> registration)
{
delayedEntityRegistrations.Add(type, registration);
}
- private void ExecuteDelayedTypeRegistration(System.Type type)
+ protected void ExecuteDelayedTypeRegistration(System.Type type)
{
Action<System.Type> registration;
if(delayedEntityRegistrations.TryGetValue(type, out registration))
@@ -578,14 +583,9 @@
}
}
- private bool HasDelayedEntityRegistration(System.Type type)
+ protected bool HasDelayedEntityRegistration(System.Type type)
{
return delayedEntityRegistrations.ContainsKey(type);
}
-
- public IEnumerable<string> GetPropertiesSplits(System.Type type)
- {
- return GetSplitGroupsFor(type);
- }
}
}
\ 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...> - 2011-04-08 17:57:11
|
Revision: 5646
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5646&view=rev
Author: fabiomaulo
Date: 2011-04-08 17:57:05 +0000 (Fri, 08 Apr 2011)
Log Message:
-----------
Multi type registration auto filter valid conformist mappings classes
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/ModelMapper.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/ConformistMappingRegistrationTests/ClassMappingRegistrationTest.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/ModelMapper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/ModelMapper.cs 2011-04-08 17:52:52 UTC (rev 5645)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/ModelMapper.cs 2011-04-08 17:57:05 UTC (rev 5646)
@@ -1645,7 +1645,7 @@
{
throw new ArgumentNullException("types");
}
- foreach (var type in types)
+ foreach (var type in types.Where(x=> typeof(IConformistHoldersProvider).IsAssignableFrom(x)))
{
AddMapping(type);
}
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/ConformistMappingRegistrationTests/ClassMappingRegistrationTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/ConformistMappingRegistrationTests/ClassMappingRegistrationTest.cs 2011-04-08 17:52:52 UTC (rev 5645)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/ConformistMappingRegistrationTests/ClassMappingRegistrationTest.cs 2011-04-08 17:57:05 UTC (rev 5646)
@@ -59,6 +59,16 @@
}
[Test]
+ public void WhenRegisterClassMappingThroughCollectionOfTypeThenFilterValidMappings()
+ {
+ var mapper = new ModelMapper();
+ mapper.Executing(x=> x.AddMappings(new[] { typeof(object), typeof(MyClassMap), typeof(MyClass) })).NotThrows();
+ var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) });
+
+ ModelIsWellFormed(hbmMapping);
+ }
+
+ [Test]
public void WhenRegisterClassMappingThroughTypeThenGetMapping()
{
var mapper = new ModelMapper();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pa...@us...> - 2011-04-08 17:52:59
|
Revision: 5645
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5645&view=rev
Author: patearl
Date: 2011-04-08 17:52:52 +0000 (Fri, 08 Apr 2011)
Log Message:
-----------
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Linq/Visitors/GroupByKeySelectorVisitor.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/NhExpressionTreeVisitor.cs
trunk/nhibernate/src/NHibernate/Linq/Visitors/SelectClauseVisitor.cs
trunk/nhibernate/src/NHibernate/NHibernate.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate/Linq/Visitors/ExpressionTreeVisitor.cs
Added: trunk/nhibernate/src/NHibernate/Linq/Visitors/ExpressionTreeVisitor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/ExpressionTreeVisitor.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/ExpressionTreeVisitor.cs 2011-04-08 17:52:52 UTC (rev 5645)
@@ -0,0 +1,160 @@
+using System;
+using System.Collections.ObjectModel;
+using System.Linq.Expressions;
+using Remotion.Data.Linq.Clauses.Expressions;
+
+namespace NHibernate.Linq.Visitors
+{
+ /// <summary>
+ /// This class is used to expose the members from the base class that get internalized when the other class is ilmerged.
+ /// We do this instead of exposing the base class directly by name, since we don't want it to be part of our public API.
+ /// </summary>
+ public class ExpressionTreeVisitor : Remotion.Data.Linq.Parsing.ExpressionTreeVisitor
+ {
+ public override ReadOnlyCollection<T> VisitAndConvert<T>(ReadOnlyCollection<T> expressions, string callerName)
+ {
+ return base.VisitAndConvert<T>(expressions, callerName);
+ }
+
+ public override T VisitAndConvert<T>(T expression, string methodName)
+ {
+ return base.VisitAndConvert<T>(expression, methodName);
+ }
+
+ protected override Expression VisitBinaryExpression(BinaryExpression expression)
+ {
+ return base.VisitBinaryExpression(expression);
+ }
+
+ protected override Expression VisitConditionalExpression(ConditionalExpression expression)
+ {
+ return base.VisitConditionalExpression(expression);
+ }
+
+ protected override Expression VisitConstantExpression(ConstantExpression expression)
+ {
+ return base.VisitConstantExpression(expression);
+ }
+
+ protected override ElementInit VisitElementInit(ElementInit elementInit)
+ {
+ return base.VisitElementInit(elementInit);
+ }
+
+ protected override ReadOnlyCollection<ElementInit> VisitElementInitList(ReadOnlyCollection<ElementInit> expressions)
+ {
+ return base.VisitElementInitList(expressions);
+ }
+
+ public override Expression VisitExpression(Expression expression)
+ {
+ return base.VisitExpression(expression);
+ }
+
+ protected override Expression VisitExtensionExpression(ExtensionExpression expression)
+ {
+ return base.VisitExtensionExpression(expression);
+ }
+
+ protected override Expression VisitInvocationExpression(InvocationExpression expression)
+ {
+ return base.VisitInvocationExpression(expression);
+ }
+
+ protected override Expression VisitLambdaExpression(LambdaExpression expression)
+ {
+ return base.VisitLambdaExpression(expression);
+ }
+
+ protected override Expression VisitListInitExpression(ListInitExpression expression)
+ {
+ return base.VisitListInitExpression(expression);
+ }
+
+ protected override MemberBinding VisitMemberAssignment(MemberAssignment memberAssigment)
+ {
+ return base.VisitMemberAssignment(memberAssigment);
+ }
+
+ protected override MemberBinding VisitMemberBinding(MemberBinding memberBinding)
+ {
+ return base.VisitMemberBinding(memberBinding);
+ }
+
+ protected override ReadOnlyCollection<MemberBinding> VisitMemberBindingList(ReadOnlyCollection<MemberBinding> expressions)
+ {
+ return base.VisitMemberBindingList(expressions);
+ }
+
+ protected override Expression VisitMemberExpression(MemberExpression expression)
+ {
+ return base.VisitMemberExpression(expression);
+ }
+
+ protected override Expression VisitMemberInitExpression(MemberInitExpression expression)
+ {
+ return base.VisitMemberInitExpression(expression);
+ }
+
+ protected override MemberBinding VisitMemberListBinding(MemberListBinding listBinding)
+ {
+ return base.VisitMemberListBinding(listBinding);
+ }
+
+ protected override MemberBinding VisitMemberMemberBinding(MemberMemberBinding binding)
+ {
+ return base.VisitMemberMemberBinding(binding);
+ }
+
+ protected override Expression VisitMethodCallExpression(MethodCallExpression expression)
+ {
+ return base.VisitMethodCallExpression(expression);
+ }
+
+ protected override Expression VisitNewArrayExpression(NewArrayExpression expression)
+ {
+ return base.VisitNewArrayExpression(expression);
+ }
+
+ protected override Expression VisitNewExpression(NewExpression expression)
+ {
+ return base.VisitNewExpression(expression);
+ }
+
+ protected override Expression VisitParameterExpression(ParameterExpression expression)
+ {
+ return base.VisitParameterExpression(expression);
+ }
+
+ protected override Expression VisitQuerySourceReferenceExpression(Remotion.Data.Linq.Clauses.Expressions.QuerySourceReferenceExpression expression)
+ {
+ return base.VisitQuerySourceReferenceExpression(expression);
+ }
+
+ protected override Expression VisitSubQueryExpression(Remotion.Data.Linq.Clauses.Expressions.SubQueryExpression expression)
+ {
+ return base.VisitSubQueryExpression(expression);
+ }
+
+ protected override Expression VisitTypeBinaryExpression(TypeBinaryExpression expression)
+ {
+ return base.VisitTypeBinaryExpression(expression);
+ }
+
+ protected override Expression VisitUnaryExpression(UnaryExpression expression)
+ {
+ return base.VisitUnaryExpression(expression);
+ }
+
+ [Obsolete]
+ protected override Expression VisitUnknownExpression(Expression expression)
+ {
+ return base.VisitUnknownExpression(expression);
+ }
+
+ protected override Expression VisitUnknownNonExtensionExpression(Expression expression)
+ {
+ return base.VisitUnknownNonExtensionExpression(expression);
+ }
+ }
+}
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/GroupByKeySelectorVisitor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/GroupByKeySelectorVisitor.cs 2011-04-08 17:19:14 UTC (rev 5644)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/GroupByKeySelectorVisitor.cs 2011-04-08 17:52:52 UTC (rev 5645)
@@ -1,6 +1,5 @@
using System.Linq.Expressions;
using Remotion.Data.Linq.Clauses.Expressions;
-using Remotion.Data.Linq.Parsing;
namespace NHibernate.Linq.Visitors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/NhExpressionTreeVisitor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/NhExpressionTreeVisitor.cs 2011-04-08 17:19:14 UTC (rev 5644)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/NhExpressionTreeVisitor.cs 2011-04-08 17:52:52 UTC (rev 5645)
@@ -1,7 +1,6 @@
using System;
using System.Linq.Expressions;
using NHibernate.Linq.Expressions;
-using Remotion.Data.Linq.Parsing;
namespace NHibernate.Linq.Visitors
{
Modified: trunk/nhibernate/src/NHibernate/Linq/Visitors/SelectClauseVisitor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/Visitors/SelectClauseVisitor.cs 2011-04-08 17:19:14 UTC (rev 5644)
+++ trunk/nhibernate/src/NHibernate/Linq/Visitors/SelectClauseVisitor.cs 2011-04-08 17:52:52 UTC (rev 5645)
@@ -4,7 +4,6 @@
using NHibernate.Hql.Ast;
using NHibernate.Linq.Expressions;
using NHibernate.Linq.Functions;
-using Remotion.Data.Linq.Parsing;
namespace NHibernate.Linq.Visitors
{
Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-04-08 17:19:14 UTC (rev 5644)
+++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-04-08 17:52:52 UTC (rev 5645)
@@ -266,6 +266,7 @@
<Compile Include="Linq\ReWriters\MoveOrderByToEndRewriter.cs" />
<Compile Include="Linq\ReWriters\ResultOperatorRewriter.cs" />
<Compile Include="Linq\ReWriters\ResultOperatorRewriterResult.cs" />
+ <Compile Include="Linq\Visitors\ExpressionTreeVisitor.cs" />
<Compile Include="Linq\Visitors\ResultOperatorProcessors\ProcessAggregateFromSeed.cs" />
<Compile Include="Loader\Loader.cs" />
<Compile Include="Loader\OuterJoinLoader.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-08 17:19:20
|
Revision: 5644
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5644&view=rev
Author: fabiomaulo
Date: 2011-04-08 17:19:14 +0000 (Fri, 08 Apr 2011)
Log Message:
-----------
Simple extension to show the mapping in console output
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/HbmMappingExtensions.cs
Added: trunk/nhibernate/src/NHibernate.Test/HbmMappingExtensions.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/HbmMappingExtensions.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/HbmMappingExtensions.cs 2011-04-08 17:19:14 UTC (rev 5644)
@@ -0,0 +1,14 @@
+using System;
+using NHibernate.Cfg.MappingSchema;
+using NHibernate.Mapping.ByCode;
+
+namespace NHibernate.Test
+{
+ public static class HbmMappingExtensions
+ {
+ public static void ShowInConsole(this HbmMapping mapping)
+ {
+ Console.WriteLine(mapping.AsString());
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-08 17:16:28 UTC (rev 5643)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-08 17:19:14 UTC (rev 5644)
@@ -398,6 +398,7 @@
<Compile Include="GenericTest\SetGeneric\SetGenericFixture.cs" />
<Compile Include="GhostProperty\Order.cs" />
<Compile Include="GhostProperty\GhostPropertyFixture.cs" />
+ <Compile Include="HbmMappingExtensions.cs" />
<Compile Include="HQL\Animal.cs" />
<Compile Include="HQL\Ast\Address.cs" />
<Compile Include="HQL\Ast\Animal.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-08 17:16:35
|
Revision: 5643
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5643&view=rev
Author: fabiomaulo
Date: 2011-04-08 17:16:28 +0000 (Fri, 08 Apr 2011)
Log Message:
-----------
Composite-elements with nested-composite-elements fix
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ComponentElementCustomizer.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/BagOfNestedComponentsWithParentTest.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ComponentElementCustomizer.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ComponentElementCustomizer.cs 2011-04-08 14:47:15 UTC (rev 5642)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ComponentElementCustomizer.cs 2011-04-08 17:16:28 UTC (rev 5643)
@@ -19,20 +19,25 @@
this.explicitDeclarationsHolder = explicitDeclarationsHolder;
this.propertyPath = propertyPath;
this.customizersHolder = customizersHolder;
+ explicitDeclarationsHolder.AddAsComponent(typeof(TComponent));
+ if (propertyPath != null)
+ {
+ explicitDeclarationsHolder.AddAsPersistentMember(propertyPath.LocalMember);
+ }
}
#region IComponentElementMapper<TComponent> Members
public void Parent<TProperty>(Expression<Func<TComponent, TProperty>> parent) where TProperty : class
{
- MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(parent);
- customizersHolder.AddCustomizer(typeof (TComponent), (IComponentAttributesMapper x) => x.Parent(member));
+ Parent(parent, x => { });
}
public void Parent<TProperty>(Expression<Func<TComponent, TProperty>> parent, Action<IComponentParentMapper> parentMapping) where TProperty : class
{
MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(parent);
customizersHolder.AddCustomizer(typeof (TComponent), (IComponentAttributesMapper x) => x.Parent(member, parentMapping));
+ explicitDeclarationsHolder.AddAsPersistentMember(member);
}
public void Update(bool consideredInUpdateQuery)
@@ -61,6 +66,8 @@
customizersHolder.AddCustomizer(new PropertyPath(propertyPath, member), mapping);
MemberInfo memberOf = TypeExtensions.DecodeMemberAccessExpressionOf(property);
customizersHolder.AddCustomizer(new PropertyPath(propertyPath, memberOf), mapping);
+ explicitDeclarationsHolder.AddAsProperty(member);
+ explicitDeclarationsHolder.AddAsProperty(memberOf);
}
public void Property<TProperty>(Expression<Func<TComponent, TProperty>> property)
@@ -83,6 +90,8 @@
customizersHolder.AddCustomizer(new PropertyPath(propertyPath, member), mapping);
MemberInfo memberOf = TypeExtensions.DecodeMemberAccessExpressionOf(property);
customizersHolder.AddCustomizer(new PropertyPath(propertyPath, memberOf), mapping);
+ explicitDeclarationsHolder.AddAsManyToOneRelation(member);
+ explicitDeclarationsHolder.AddAsManyToOneRelation(memberOf);
}
public void ManyToOne<TProperty>(Expression<Func<TComponent, TProperty>> property) where TProperty : class
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/BagOfNestedComponentsWithParentTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/BagOfNestedComponentsWithParentTest.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/BagOfNestedComponentsWithParentTest.cs 2011-04-08 17:16:28 UTC (rev 5643)
@@ -0,0 +1,122 @@
+using System.Collections.Generic;
+using System.Linq;
+using NHibernate.Cfg.MappingSchema;
+using NHibernate.Mapping.ByCode;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.MappingByCode.ExpliticMappingTests
+{
+ public class BagOfNestedComponentsWithParentTest
+ {
+ private class Person
+ {
+ public int Id { get; set; }
+ public ICollection<Address> Addresses { get; set; }
+ }
+
+ private class Address
+ {
+ public Person Owner { get; set; }
+ public string Street { get; set; }
+ public Number Number { get; set; }
+ }
+
+ private class Number
+ {
+ public Address OwnerAddress { get; set; }
+ public int Block { get; set; }
+ }
+
+ [Test]
+ public void WhenMapClasByClassThenAutodiscoverParent()
+ {
+ var mapper = new ModelMapper();
+ mapper.Component<Address>(cm =>
+ {
+ cm.ManyToOne(x => x.Owner);
+ cm.Property(x => x.Street);
+ cm.Component(x => x.Number, y => { });
+ });
+ mapper.Component<Number>(cm =>
+ {
+ cm.Component(x => x.OwnerAddress, map => { });
+ cm.Property(x => x.Block);
+ });
+ mapper.Class<Person>(cm =>
+ {
+ cm.Id(x => x.Id);
+ cm.Bag(x => x.Addresses, cp => { }, cr => { });
+ });
+ HbmMapping mapping = mapper.CompileMappingFor(new[] { typeof(Person) });
+ VerifyMapping(mapping);
+ }
+
+ [Test]
+ public void WhenMapClassWithWrongElementsThenAutodiscoverParent()
+ {
+ // In this case the user will use wrong mapping-elements as ManyToOne and Component (he should realize that it end in an infinite loop)
+ var mapper = new ModelMapper();
+ mapper.Class<Person>(cm =>
+ {
+ cm.Id(x => x.Id);
+ cm.Bag(x => x.Addresses, cp => { }, cr => cr.Component(ce =>
+ {
+ ce.ManyToOne(x => x.Owner);
+ ce.Property(x => x.Street);
+ ce.Component(x => x.Number, y =>
+ {
+ y.Component(x => x.OwnerAddress, map => { });
+ y.Property(x => x.Block);
+ });
+ }));
+ });
+ HbmMapping mapping = mapper.CompileMappingFor(new[] { typeof(Person) });
+ VerifyMapping(mapping);
+ }
+
+ [Test]
+ public void WhenMapClassElementsThenMapParent()
+ {
+ var mapper = new ModelMapper();
+ mapper.Class<Person>(cm =>
+ {
+ cm.Id(x => x.Id);
+ cm.Bag(x => x.Addresses, cp => { }, cr => cr.Component(ce =>
+ {
+ ce.Parent(x => x.Owner);
+ ce.Property(x => x.Street);
+ ce.Component(x => x.Number, y =>
+ {
+ y.Parent(x => x.OwnerAddress, map => { });
+ y.Property(x => x.Block);
+ });
+ }));
+ });
+ HbmMapping mapping = mapper.CompileMappingFor(new[] { typeof(Person) });
+ VerifyMapping(mapping);
+ }
+
+ private void VerifyMapping(HbmMapping mapping)
+ {
+ HbmClass rc = mapping.RootClasses.First(r => r.Name.Contains("Person"));
+ var relation = rc.Properties.First(p => p.Name == "Addresses");
+ var collection = (HbmBag)relation;
+ collection.ElementRelationship.Should().Be.OfType<HbmCompositeElement>();
+ var elementRelation = (HbmCompositeElement)collection.ElementRelationship;
+ elementRelation.Class.Should().Contain("Address");
+ elementRelation.Properties.Should().Have.Count.EqualTo(2);
+ elementRelation.Properties.Select(p => p.Name).Should().Have.SameValuesAs("Street", "Number");
+ elementRelation.Parent.Should().Not.Be.Null();
+ elementRelation.Parent.name.Should().Be.EqualTo("Owner");
+ // Nested
+ var propertyNestedRelation = elementRelation.Properties.FirstOrDefault(p => p.Name == "Number");
+ propertyNestedRelation.Should().Not.Be.Null().And.Be.OfType<HbmNestedCompositeElement>();
+ var nestedRelation = (HbmNestedCompositeElement) propertyNestedRelation;
+ nestedRelation.Class.Should().Contain("Number");
+ nestedRelation.Properties.Should().Have.Count.EqualTo(1);
+ nestedRelation.Parent.Should().Not.Be.Null();
+ nestedRelation.Parent.name.Should().Be.EqualTo("OwnerAddress");
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-08 14:47:15 UTC (rev 5642)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-08 17:16:28 UTC (rev 5643)
@@ -509,6 +509,7 @@
<Compile Include="Linq\ByMethod\SumTests.cs" />
<Compile Include="Logging\Log4NetLoggerTest.cs" />
<Compile Include="Logging\LoggerProviderTest.cs" />
+ <Compile Include="MappingByCode\ExpliticMappingTests\BagOfNestedComponentsWithParentTest.cs" />
<Compile Include="MappingByCode\ExpliticMappingTests\ClassWithComponentsTest.cs" />
<Compile Include="MappingByCode\ExpliticMappingTests\ConformistMappingRegistrationTests\ClassMappingRegistrationTest.cs" />
<Compile Include="MappingByCode\CustomizerHolderMergeTest.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-08 14:47:21
|
Revision: 5642
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5642&view=rev
Author: fabiomaulo
Date: 2011-04-08 14:47:15 +0000 (Fri, 08 Apr 2011)
Log Message:
-----------
-Fixed class without poid property/field
-simplified API
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/IClassMapper.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ClassCustomizer.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/IdMapper.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/BasicMappingOfSimpleClass.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/IClassMapper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/IClassMapper.cs 2011-04-08 14:13:21 UTC (rev 5641)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/IClassMapper.cs 2011-04-08 14:47:15 UTC (rev 5642)
@@ -34,7 +34,7 @@
public interface IClassAttributesMapper<TEntity> : IEntityAttributesMapper, IEntitySqlsMapper where TEntity : class
{
- void Id(Action<IIdMapper> idMapper);
+ void Id<TProperty>(Expression<Func<TEntity, TProperty>> idProperty);
void Id<TProperty>(Expression<Func<TEntity, TProperty>> idProperty, Action<IIdMapper> idMapper);
void Id(FieldInfo idProperty, Action<IIdMapper> idMapper);
void Discriminator(Action<IDiscriminatorMapper> discriminatorMapping);
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ClassCustomizer.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ClassCustomizer.cs 2011-04-08 14:13:21 UTC (rev 5641)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ClassCustomizer.cs 2011-04-08 14:47:15 UTC (rev 5642)
@@ -27,21 +27,28 @@
#region Implementation of IClassAttributesMapper<TEntity>
- public void Id(Action<IIdMapper> idMapper)
+ public void Id<TProperty>(Expression<Func<TEntity, TProperty>> idProperty)
{
- CustomizersHolder.AddCustomizer(typeof (TEntity), m => m.Id(idMapper));
+ Id(idProperty, x => { });
}
public void Id<TProperty>(Expression<Func<TEntity, TProperty>> idProperty, Action<IIdMapper> idMapper)
{
- MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(idProperty);
- ExplicitDeclarationsHolder.AddAsPoid(member);
+ MemberInfo member = null;
+ if (idProperty != null)
+ {
+ member = TypeExtensions.DecodeMemberAccessExpression(idProperty);
+ ExplicitDeclarationsHolder.AddAsPoid(member);
+ }
CustomizersHolder.AddCustomizer(typeof (TEntity), m => m.Id(member, idMapper));
}
public void Id(FieldInfo idProperty, Action<IIdMapper> idMapper)
{
- ExplicitDeclarationsHolder.AddAsPoid(idProperty);
+ if (idProperty != null)
+ {
+ ExplicitDeclarationsHolder.AddAsPoid(idProperty);
+ }
CustomizersHolder.AddCustomizer(typeof(TEntity), m => m.Id(idProperty, idMapper));
}
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/IdMapper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/IdMapper.cs 2011-04-08 14:13:21 UTC (rev 5641)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/IdMapper.cs 2011-04-08 14:47:15 UTC (rev 5642)
@@ -75,6 +75,11 @@
private void ApplyGenerator(IGeneratorDef generator)
{
var hbmGenerator = new HbmGenerator {@class = generator.Class};
+ if(hbmId.name == null)
+ {
+ // no member for the id
+ hbmId.type1 = generator.DefaultReturnType.GetNhTypeName();
+ }
object generatorParameters = generator.Params;
if (generatorParameters != null)
{
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/BasicMappingOfSimpleClass.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/BasicMappingOfSimpleClass.cs 2011-04-08 14:13:21 UTC (rev 5641)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/BasicMappingOfSimpleClass.cs 2011-04-08 14:47:15 UTC (rev 5642)
@@ -1,3 +1,4 @@
+using System;
using System.Linq;
using NHibernate.Cfg.MappingSchema;
using NHibernate.Mapping.ByCode;
@@ -32,6 +33,24 @@
}
[Test]
+ public void WhenMapClassWithoutIdThenApplyTypeOfGeneratorDef()
+ {
+ var mapper = new ModelMapper();
+ mapper.Class<MyClass>(ca => ca.Id(null, map =>
+ {
+ map.Column("MyClassId");
+ map.Generator(Generators.HighLow, gmap => gmap.Params(new { max_low = 100 }));
+ }));
+ var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) });
+ var hbmClass = hbmMapping.RootClasses[0];
+ hbmClass.Should().Not.Be.Null();
+ var hbmId = hbmClass.Id;
+ hbmId.Should().Not.Be.Null();
+ hbmId.column1.Should().Be("MyClassId");
+ hbmId.type1.Should().Be(NHibernateUtil.Int32.Name);
+ }
+
+ [Test]
public void WhenDuplicatePropertiesDoesNotDuplicateMapping()
{
var mapper = new ModelMapper();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-08 14:13:27
|
Revision: 5641
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5641&view=rev
Author: fabiomaulo
Date: 2011-04-08 14:13:21 +0000 (Fri, 08 Apr 2011)
Log Message:
-----------
Fix NH-2633
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/FakeModelExplicitDeclarationsHolder.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/IModelExplicitDeclarationsHolder.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ComponentCustomizer.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/ExplicitDeclarationsHolder.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/ModelExplicitDeclarationsHolderExtensions.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ModelExplicitDeclarationsHolderMergeTest.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/ClassWithComponentsTest.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-08 05:48:54 UTC (rev 5640)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-08 14:13:21 UTC (rev 5641)
@@ -19,9 +19,9 @@
private readonly HashSet<MemberInfo> naturalIds = new HashSet<MemberInfo>();
private readonly HashSet<MemberInfo> oneToManyRelations = new HashSet<MemberInfo>();
private readonly HashSet<MemberInfo> oneToOneRelations = new HashSet<MemberInfo>();
- private readonly HashSet<MemberInfo> persistentProperties = new HashSet<MemberInfo>();
private readonly HashSet<MemberInfo> poids = new HashSet<MemberInfo>();
private readonly HashSet<MemberInfo> properties = new HashSet<MemberInfo>();
+ private readonly HashSet<MemberInfo> persistentMembers = new HashSet<MemberInfo>();
private readonly HashSet<System.Type> rootEntities = new HashSet<System.Type>();
private readonly HashSet<MemberInfo> sets = new HashSet<MemberInfo>();
private readonly HashSet<System.Type> tablePerClassEntities = new HashSet<System.Type>();
@@ -135,6 +135,11 @@
get { return properties; }
}
+ public IEnumerable<MemberInfo> PersistentMembers
+ {
+ get { return persistentMembers; }
+ }
+
public IEnumerable<SplitDefinition> SplitDefinitions
{
get { return splitDefinitions; }
@@ -284,94 +289,99 @@
public void AddAsOneToOneRelation(MemberInfo member)
{
- persistentProperties.Add(member);
+ persistentMembers.Add(member);
oneToOneRelations.Add(member);
}
public void AddAsManyToOneRelation(MemberInfo member)
{
- persistentProperties.Add(member);
+ persistentMembers.Add(member);
manyToOneRelations.Add(member);
}
public void AddAsManyToManyRelation(MemberInfo member)
{
- persistentProperties.Add(member);
+ persistentMembers.Add(member);
manyToManyRelations.Add(member);
}
public void AddAsOneToManyRelation(MemberInfo member)
{
- persistentProperties.Add(member);
+ persistentMembers.Add(member);
oneToManyRelations.Add(member);
}
public void AddAsAny(MemberInfo member)
{
- persistentProperties.Add(member);
+ persistentMembers.Add(member);
any.Add(member);
}
public void AddAsPoid(MemberInfo member)
{
- persistentProperties.Add(member);
+ persistentMembers.Add(member);
poids.Add(member);
}
public void AddAsVersionProperty(MemberInfo member)
{
- persistentProperties.Add(member);
+ persistentMembers.Add(member);
versionProperties.Add(member);
}
public void AddAsNaturalId(MemberInfo member)
{
- persistentProperties.Add(member);
+ persistentMembers.Add(member);
naturalIds.Add(member);
}
public void AddAsSet(MemberInfo member)
{
- persistentProperties.Add(member);
+ persistentMembers.Add(member);
sets.Add(member);
}
public void AddAsBag(MemberInfo member)
{
- persistentProperties.Add(member);
+ persistentMembers.Add(member);
bags.Add(member);
}
public void AddAsIdBag(MemberInfo member)
{
- persistentProperties.Add(member);
+ persistentMembers.Add(member);
idBags.Add(member);
}
public void AddAsList(MemberInfo member)
{
- persistentProperties.Add(member);
+ persistentMembers.Add(member);
lists.Add(member);
}
public void AddAsArray(MemberInfo member)
{
- persistentProperties.Add(member);
+ persistentMembers.Add(member);
arrays.Add(member);
}
public void AddAsMap(MemberInfo member)
{
- persistentProperties.Add(member);
+ persistentMembers.Add(member);
dictionaries.Add(member);
}
public void AddAsProperty(MemberInfo member)
{
- persistentProperties.Add(member);
+ persistentMembers.Add(member);
properties.Add(member);
}
+ public void AddAsPersistentMember(MemberInfo member)
+ {
+ persistentMembers.Add(member);
+ }
+
public void AddAsPropertySplit(System.Type propertyContainer, string splitGroupId, MemberInfo member)
{
/* Note: if the user "jump/exclude" a class and then map the property in two subclasses the usage of GetMemberFromDeclaringType() may cause a problem
@@ -484,7 +494,7 @@
public bool IsPersistentProperty(MemberInfo member)
{
- return persistentProperties.Contains(member);
+ return persistentMembers.Contains(member);
}
public bool IsSet(MemberInfo role)
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/FakeModelExplicitDeclarationsHolder.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/FakeModelExplicitDeclarationsHolder.cs 2011-04-08 05:48:54 UTC (rev 5640)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/FakeModelExplicitDeclarationsHolder.cs 2011-04-08 14:13:21 UTC (rev 5641)
@@ -21,6 +21,7 @@
private readonly IEnumerable<MemberInfo> oneToOneRelations = Enumerable.Empty<MemberInfo>();
private readonly IEnumerable<MemberInfo> poids = Enumerable.Empty<MemberInfo>();
private readonly IEnumerable<MemberInfo> properties = Enumerable.Empty<MemberInfo>();
+ private readonly IEnumerable<MemberInfo> persistentMembers = new HashSet<MemberInfo>();
private readonly IEnumerable<System.Type> rootEntities = Enumerable.Empty<System.Type>();
private readonly IEnumerable<MemberInfo> sets = Enumerable.Empty<MemberInfo>();
private readonly IEnumerable<System.Type> tablePerClassEntities = Enumerable.Empty<System.Type>();
@@ -137,6 +138,11 @@
get { return properties; }
}
+ public IEnumerable<MemberInfo> PersistentMembers
+ {
+ get { return persistentMembers; }
+ }
+
public IEnumerable<SplitDefinition> SplitDefinitions
{
get { return splitDefinitions; }
@@ -193,6 +199,8 @@
public void AddAsMap(MemberInfo member) {}
public void AddAsProperty(MemberInfo member) {}
+ public void AddAsPersistentMember(MemberInfo member){}
+
public void AddAsPropertySplit(System.Type propertyContainer, string splitGroupId, MemberInfo member) {}
#endregion
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/IModelExplicitDeclarationsHolder.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/IModelExplicitDeclarationsHolder.cs 2011-04-08 05:48:54 UTC (rev 5640)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/IModelExplicitDeclarationsHolder.cs 2011-04-08 14:13:21 UTC (rev 5641)
@@ -42,6 +42,7 @@
IEnumerable<MemberInfo> Arrays { get; }
IEnumerable<MemberInfo> Dictionaries { get; }
IEnumerable<MemberInfo> Properties { get; }
+ IEnumerable<MemberInfo> PersistentMembers { get; }
IEnumerable<SplitDefinition> SplitDefinitions { get; }
IEnumerable<string> GetSplitGroupsFor(System.Type type);
@@ -70,6 +71,7 @@
void AddAsArray(MemberInfo member);
void AddAsMap(MemberInfo member);
void AddAsProperty(MemberInfo member);
+ void AddAsPersistentMember(MemberInfo member);
void AddAsPropertySplit(System.Type propertyContainer, string splitGroupId, MemberInfo member);
}
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ComponentCustomizer.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ComponentCustomizer.cs 2011-04-08 05:48:54 UTC (rev 5640)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ComponentCustomizer.cs 2011-04-08 14:13:21 UTC (rev 5641)
@@ -25,6 +25,10 @@
throw new ArgumentNullException("explicitDeclarationsHolder");
}
explicitDeclarationsHolder.AddAsComponent(typeof (TComponent));
+ if(propertyPath != null)
+ {
+ explicitDeclarationsHolder.AddAsPersistentMember(propertyPath.LocalMember);
+ }
}
#region Implementation of IComponentMapper<TComponent>
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/ExplicitDeclarationsHolder.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/ExplicitDeclarationsHolder.cs 2011-04-08 05:48:54 UTC (rev 5640)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/ExplicitDeclarationsHolder.cs 2011-04-08 14:13:21 UTC (rev 5641)
@@ -1,3 +1,4 @@
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
@@ -20,6 +21,7 @@
private readonly HashSet<MemberInfo> oneToOneRelations = new HashSet<MemberInfo>();
private readonly HashSet<MemberInfo> poids = new HashSet<MemberInfo>();
private readonly HashSet<MemberInfo> properties = new HashSet<MemberInfo>();
+ private readonly HashSet<MemberInfo> persistentMembers = new HashSet<MemberInfo>();
private readonly HashSet<System.Type> rootEntities = new HashSet<System.Type>();
private readonly HashSet<MemberInfo> sets = new HashSet<MemberInfo>();
private readonly HashSet<SplitDefinition> splitDefinitions = new HashSet<SplitDefinition>();
@@ -130,6 +132,11 @@
get { return properties; }
}
+ public IEnumerable<MemberInfo> PersistentMembers
+ {
+ get { return persistentMembers; }
+ }
+
public IEnumerable<SplitDefinition> SplitDefinitions
{
get { return splitDefinitions; }
@@ -245,6 +252,11 @@
properties.Add(member);
}
+ public void AddAsPersistentMember(MemberInfo member)
+ {
+ persistentMembers.Add(member);
+ }
+
public void AddAsPropertySplit(System.Type propertyContainer, string splitGroupId, MemberInfo member)
{
splitDefinitions.Add(new SplitDefinition(propertyContainer, splitGroupId, member));
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/ModelExplicitDeclarationsHolderExtensions.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/ModelExplicitDeclarationsHolderExtensions.cs 2011-04-08 05:48:54 UTC (rev 5640)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/ModelExplicitDeclarationsHolderExtensions.cs 2011-04-08 14:13:21 UTC (rev 5641)
@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
using System.Linq;
-using System.Reflection;
namespace NHibernate.Mapping.ByCode
{
@@ -37,6 +34,7 @@
System.Array.ForEach(source.Arrays.ToArray(), destination.AddAsArray);
System.Array.ForEach(source.Dictionaries.ToArray(), destination.AddAsMap);
System.Array.ForEach(source.Properties.ToArray(), destination.AddAsProperty);
+ System.Array.ForEach(source.PersistentMembers.ToArray(), destination.AddAsPersistentMember);
System.Array.ForEach(source.SplitDefinitions.ToArray(), x => destination.AddAsPropertySplit(x.On, x.GroupId, x.Member));
}
}
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/ClassWithComponentsTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/ClassWithComponentsTest.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/ClassWithComponentsTest.cs 2011-04-08 14:13:21 UTC (rev 5641)
@@ -0,0 +1,61 @@
+using System;
+using System.Linq;
+using NHibernate.Cfg.MappingSchema;
+using NHibernate.Mapping.ByCode;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.MappingByCode.ExpliticMappingTests
+{
+ public class ClassWithComponentsTest
+ {
+ public class Person1
+ {
+ public int Id { get; set; }
+ public string Test { get; set; }
+ public Name Name { get; set; }
+ public Address Address { get; set; }
+ }
+ public class Name
+ {
+ public string First { get; set; }
+ public string Last { get; set; }
+ }
+
+ public class Address
+ {
+ public string Street { get; set; }
+ public int CivicNumber { get; set; }
+ }
+ [Test]
+ public void ComponentMappingJustOnceDemo()
+ {
+ var mapper = new ModelMapper();
+ mapper.Component<Name>(comp =>
+ {
+ comp.Property(name => name.First);
+ comp.Property(name => name.Last);
+ });
+ mapper.Component<Address>(comp =>
+ {
+ comp.Property(address => address.CivicNumber);
+ comp.Property(address => address.Street);
+ });
+ mapper.Class<Person1>(cm =>
+ {
+ cm.Id(person => person.Id, map => map.Generator(Generators.HighLow));
+ cm.Property(person => person.Test);
+ cm.Component(person => person.Name, comp => { });
+ cm.Component(person => person.Address, comp => { });
+ });
+
+ var hbmMapping = mapper.CompileMappingForAllExplicitAddedEntities();
+
+ var hbmClass = hbmMapping.RootClasses[0];
+
+ var hbmComponents = hbmClass.Properties.OfType<HbmComponent>();
+ hbmComponents.Should().Have.Count.EqualTo(2);
+ hbmComponents.Select(x => x.Name).Should().Have.SameValuesAs("Name","Address");
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ModelExplicitDeclarationsHolderMergeTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ModelExplicitDeclarationsHolderMergeTest.cs 2011-04-08 05:48:54 UTC (rev 5640)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ModelExplicitDeclarationsHolderMergeTest.cs 2011-04-08 14:13:21 UTC (rev 5641)
@@ -29,6 +29,17 @@
}
[Test]
+ public void MergePersistentMembers()
+ {
+ var destination = new ExplicitDeclarationsHolder();
+ var source = new ExplicitDeclarationsHolder();
+ source.AddAsPersistentMember(property);
+
+ destination.Merge(source);
+ destination.PersistentMembers.Should().Have.Count.EqualTo(1);
+ }
+
+ [Test]
public void MergeProperties()
{
var destination = new ExplicitDeclarationsHolder();
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-08 05:48:54 UTC (rev 5640)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-08 14:13:21 UTC (rev 5641)
@@ -509,6 +509,7 @@
<Compile Include="Linq\ByMethod\SumTests.cs" />
<Compile Include="Logging\Log4NetLoggerTest.cs" />
<Compile Include="Logging\LoggerProviderTest.cs" />
+ <Compile Include="MappingByCode\ExpliticMappingTests\ClassWithComponentsTest.cs" />
<Compile Include="MappingByCode\ExpliticMappingTests\ConformistMappingRegistrationTests\ClassMappingRegistrationTest.cs" />
<Compile Include="MappingByCode\CustomizerHolderMergeTest.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\SplitPropertiesRegistrationTests.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-08 05:49:01
|
Revision: 5640
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5640&view=rev
Author: fabiomaulo
Date: 2011-04-08 05:48:54 +0000 (Fri, 08 Apr 2011)
Log Message:
-----------
Minor relax
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Linq/DefaultQueryProvider.cs
trunk/nhibernate/src/NHibernate/Linq/LinqExtensionMethods.cs
Modified: trunk/nhibernate/src/NHibernate/Linq/DefaultQueryProvider.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/DefaultQueryProvider.cs 2011-04-08 05:38:39 UTC (rev 5639)
+++ trunk/nhibernate/src/NHibernate/Linq/DefaultQueryProvider.cs 2011-04-08 05:48:54 UTC (rev 5640)
@@ -9,8 +9,14 @@
namespace NHibernate.Linq
{
- public class DefaultQueryProvider : IQueryProvider
+ public interface INhQueryProvider : IQueryProvider
{
+ object ExecuteFuture(Expression expression);
+ void SetResultTransformerAndAdditionalCriteria(IQuery query, NhLinqExpression nhExpression, IDictionary<string, Tuple<object, IType>> parameters);
+ }
+
+ public class DefaultQueryProvider : INhQueryProvider
+ {
public DefaultQueryProvider(ISessionImplementor session)
{
Session = session;
@@ -34,14 +40,14 @@
return (TResult) Execute(expression);
}
- public IQueryable CreateQuery(Expression expression)
+ public virtual IQueryable CreateQuery(Expression expression)
{
MethodInfo m = ReflectionHelper.GetMethodDefinition((DefaultQueryProvider p) => p.CreateQuery<object>(null)).MakeGenericMethod(expression.Type.GetGenericArguments()[0]);
return (IQueryable) m.Invoke(this, new[] {expression});
}
- public IQueryable<T> CreateQuery<T>(Expression expression)
+ public virtual IQueryable<T> CreateQuery<T>(Expression expression)
{
return new NhQueryable<T>(this, expression);
}
Modified: trunk/nhibernate/src/NHibernate/Linq/LinqExtensionMethods.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/LinqExtensionMethods.cs 2011-04-08 05:38:39 UTC (rev 5639)
+++ trunk/nhibernate/src/NHibernate/Linq/LinqExtensionMethods.cs 2011-04-08 05:48:54 UTC (rev 5640)
@@ -53,7 +53,7 @@
throw new NotSupportedException("You can also use the AsFuture() method on NhQueryable");
- var future = ((DefaultQueryProvider)nhQueryable.Provider).ExecuteFuture(nhQueryable.Expression);
+ var future = ((INhQueryProvider)nhQueryable.Provider).ExecuteFuture(nhQueryable.Expression);
return (IEnumerable<T>)future;
}
@@ -63,7 +63,7 @@
if (nhQueryable == null)
throw new NotSupportedException("You can also use the AsFuture() method on NhQueryable");
- var future = ((DefaultQueryProvider)nhQueryable.Provider).ExecuteFuture(nhQueryable.Expression);
+ var future = ((INhQueryProvider)nhQueryable.Provider).ExecuteFuture(nhQueryable.Expression);
if(future is DelayedEnumerator<T>)
{
return new FutureValue<T>(() => ((IEnumerable<T>) future));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-08 05:38:45
|
Revision: 5639
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5639&view=rev
Author: fabiomaulo
Date: 2011-04-08 05:38:39 +0000 (Fri, 08 Apr 2011)
Log Message:
-----------
Relax DefaultQueryProvider
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Linq/DefaultQueryProvider.cs
Modified: trunk/nhibernate/src/NHibernate/Linq/DefaultQueryProvider.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/DefaultQueryProvider.cs 2011-04-08 05:28:16 UTC (rev 5638)
+++ trunk/nhibernate/src/NHibernate/Linq/DefaultQueryProvider.cs 2011-04-08 05:38:39 UTC (rev 5639)
@@ -11,16 +11,16 @@
{
public class DefaultQueryProvider : IQueryProvider
{
- private readonly ISessionImplementor _session;
-
public DefaultQueryProvider(ISessionImplementor session)
{
- _session = session;
+ Session = session;
}
+ protected virtual ISessionImplementor Session { get; private set; }
+
#region IQueryProvider Members
- public object Execute(Expression expression)
+ public virtual object Execute(Expression expression)
{
IQuery query;
NhLinqExpression nhQuery;
@@ -48,7 +48,7 @@
#endregion
- public object ExecuteFuture(Expression expression)
+ public virtual object ExecuteFuture(Expression expression)
{
IQuery query;
NhLinqExpression nhQuery;
@@ -56,11 +56,11 @@
return ExecuteFutureQuery(nhLinqExpression, query, nhQuery);
}
- private NhLinqExpression PrepareQuery(Expression expression, out IQuery query, out NhLinqExpression nhQuery)
+ protected NhLinqExpression PrepareQuery(Expression expression, out IQuery query, out NhLinqExpression nhQuery)
{
var nhLinqExpression = new NhLinqExpression(expression);
- query = _session.CreateQuery(nhLinqExpression);
+ query = Session.CreateQuery(nhLinqExpression);
nhQuery = query.As<ExpressionQueryImpl>().QueryExpression.As<NhLinqExpression>();
@@ -69,7 +69,7 @@
return nhLinqExpression;
}
- private object ExecuteFutureQuery(NhLinqExpression nhLinqExpression, IQuery query, NhLinqExpression nhQuery)
+ protected virtual object ExecuteFutureQuery(NhLinqExpression nhLinqExpression, IQuery query, NhLinqExpression nhQuery)
{
MethodInfo method;
if (nhLinqExpression.ReturnType == NhLinqExpressionReturnType.Sequence)
@@ -92,7 +92,7 @@
return result;
}
- private object ExecuteQuery(NhLinqExpression nhLinqExpression, IQuery query, NhLinqExpression nhQuery)
+ protected virtual object ExecuteQuery(NhLinqExpression nhLinqExpression, IQuery query, NhLinqExpression nhQuery)
{
IList results = query.List();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-08 05:28:22
|
Revision: 5638
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5638&view=rev
Author: fabiomaulo
Date: 2011-04-08 05:28:16 +0000 (Fri, 08 Apr 2011)
Log Message:
-----------
Minor (reformatting)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Linq/DefaultQueryProvider.cs
Modified: trunk/nhibernate/src/NHibernate/Linq/DefaultQueryProvider.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/DefaultQueryProvider.cs 2011-04-08 05:24:48 UTC (rev 5637)
+++ trunk/nhibernate/src/NHibernate/Linq/DefaultQueryProvider.cs 2011-04-08 05:28:16 UTC (rev 5638)
@@ -1,4 +1,3 @@
-using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
@@ -19,159 +18,160 @@
_session = session;
}
+ #region IQueryProvider Members
+
public object Execute(Expression expression)
{
- IQuery query;
- NhLinqExpression nhQuery;
- NhLinqExpression nhLinqExpression = PrepareQuery(expression, out query, out nhQuery);
-
+ IQuery query;
+ NhLinqExpression nhQuery;
+ NhLinqExpression nhLinqExpression = PrepareQuery(expression, out query, out nhQuery);
+
return ExecuteQuery(nhLinqExpression, query, nhQuery);
}
- public object ExecuteFuture(Expression expression)
- {
- IQuery query;
- NhLinqExpression nhQuery;
- NhLinqExpression nhLinqExpression = PrepareQuery(expression, out query, out nhQuery);
- return ExecuteFutureQuery(nhLinqExpression, query, nhQuery);
- }
+ public TResult Execute<TResult>(Expression expression)
+ {
+ return (TResult) Execute(expression);
+ }
- private NhLinqExpression PrepareQuery(Expression expression, out IQuery query, out NhLinqExpression nhQuery)
- {
- var nhLinqExpression = new NhLinqExpression(expression);
+ public IQueryable CreateQuery(Expression expression)
+ {
+ MethodInfo m = ReflectionHelper.GetMethodDefinition((DefaultQueryProvider p) => p.CreateQuery<object>(null)).MakeGenericMethod(expression.Type.GetGenericArguments()[0]);
- query = _session.CreateQuery(nhLinqExpression);
+ return (IQueryable) m.Invoke(this, new[] {expression});
+ }
- nhQuery = query.As<ExpressionQueryImpl>().QueryExpression.As<NhLinqExpression>();
+ public IQueryable<T> CreateQuery<T>(Expression expression)
+ {
+ return new NhQueryable<T>(this, expression);
+ }
- SetParameters(query, nhLinqExpression.ParameterValuesByName);
- SetResultTransformerAndAdditionalCriteria(query, nhQuery, nhLinqExpression.ParameterValuesByName);
- return nhLinqExpression;
- }
+ #endregion
- private object ExecuteFutureQuery(NhLinqExpression nhLinqExpression, IQuery query, NhLinqExpression nhQuery)
- {
- MethodInfo method;
- if (nhLinqExpression.ReturnType == NhLinqExpressionReturnType.Sequence)
- {
- method = typeof (IQuery).GetMethod("Future").MakeGenericMethod(nhQuery.Type);
- }
- else
- {
- method = typeof(IQuery).GetMethod("FutureValue").MakeGenericMethod(nhQuery.Type);
- }
+ public object ExecuteFuture(Expression expression)
+ {
+ IQuery query;
+ NhLinqExpression nhQuery;
+ NhLinqExpression nhLinqExpression = PrepareQuery(expression, out query, out nhQuery);
+ return ExecuteFutureQuery(nhLinqExpression, query, nhQuery);
+ }
- var result = method.Invoke(query, new object[0]);
+ private NhLinqExpression PrepareQuery(Expression expression, out IQuery query, out NhLinqExpression nhQuery)
+ {
+ var nhLinqExpression = new NhLinqExpression(expression);
+ query = _session.CreateQuery(nhLinqExpression);
-
- if (nhQuery.ExpressionToHqlTranslationResults.PostExecuteTransformer != null)
- {
- ((IDelayedValue) result).ExecuteOnEval = nhQuery.ExpressionToHqlTranslationResults.PostExecuteTransformer;
- }
+ nhQuery = query.As<ExpressionQueryImpl>().QueryExpression.As<NhLinqExpression>();
- return result;
+ SetParameters(query, nhLinqExpression.ParameterValuesByName);
+ SetResultTransformerAndAdditionalCriteria(query, nhQuery, nhLinqExpression.ParameterValuesByName);
+ return nhLinqExpression;
+ }
- }
+ private object ExecuteFutureQuery(NhLinqExpression nhLinqExpression, IQuery query, NhLinqExpression nhQuery)
+ {
+ MethodInfo method;
+ if (nhLinqExpression.ReturnType == NhLinqExpressionReturnType.Sequence)
+ {
+ method = typeof (IQuery).GetMethod("Future").MakeGenericMethod(nhQuery.Type);
+ }
+ else
+ {
+ method = typeof (IQuery).GetMethod("FutureValue").MakeGenericMethod(nhQuery.Type);
+ }
- private object ExecuteQuery(NhLinqExpression nhLinqExpression, IQuery query, NhLinqExpression nhQuery)
- {
- var results = query.List();
+ object result = method.Invoke(query, new object[0]);
- if (nhQuery.ExpressionToHqlTranslationResults.PostExecuteTransformer != null)
- {
- try
- {
- return nhQuery.ExpressionToHqlTranslationResults.PostExecuteTransformer.DynamicInvoke(results.AsQueryable());
- }
- catch (TargetInvocationException e)
- {
- throw e.InnerException;
- }
- }
- if (nhLinqExpression.ReturnType == NhLinqExpressionReturnType.Sequence)
- {
- return results.AsQueryable();
- }
+ if (nhQuery.ExpressionToHqlTranslationResults.PostExecuteTransformer != null)
+ {
+ ((IDelayedValue) result).ExecuteOnEval = nhQuery.ExpressionToHqlTranslationResults.PostExecuteTransformer;
+ }
- return results[0];
- }
-
- public TResult Execute<TResult>(Expression expression)
- {
- return (TResult) Execute(expression);
+ return result;
}
- public IQueryable CreateQuery(Expression expression)
+ private object ExecuteQuery(NhLinqExpression nhLinqExpression, IQuery query, NhLinqExpression nhQuery)
{
- var m = ReflectionHelper.GetMethodDefinition((DefaultQueryProvider p) => p.CreateQuery<object>(null)).MakeGenericMethod(expression.Type.GetGenericArguments()[0]);
+ IList results = query.List();
- return (IQueryable) m.Invoke(this, new[] {expression});
- }
+ if (nhQuery.ExpressionToHqlTranslationResults.PostExecuteTransformer != null)
+ {
+ try
+ {
+ return nhQuery.ExpressionToHqlTranslationResults.PostExecuteTransformer.DynamicInvoke(results.AsQueryable());
+ }
+ catch (TargetInvocationException e)
+ {
+ throw e.InnerException;
+ }
+ }
- public IQueryable<T> CreateQuery<T>(Expression expression)
- {
- return new NhQueryable<T>(this, expression);
+ if (nhLinqExpression.ReturnType == NhLinqExpressionReturnType.Sequence)
+ {
+ return results.AsQueryable();
+ }
+
+ return results[0];
}
- static void SetParameters(IQuery query, IDictionary<string, Tuple<object, IType>> parameters)
+ private static void SetParameters(IQuery query, IDictionary<string, Tuple<object, IType>> parameters)
{
- foreach (var parameterName in query.NamedParameters)
+ foreach (string parameterName in query.NamedParameters)
{
- var param = parameters[parameterName];
+ Tuple<object, IType> param = parameters[parameterName];
- if (param.First == null)
- {
- if (typeof(ICollection).IsAssignableFrom(param.Second.ReturnedClass))
- {
- query.SetParameterList(parameterName, null, param.Second);
- }
- else
- {
- query.SetParameter(parameterName, null, param.Second);
- }
- }
- else
- {
- if (param.First is ICollection)
- {
- query.SetParameterList(parameterName, (ICollection) param.First);
- }
- else if (param.Second != null)
- {
- query.SetParameter(parameterName, param.First, param.Second);
- }
- else
- {
- query.SetParameter(parameterName, param.First);
- }
- }
+ if (param.First == null)
+ {
+ if (typeof (ICollection).IsAssignableFrom(param.Second.ReturnedClass))
+ {
+ query.SetParameterList(parameterName, null, param.Second);
+ }
+ else
+ {
+ query.SetParameter(parameterName, null, param.Second);
+ }
+ }
+ else
+ {
+ if (param.First is ICollection)
+ {
+ query.SetParameterList(parameterName, (ICollection) param.First);
+ }
+ else if (param.Second != null)
+ {
+ query.SetParameter(parameterName, param.First, param.Second);
+ }
+ else
+ {
+ query.SetParameter(parameterName, param.First);
+ }
+ }
}
}
- public void SetResultTransformerAndAdditionalCriteria(IQuery query, NhLinqExpression nhExpression, IDictionary<string, Tuple<object, IType>> parameters)
- {
- query.SetResultTransformer(nhExpression.ExpressionToHqlTranslationResults.ResultTransformer);
+ public void SetResultTransformerAndAdditionalCriteria(IQuery query, NhLinqExpression nhExpression, IDictionary<string, Tuple<object, IType>> parameters)
+ {
+ query.SetResultTransformer(nhExpression.ExpressionToHqlTranslationResults.ResultTransformer);
- foreach (var criteria in nhExpression.ExpressionToHqlTranslationResults.AdditionalCriteria)
- {
- criteria(query, parameters);
- }
- }
+ foreach (var criteria in nhExpression.ExpressionToHqlTranslationResults.AdditionalCriteria)
+ {
+ criteria(query, parameters);
+ }
+ }
}
- public class Tuple<T1, T2>
- {
- public T1 First { get; set; }
- public T2 Second { get; set; }
-
- }
+ public class Tuple<T1, T2>
+ {
+ public T1 First { get; set; }
+ public T2 Second { get; set; }
+ }
- public class Tuple<T1, T2, T3>
- {
- public T1 First { get; set; }
- public T2 Second { get; set; }
- public T3 Third { get; set; }
- }
+ public class Tuple<T1, T2, T3>
+ {
+ public T1 First { get; set; }
+ public T2 Second { get; set; }
+ public T3 Third { get; set; }
+ }
}
\ 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...> - 2011-04-08 05:24:55
|
Revision: 5637
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5637&view=rev
Author: fabiomaulo
Date: 2011-04-08 05:24:48 +0000 (Fri, 08 Apr 2011)
Log Message:
-----------
Minor refactoring (class renaming thinking in NH-2611)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Linq/LinqExtensionMethods.cs
trunk/nhibernate/src/NHibernate/Linq/NhQueryable.cs
trunk/nhibernate/src/NHibernate/NHibernate.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate/Linq/DefaultQueryProvider.cs
Removed Paths:
-------------
trunk/nhibernate/src/NHibernate/Linq/NhQueryProvider.cs
Copied: trunk/nhibernate/src/NHibernate/Linq/DefaultQueryProvider.cs (from rev 5634, trunk/nhibernate/src/NHibernate/Linq/NhQueryProvider.cs)
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/DefaultQueryProvider.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/Linq/DefaultQueryProvider.cs 2011-04-08 05:24:48 UTC (rev 5637)
@@ -0,0 +1,177 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Reflection;
+using NHibernate.Engine;
+using NHibernate.Impl;
+using NHibernate.Type;
+
+namespace NHibernate.Linq
+{
+ public class DefaultQueryProvider : IQueryProvider
+ {
+ private readonly ISessionImplementor _session;
+
+ public DefaultQueryProvider(ISessionImplementor session)
+ {
+ _session = session;
+ }
+
+ public object Execute(Expression expression)
+ {
+ IQuery query;
+ NhLinqExpression nhQuery;
+ NhLinqExpression nhLinqExpression = PrepareQuery(expression, out query, out nhQuery);
+
+ return ExecuteQuery(nhLinqExpression, query, nhQuery);
+ }
+
+ public object ExecuteFuture(Expression expression)
+ {
+ IQuery query;
+ NhLinqExpression nhQuery;
+ NhLinqExpression nhLinqExpression = PrepareQuery(expression, out query, out nhQuery);
+ return ExecuteFutureQuery(nhLinqExpression, query, nhQuery);
+ }
+
+ private NhLinqExpression PrepareQuery(Expression expression, out IQuery query, out NhLinqExpression nhQuery)
+ {
+ var nhLinqExpression = new NhLinqExpression(expression);
+
+ query = _session.CreateQuery(nhLinqExpression);
+
+ nhQuery = query.As<ExpressionQueryImpl>().QueryExpression.As<NhLinqExpression>();
+
+ SetParameters(query, nhLinqExpression.ParameterValuesByName);
+ SetResultTransformerAndAdditionalCriteria(query, nhQuery, nhLinqExpression.ParameterValuesByName);
+ return nhLinqExpression;
+ }
+
+ private object ExecuteFutureQuery(NhLinqExpression nhLinqExpression, IQuery query, NhLinqExpression nhQuery)
+ {
+ MethodInfo method;
+ if (nhLinqExpression.ReturnType == NhLinqExpressionReturnType.Sequence)
+ {
+ method = typeof (IQuery).GetMethod("Future").MakeGenericMethod(nhQuery.Type);
+ }
+ else
+ {
+ method = typeof(IQuery).GetMethod("FutureValue").MakeGenericMethod(nhQuery.Type);
+ }
+
+ var result = method.Invoke(query, new object[0]);
+
+
+
+ if (nhQuery.ExpressionToHqlTranslationResults.PostExecuteTransformer != null)
+ {
+ ((IDelayedValue) result).ExecuteOnEval = nhQuery.ExpressionToHqlTranslationResults.PostExecuteTransformer;
+ }
+
+ return result;
+
+ }
+
+ private object ExecuteQuery(NhLinqExpression nhLinqExpression, IQuery query, NhLinqExpression nhQuery)
+ {
+ var results = query.List();
+
+ if (nhQuery.ExpressionToHqlTranslationResults.PostExecuteTransformer != null)
+ {
+ try
+ {
+ return nhQuery.ExpressionToHqlTranslationResults.PostExecuteTransformer.DynamicInvoke(results.AsQueryable());
+ }
+ catch (TargetInvocationException e)
+ {
+ throw e.InnerException;
+ }
+ }
+
+ if (nhLinqExpression.ReturnType == NhLinqExpressionReturnType.Sequence)
+ {
+ return results.AsQueryable();
+ }
+
+ return results[0];
+ }
+
+ public TResult Execute<TResult>(Expression expression)
+ {
+ return (TResult) Execute(expression);
+ }
+
+ public IQueryable CreateQuery(Expression expression)
+ {
+ var m = ReflectionHelper.GetMethodDefinition((DefaultQueryProvider p) => p.CreateQuery<object>(null)).MakeGenericMethod(expression.Type.GetGenericArguments()[0]);
+
+ return (IQueryable) m.Invoke(this, new[] {expression});
+ }
+
+ public IQueryable<T> CreateQuery<T>(Expression expression)
+ {
+ return new NhQueryable<T>(this, expression);
+ }
+
+ static void SetParameters(IQuery query, IDictionary<string, Tuple<object, IType>> parameters)
+ {
+ foreach (var parameterName in query.NamedParameters)
+ {
+ var param = parameters[parameterName];
+
+ if (param.First == null)
+ {
+ if (typeof(ICollection).IsAssignableFrom(param.Second.ReturnedClass))
+ {
+ query.SetParameterList(parameterName, null, param.Second);
+ }
+ else
+ {
+ query.SetParameter(parameterName, null, param.Second);
+ }
+ }
+ else
+ {
+ if (param.First is ICollection)
+ {
+ query.SetParameterList(parameterName, (ICollection) param.First);
+ }
+ else if (param.Second != null)
+ {
+ query.SetParameter(parameterName, param.First, param.Second);
+ }
+ else
+ {
+ query.SetParameter(parameterName, param.First);
+ }
+ }
+ }
+ }
+
+ public void SetResultTransformerAndAdditionalCriteria(IQuery query, NhLinqExpression nhExpression, IDictionary<string, Tuple<object, IType>> parameters)
+ {
+ query.SetResultTransformer(nhExpression.ExpressionToHqlTranslationResults.ResultTransformer);
+
+ foreach (var criteria in nhExpression.ExpressionToHqlTranslationResults.AdditionalCriteria)
+ {
+ criteria(query, parameters);
+ }
+ }
+ }
+
+ public class Tuple<T1, T2>
+ {
+ public T1 First { get; set; }
+ public T2 Second { get; set; }
+
+ }
+
+ public class Tuple<T1, T2, T3>
+ {
+ public T1 First { get; set; }
+ public T2 Second { get; set; }
+ public T3 Third { get; set; }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/Linq/LinqExtensionMethods.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/LinqExtensionMethods.cs 2011-04-08 05:11:33 UTC (rev 5636)
+++ trunk/nhibernate/src/NHibernate/Linq/LinqExtensionMethods.cs 2011-04-08 05:24:48 UTC (rev 5637)
@@ -53,7 +53,7 @@
throw new NotSupportedException("You can also use the AsFuture() method on NhQueryable");
- var future = ((NhQueryProvider)nhQueryable.Provider).ExecuteFuture(nhQueryable.Expression);
+ var future = ((DefaultQueryProvider)nhQueryable.Provider).ExecuteFuture(nhQueryable.Expression);
return (IEnumerable<T>)future;
}
@@ -63,7 +63,7 @@
if (nhQueryable == null)
throw new NotSupportedException("You can also use the AsFuture() method on NhQueryable");
- var future = ((NhQueryProvider)nhQueryable.Provider).ExecuteFuture(nhQueryable.Expression);
+ var future = ((DefaultQueryProvider)nhQueryable.Provider).ExecuteFuture(nhQueryable.Expression);
if(future is DelayedEnumerator<T>)
{
return new FutureValue<T>(() => ((IEnumerable<T>) future));
Deleted: trunk/nhibernate/src/NHibernate/Linq/NhQueryProvider.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/NhQueryProvider.cs 2011-04-08 05:11:33 UTC (rev 5636)
+++ trunk/nhibernate/src/NHibernate/Linq/NhQueryProvider.cs 2011-04-08 05:24:48 UTC (rev 5637)
@@ -1,177 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Reflection;
-using NHibernate.Engine;
-using NHibernate.Impl;
-using NHibernate.Type;
-
-namespace NHibernate.Linq
-{
- public class NhQueryProvider : IQueryProvider
- {
- private readonly ISessionImplementor _session;
-
- public NhQueryProvider(ISessionImplementor session)
- {
- _session = session;
- }
-
- public object Execute(Expression expression)
- {
- IQuery query;
- NhLinqExpression nhQuery;
- NhLinqExpression nhLinqExpression = PrepareQuery(expression, out query, out nhQuery);
-
- return ExecuteQuery(nhLinqExpression, query, nhQuery);
- }
-
- public object ExecuteFuture(Expression expression)
- {
- IQuery query;
- NhLinqExpression nhQuery;
- NhLinqExpression nhLinqExpression = PrepareQuery(expression, out query, out nhQuery);
- return ExecuteFutureQuery(nhLinqExpression, query, nhQuery);
- }
-
- private NhLinqExpression PrepareQuery(Expression expression, out IQuery query, out NhLinqExpression nhQuery)
- {
- var nhLinqExpression = new NhLinqExpression(expression);
-
- query = _session.CreateQuery(nhLinqExpression);
-
- nhQuery = query.As<ExpressionQueryImpl>().QueryExpression.As<NhLinqExpression>();
-
- SetParameters(query, nhLinqExpression.ParameterValuesByName);
- SetResultTransformerAndAdditionalCriteria(query, nhQuery, nhLinqExpression.ParameterValuesByName);
- return nhLinqExpression;
- }
-
- private object ExecuteFutureQuery(NhLinqExpression nhLinqExpression, IQuery query, NhLinqExpression nhQuery)
- {
- MethodInfo method;
- if (nhLinqExpression.ReturnType == NhLinqExpressionReturnType.Sequence)
- {
- method = typeof (IQuery).GetMethod("Future").MakeGenericMethod(nhQuery.Type);
- }
- else
- {
- method = typeof(IQuery).GetMethod("FutureValue").MakeGenericMethod(nhQuery.Type);
- }
-
- var result = method.Invoke(query, new object[0]);
-
-
-
- if (nhQuery.ExpressionToHqlTranslationResults.PostExecuteTransformer != null)
- {
- ((IDelayedValue) result).ExecuteOnEval = nhQuery.ExpressionToHqlTranslationResults.PostExecuteTransformer;
- }
-
- return result;
-
- }
-
- private object ExecuteQuery(NhLinqExpression nhLinqExpression, IQuery query, NhLinqExpression nhQuery)
- {
- var results = query.List();
-
- if (nhQuery.ExpressionToHqlTranslationResults.PostExecuteTransformer != null)
- {
- try
- {
- return nhQuery.ExpressionToHqlTranslationResults.PostExecuteTransformer.DynamicInvoke(results.AsQueryable());
- }
- catch (TargetInvocationException e)
- {
- throw e.InnerException;
- }
- }
-
- if (nhLinqExpression.ReturnType == NhLinqExpressionReturnType.Sequence)
- {
- return results.AsQueryable();
- }
-
- return results[0];
- }
-
- public TResult Execute<TResult>(Expression expression)
- {
- return (TResult) Execute(expression);
- }
-
- public IQueryable CreateQuery(Expression expression)
- {
- var m = ReflectionHelper.GetMethodDefinition((NhQueryProvider p) => p.CreateQuery<object>(null)).MakeGenericMethod(expression.Type.GetGenericArguments()[0]);
-
- return (IQueryable) m.Invoke(this, new[] {expression});
- }
-
- public IQueryable<T> CreateQuery<T>(Expression expression)
- {
- return new NhQueryable<T>(this, expression);
- }
-
- static void SetParameters(IQuery query, IDictionary<string, Tuple<object, IType>> parameters)
- {
- foreach (var parameterName in query.NamedParameters)
- {
- var param = parameters[parameterName];
-
- if (param.First == null)
- {
- if (typeof(ICollection).IsAssignableFrom(param.Second.ReturnedClass))
- {
- query.SetParameterList(parameterName, null, param.Second);
- }
- else
- {
- query.SetParameter(parameterName, null, param.Second);
- }
- }
- else
- {
- if (param.First is ICollection)
- {
- query.SetParameterList(parameterName, (ICollection) param.First);
- }
- else if (param.Second != null)
- {
- query.SetParameter(parameterName, param.First, param.Second);
- }
- else
- {
- query.SetParameter(parameterName, param.First);
- }
- }
- }
- }
-
- public void SetResultTransformerAndAdditionalCriteria(IQuery query, NhLinqExpression nhExpression, IDictionary<string, Tuple<object, IType>> parameters)
- {
- query.SetResultTransformer(nhExpression.ExpressionToHqlTranslationResults.ResultTransformer);
-
- foreach (var criteria in nhExpression.ExpressionToHqlTranslationResults.AdditionalCriteria)
- {
- criteria(query, parameters);
- }
- }
- }
-
- public class Tuple<T1, T2>
- {
- public T1 First { get; set; }
- public T2 Second { get; set; }
-
- }
-
- public class Tuple<T1, T2, T3>
- {
- public T1 First { get; set; }
- public T2 Second { get; set; }
- public T3 Third { get; set; }
- }
-}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/Linq/NhQueryable.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Linq/NhQueryable.cs 2011-04-08 05:11:33 UTC (rev 5636)
+++ trunk/nhibernate/src/NHibernate/Linq/NhQueryable.cs 2011-04-08 05:24:48 UTC (rev 5637)
@@ -12,7 +12,7 @@
{
// This constructor is called by our users, create a new IQueryExecutor.
public NhQueryable(ISessionImplementor session)
- : base(new NhQueryProvider(session))
+ : base(new DefaultQueryProvider(session))
{
}
Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-04-08 05:11:33 UTC (rev 5636)
+++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-04-08 05:24:48 UTC (rev 5637)
@@ -933,7 +933,7 @@
<Compile Include="Linq\Visitors\ExpressionParameterVisitor.cs" />
<Compile Include="Linq\NhLinqExpression.cs" />
<Compile Include="Linq\NhLinqExpressionReturnType.cs" />
- <Compile Include="Linq\NhQueryProvider.cs" />
+ <Compile Include="Linq\DefaultQueryProvider.cs" />
<Compile Include="Linq\Visitors\ExpressionKeyVisitor.cs" />
<Compile Include="Linq\GroupBy\GroupByAggregateDetectionVisitor.cs" />
<Compile Include="Linq\GroupBy\AggregatingGroupByRewriter.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-08 05:11:40
|
Revision: 5636
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5636&view=rev
Author: fabiomaulo
Date: 2011-04-08 05:11:33 +0000 (Fri, 08 Apr 2011)
Log Message:
-----------
Fix NH-2612
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/NHibernate.csproj
trunk/nhibernate/src/NHibernate.Test/GhostProperty/GhostPropertyFixture.cs
trunk/nhibernate/src/NHibernate.Test/HQL/Ast/QuerySubstitutionTest.cs
trunk/nhibernate/src/NHibernate.Test/Linq/CustomExtensionsExample.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2228/Fixture.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2527/FixtureWithNoBatcher.cs
Added Paths:
-----------
trunk/nhibernate/src/NHibernate/Cfg/ConfigurationExtensions.cs
Removed Paths:
-------------
trunk/nhibernate/src/NHibernate/Cfg/Loquacious/ConfigurationExtensions.cs
Copied: trunk/nhibernate/src/NHibernate/Cfg/ConfigurationExtensions.cs (from rev 5634, trunk/nhibernate/src/NHibernate/Cfg/Loquacious/ConfigurationExtensions.cs)
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/ConfigurationExtensions.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/Cfg/ConfigurationExtensions.cs 2011-04-08 05:11:33 UTC (rev 5636)
@@ -0,0 +1,145 @@
+using System;
+using NHibernate.Cfg.Loquacious;
+using NHibernate.Context;
+using NHibernate.Hql;
+using NHibernate.Linq.Functions;
+using NHibernate.Util;
+
+namespace NHibernate.Cfg
+{
+ public static class ConfigurationExtensions
+ {
+ public static IFluentSessionFactoryConfiguration SessionFactory(this Configuration configuration)
+ {
+ return new FluentSessionFactoryConfiguration(configuration);
+ }
+
+ public static Configuration SessionFactoryName(this Configuration configuration, string sessionFactoryName)
+ {
+ configuration.SetProperty(Environment.SessionFactoryName, sessionFactoryName);
+ return configuration;
+ }
+
+ public static Configuration Cache(this Configuration configuration, Action<ICacheConfigurationProperties> cacheProperties)
+ {
+ cacheProperties(new CacheConfigurationProperties(configuration));
+ return configuration;
+ }
+
+ public static Configuration CollectionTypeFactory<TCollecionsFactory>(this Configuration configuration)
+ {
+ configuration.SetProperty(Environment.CollectionTypeFactoryClass,
+ typeof(TCollecionsFactory).AssemblyQualifiedName);
+ return configuration;
+ }
+
+ public static Configuration Proxy(this Configuration configuration, Action<IProxyConfigurationProperties> proxyProperties)
+ {
+ proxyProperties(new ProxyConfigurationProperties(configuration));
+ return configuration;
+ }
+
+ public static Configuration HqlQueryTranslator<TQueryTranslator>(this Configuration configuration) where TQueryTranslator : IQueryTranslatorFactory
+ {
+ configuration.SetProperty(Environment.QueryTranslator, typeof(TQueryTranslator).AssemblyQualifiedName);
+ return configuration;
+ }
+
+ public static Configuration LinqToHqlGeneratorsRegistry<TLinqToHqlGeneratorsRegistry>(this Configuration configuration) where TLinqToHqlGeneratorsRegistry : ILinqToHqlGeneratorsRegistry
+ {
+ configuration.SetProperty(Environment.LinqToHqlGeneratorsRegistry, typeof(TLinqToHqlGeneratorsRegistry).AssemblyQualifiedName);
+ return configuration;
+ }
+
+ public static Configuration CurrentSessionContext<TCurrentSessionContext>(this Configuration configuration) where TCurrentSessionContext : ICurrentSessionContext
+ {
+ configuration.SetProperty(Environment.CurrentSessionContextClass, typeof(TCurrentSessionContext).AssemblyQualifiedName);
+ return configuration;
+ }
+
+ public static Configuration Mappings(this Configuration configuration, Action<IMappingsConfigurationProperties> mappingsProperties)
+ {
+ mappingsProperties(new MappingsConfigurationProperties(configuration));
+ return configuration;
+ }
+
+ public static Configuration DataBaseIntegration(this Configuration configuration, Action<IDbIntegrationConfigurationProperties> dataBaseIntegration)
+ {
+ dataBaseIntegration(new DbIntegrationConfigurationProperties(configuration));
+ return configuration;
+ }
+
+ public static Configuration EntityCache<TEntity>(this Configuration configuration, Action<IEntityCacheConfigurationProperties<TEntity>> entityCacheConfiguration)
+ where TEntity : class
+ {
+ var ecc = new EntityCacheConfigurationProperties<TEntity>();
+ entityCacheConfiguration(ecc);
+ if (ecc.Strategy.HasValue)
+ {
+ configuration.SetCacheConcurrencyStrategy(typeof(TEntity).FullName, EntityCacheUsageParser.ToString(ecc.Strategy.Value),
+ ecc.RegionName);
+ }
+ foreach (var collection in ecc.Collections)
+ {
+ configuration.SetCollectionCacheConcurrencyStrategy(collection.Key,
+ EntityCacheUsageParser.ToString(collection.Value.Strategy),
+ collection.Value.RegionName);
+ }
+ return configuration;
+ }
+
+ /// <summary>
+ /// Add a type-definition for mappings.
+ /// </summary>
+ /// <typeparam name="TDef">The peristent type.</typeparam>
+ /// <param name="configuration">The <see cref="Configuration"/> where add the type-definition.</param>
+ /// <param name="typeDefConfiguration">The custom configuration action.</param>
+ /// <returns>The <see cref="Configuration"/>.</returns>
+ /// <remarks>
+ /// <para>
+ /// <list type="bullet">
+ /// <listheader>
+ /// <description>Depending on where you will use the type-definition in the mapping the
+ /// <typeparamref name="TDef"/> can be :
+ /// </description>
+ ///</listheader>
+ ///<item>
+ /// <term><see cref="NHibernate.UserTypes.IUserType"/></term>
+ ///</item>
+ ///<item>
+ /// <term><see cref="NHibernate.UserTypes.IUserCollectionType"/></term>
+ ///</item>
+ ///<item>
+ /// <term><see cref="NHibernate.UserTypes.IUserVersionType"/></term>
+ ///</item>
+ ///<item>
+ /// <term><see cref="NHibernate.Id.IPersistentIdentifierGenerator"/> </term>
+ ///</item>
+ ///</list>
+ /// </para>
+ /// </remarks>
+ public static Configuration TypeDefinition<TDef>(this Configuration configuration, Action<ITypeDefConfigurationProperties> typeDefConfiguration)
+ where TDef : class
+ {
+ if (typeDefConfiguration == null)
+ {
+ return configuration;
+ }
+ var tdConfiguration = new TypeDefConfigurationProperties<TDef>();
+ typeDefConfiguration(tdConfiguration);
+ if(string.IsNullOrEmpty(tdConfiguration.Alias))
+ {
+ return configuration;
+ }
+ var mappings = GetMappings(configuration);
+ mappings.AddTypeDef(tdConfiguration.Alias, typeof(TDef).AssemblyQualifiedName, tdConfiguration.Properties.ToTypeParameters());
+ return configuration;
+ }
+
+ private static Mappings GetMappings(Configuration configuration)
+ {
+ Dialect.Dialect dialect = Dialect.Dialect.GetDialect(configuration.Properties);
+ return configuration.CreateMappings(dialect);
+ }
+ }
+}
\ No newline at end of file
Deleted: trunk/nhibernate/src/NHibernate/Cfg/Loquacious/ConfigurationExtensions.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/Loquacious/ConfigurationExtensions.cs 2011-04-08 05:00:29 UTC (rev 5635)
+++ trunk/nhibernate/src/NHibernate/Cfg/Loquacious/ConfigurationExtensions.cs 2011-04-08 05:11:33 UTC (rev 5636)
@@ -1,144 +0,0 @@
-using System;
-using NHibernate.Context;
-using NHibernate.Hql;
-using NHibernate.Linq.Functions;
-using NHibernate.Util;
-
-namespace NHibernate.Cfg.Loquacious
-{
- public static class ConfigurationExtensions
- {
- public static IFluentSessionFactoryConfiguration SessionFactory(this Configuration configuration)
- {
- return new FluentSessionFactoryConfiguration(configuration);
- }
-
- public static Configuration SessionFactoryName(this Configuration configuration, string sessionFactoryName)
- {
- configuration.SetProperty(Environment.SessionFactoryName, sessionFactoryName);
- return configuration;
- }
-
- public static Configuration Cache(this Configuration configuration, Action<ICacheConfigurationProperties> cacheProperties)
- {
- cacheProperties(new CacheConfigurationProperties(configuration));
- return configuration;
- }
-
- public static Configuration CollectionTypeFactory<TCollecionsFactory>(this Configuration configuration)
- {
- configuration.SetProperty(Environment.CollectionTypeFactoryClass,
- typeof(TCollecionsFactory).AssemblyQualifiedName);
- return configuration;
- }
-
- public static Configuration Proxy(this Configuration configuration, Action<IProxyConfigurationProperties> proxyProperties)
- {
- proxyProperties(new ProxyConfigurationProperties(configuration));
- return configuration;
- }
-
- public static Configuration HqlQueryTranslator<TQueryTranslator>(this Configuration configuration) where TQueryTranslator : IQueryTranslatorFactory
- {
- configuration.SetProperty(Environment.QueryTranslator, typeof(TQueryTranslator).AssemblyQualifiedName);
- return configuration;
- }
-
- public static Configuration LinqToHqlGeneratorsRegistry<TLinqToHqlGeneratorsRegistry>(this Configuration configuration) where TLinqToHqlGeneratorsRegistry : ILinqToHqlGeneratorsRegistry
- {
- configuration.SetProperty(Environment.LinqToHqlGeneratorsRegistry, typeof(TLinqToHqlGeneratorsRegistry).AssemblyQualifiedName);
- return configuration;
- }
-
- public static Configuration CurrentSessionContext<TCurrentSessionContext>(this Configuration configuration) where TCurrentSessionContext : ICurrentSessionContext
- {
- configuration.SetProperty(Environment.CurrentSessionContextClass, typeof(TCurrentSessionContext).AssemblyQualifiedName);
- return configuration;
- }
-
- public static Configuration Mappings(this Configuration configuration, Action<IMappingsConfigurationProperties> mappingsProperties)
- {
- mappingsProperties(new MappingsConfigurationProperties(configuration));
- return configuration;
- }
-
- public static Configuration DataBaseIntegration(this Configuration configuration, Action<IDbIntegrationConfigurationProperties> dataBaseIntegration)
- {
- dataBaseIntegration(new DbIntegrationConfigurationProperties(configuration));
- return configuration;
- }
-
- public static Configuration EntityCache<TEntity>(this Configuration configuration, Action<IEntityCacheConfigurationProperties<TEntity>> entityCacheConfiguration)
- where TEntity : class
- {
- var ecc = new EntityCacheConfigurationProperties<TEntity>();
- entityCacheConfiguration(ecc);
- if (ecc.Strategy.HasValue)
- {
- configuration.SetCacheConcurrencyStrategy(typeof(TEntity).FullName, EntityCacheUsageParser.ToString(ecc.Strategy.Value),
- ecc.RegionName);
- }
- foreach (var collection in ecc.Collections)
- {
- configuration.SetCollectionCacheConcurrencyStrategy(collection.Key,
- EntityCacheUsageParser.ToString(collection.Value.Strategy),
- collection.Value.RegionName);
- }
- return configuration;
- }
-
- /// <summary>
- /// Add a type-definition for mappings.
- /// </summary>
- /// <typeparam name="TDef">The peristent type.</typeparam>
- /// <param name="configuration">The <see cref="Configuration"/> where add the type-definition.</param>
- /// <param name="typeDefConfiguration">The custom configuration action.</param>
- /// <returns>The <see cref="Configuration"/>.</returns>
- /// <remarks>
- /// <para>
- /// <list type="bullet">
- /// <listheader>
- /// <description>Depending on where you will use the type-definition in the mapping the
- /// <typeparamref name="TDef"/> can be :
- /// </description>
- ///</listheader>
- ///<item>
- /// <term><see cref="NHibernate.UserTypes.IUserType"/></term>
- ///</item>
- ///<item>
- /// <term><see cref="NHibernate.UserTypes.IUserCollectionType"/></term>
- ///</item>
- ///<item>
- /// <term><see cref="NHibernate.UserTypes.IUserVersionType"/></term>
- ///</item>
- ///<item>
- /// <term><see cref="NHibernate.Id.IPersistentIdentifierGenerator"/> </term>
- ///</item>
- ///</list>
- /// </para>
- /// </remarks>
- public static Configuration TypeDefinition<TDef>(this Configuration configuration, Action<ITypeDefConfigurationProperties> typeDefConfiguration)
- where TDef : class
- {
- if (typeDefConfiguration == null)
- {
- return configuration;
- }
- var tdConfiguration = new TypeDefConfigurationProperties<TDef>();
- typeDefConfiguration(tdConfiguration);
- if(string.IsNullOrEmpty(tdConfiguration.Alias))
- {
- return configuration;
- }
- var mappings = GetMappings(configuration);
- mappings.AddTypeDef(tdConfiguration.Alias, typeof(TDef).AssemblyQualifiedName, tdConfiguration.Properties.ToTypeParameters());
- return configuration;
- }
-
- private static Mappings GetMappings(Configuration configuration)
- {
- Dialect.Dialect dialect = Dialect.Dialect.GetDialect(configuration.Properties);
- return configuration.CreateMappings(dialect);
- }
- }
-}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-04-08 05:00:29 UTC (rev 5635)
+++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-04-08 05:11:33 UTC (rev 5636)
@@ -676,7 +676,7 @@
<Compile Include="Cfg\FilterSecondPassArgs.cs" />
<Compile Include="Cfg\Hbm2ddlKeyWords.cs" />
<Compile Include="Cfg\Loquacious\CacheConfiguration.cs" />
- <Compile Include="Cfg\Loquacious\ConfigurationExtensions.cs" />
+ <Compile Include="Cfg\ConfigurationExtensions.cs" />
<Compile Include="Cfg\Loquacious\DbIntegrationConfiguration.cs" />
<Compile Include="Cfg\Loquacious\EntityCacheConfigurationProperties.cs" />
<Compile Include="Cfg\Loquacious\FluentSessionFactoryConfiguration.cs" />
Modified: trunk/nhibernate/src/NHibernate.Test/GhostProperty/GhostPropertyFixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/GhostProperty/GhostPropertyFixture.cs 2011-04-08 05:00:29 UTC (rev 5635)
+++ trunk/nhibernate/src/NHibernate.Test/GhostProperty/GhostPropertyFixture.cs 2011-04-08 05:11:33 UTC (rev 5636)
@@ -1,4 +1,5 @@
using System.Collections;
+using NHibernate.Cfg;
using NHibernate.Cfg.Loquacious;
using NHibernate.Tuple.Entity;
using NUnit.Framework;
Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/QuerySubstitutionTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/QuerySubstitutionTest.cs 2011-04-08 05:00:29 UTC (rev 5635)
+++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/QuerySubstitutionTest.cs 2011-04-08 05:11:33 UTC (rev 5636)
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using NHibernate.Cfg;
using NUnit.Framework;
using NHibernate.Cfg.Loquacious;
using SharpTestsEx;
Modified: trunk/nhibernate/src/NHibernate.Test/Linq/CustomExtensionsExample.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Linq/CustomExtensionsExample.cs 2011-04-08 05:00:29 UTC (rev 5635)
+++ trunk/nhibernate/src/NHibernate.Test/Linq/CustomExtensionsExample.cs 2011-04-08 05:11:33 UTC (rev 5636)
@@ -3,6 +3,7 @@
using System.Linq.Expressions;
using System.Reflection;
using System.Text.RegularExpressions;
+using NHibernate.Cfg;
using NHibernate.Cfg.Loquacious;
using NHibernate.Hql.Ast;
using NHibernate.Linq;
Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2228/Fixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2228/Fixture.cs 2011-04-08 05:00:29 UTC (rev 5635)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2228/Fixture.cs 2011-04-08 05:11:33 UTC (rev 5636)
@@ -1,4 +1,5 @@
using System;
+using NHibernate.Cfg;
using NUnit.Framework;
using NHibernate.Cfg.Loquacious;
using SharpTestsEx;
Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2527/FixtureWithNoBatcher.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2527/FixtureWithNoBatcher.cs 2011-04-08 05:00:29 UTC (rev 5635)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2527/FixtureWithNoBatcher.cs 2011-04-08 05:11:33 UTC (rev 5636)
@@ -1,4 +1,5 @@
using NHibernate.AdoNet;
+using NHibernate.Cfg;
using NHibernate.Cfg.Loquacious;
using NUnit.Framework;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-08 05:00:35
|
Revision: 5635
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5635&view=rev
Author: fabiomaulo
Date: 2011-04-08 05:00:29 +0000 (Fri, 08 Apr 2011)
Log Message:
-----------
Fix NH-2627
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Impl/CriteriaImpl.cs
trunk/nhibernate/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs
Modified: trunk/nhibernate/src/NHibernate/Impl/CriteriaImpl.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Impl/CriteriaImpl.cs 2011-04-07 23:21:21 UTC (rev 5634)
+++ trunk/nhibernate/src/NHibernate/Impl/CriteriaImpl.cs 2011-04-08 05:00:29 UTC (rev 5635)
@@ -588,7 +588,7 @@
"Could not find parent for subcriteria in the previous subcriteria. If you see this error, it is a bug");
}
Subcriteria clonedSubCriteria =
- new Subcriteria(clone, currentParent, subcriteria.Path, subcriteria.Alias, subcriteria.JoinType);
+ new Subcriteria(clone, currentParent, subcriteria.Path, subcriteria.Alias, subcriteria.JoinType, subcriteria.WithClause);
clonedSubCriteria.SetLockMode(subcriteria.LockMode);
newParents[subcriteria] = clonedSubCriteria;
}
Modified: trunk/nhibernate/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs 2011-04-07 23:21:21 UTC (rev 5634)
+++ trunk/nhibernate/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs 2011-04-08 05:00:29 UTC (rev 5635)
@@ -2890,6 +2890,31 @@
Assert.IsNull(result[1]);
Assert.IsNull(result[2]);
}
+
+ // test != on one existing value (using clone)
+ var criteria = session.CreateCriteria<Student>()
+ .CreateAlias("PreferredCourse", "pc", JoinType.LeftOuterJoin,
+ Restrictions.Not(Restrictions.Eq("pc.CourseCode", "HIB-A")))
+ .SetProjection(Property.ForName("pc.CourseCode"))
+ .AddOrder(Order.Asc("pc.CourseCode"));
+ var clonedCriteria = CriteriaTransformer.Clone(criteria);
+ result = clonedCriteria.List<string>();
+
+ Assert.AreEqual(3, result.Count);
+
+ // can't be sure of NULL comparison ordering aside from they should
+ // either come first or last
+ if (result[0] == null)
+ {
+ Assert.IsNull(result[1]);
+ Assert.AreEqual("HIB-B", result[2]);
+ }
+ else
+ {
+ Assert.AreEqual("HIB-B", result[0]);
+ Assert.IsNull(result[1]);
+ Assert.IsNull(result[2]);
+ }
session.Delete(gavin);
session.Delete(leonardo);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-07 23:21:28
|
Revision: 5634
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5634&view=rev
Author: fabiomaulo
Date: 2011-04-07 23:21:21 +0000 (Thu, 07 Apr 2011)
Log Message:
-----------
Fix NH-2632 + minor refactoring
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Persister/Entity/AbstractEntityPersister.cs
trunk/nhibernate/src/NHibernate/Tuple/Entity/EntityMetamodel.cs
trunk/nhibernate/src/NHibernate.Test/GhostProperty/GhostPropertyFixture.cs
trunk/nhibernate/src/NHibernate.Test/LazyProperty/LazyPropertyFixture.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2632/Fixture.cs
Modified: trunk/nhibernate/src/NHibernate/Persister/Entity/AbstractEntityPersister.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Persister/Entity/AbstractEntityPersister.cs 2011-04-07 20:44:05 UTC (rev 5633)
+++ trunk/nhibernate/src/NHibernate/Persister/Entity/AbstractEntityPersister.cs 2011-04-07 23:21:21 UTC (rev 5634)
@@ -332,7 +332,8 @@
#region PROPERTIES
- bool lazyAvailable = IsInstrumented(EntityMode.Poco);
+ // NH: see consistence with the implementation on EntityMetamodel where we are disabling lazy-properties for no lazy entities
+ bool lazyAvailable = IsInstrumented(EntityMode.Poco) && entityMetamodel.IsLazy;
int hydrateSpan = entityMetamodel.PropertySpan;
propertyColumnSpans = new int[hydrateSpan];
Modified: trunk/nhibernate/src/NHibernate/Tuple/Entity/EntityMetamodel.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Tuple/Entity/EntityMetamodel.cs 2011-04-07 20:44:05 UTC (rev 5633)
+++ trunk/nhibernate/src/NHibernate/Tuple/Entity/EntityMetamodel.cs 2011-04-07 23:21:21 UTC (rev 5634)
@@ -8,6 +8,7 @@
using NHibernate.Mapping;
using NHibernate.Type;
using NHibernate.Util;
+using Array = NHibernate.Mapping.Array;
namespace NHibernate.Tuple.Entity
{
@@ -126,19 +127,47 @@
bool foundUpdateGeneratedValue = false;
bool foundNonIdentifierPropertyNamedId = false;
HasPocoRepresentation = persistentClass.HasPocoRepresentation;
+
+ // NH: WARNING if we have to disable lazy/unproxy properties we have to do it in the whole process.
+ lazy = persistentClass.IsLazy && (!persistentClass.HasPocoRepresentation || !ReflectHelper.IsFinalClass(persistentClass.ProxyInterface));
+ lazyAvailable &= lazy; // <== Disable lazy properties if the class is marked with lazy=false
+
+ bool hadLazyProperties = false;
+ bool hadNoProxyRelations = false;
foreach (Mapping.Property prop in persistentClass.PropertyClosureIterator)
{
- // NH: A lazy property is a simple property marked with lazy=true or a relation (in this case many-to-one or one-to-one marked as "no-proxy")
- bool lazyProperty = prop.IsLazy && lazyAvailable && (!prop.IsEntityRelation || prop.UnwrapProxy);
+ if (prop.IsLazy)
+ {
+ hadLazyProperties = true;
+ }
+ if(prop.UnwrapProxy)
+ {
+ hadNoProxyRelations = true;
+ }
+ // NH: A lazy property is a simple property marked with lazy=true
+ bool islazyProperty = prop.IsLazy && lazyAvailable && (!prop.IsEntityRelation || prop.UnwrapProxy);
+ // NH: A Relation (in this case many-to-one or one-to-one) marked as "no-proxy"
+ var isUnwrapProxy = prop.UnwrapProxy && lazyAvailable;
+
+ if (islazyProperty || isUnwrapProxy)
+ {
+ // NH: verify property proxiability
+ var getter = prop.GetGetter(persistentClass.MappedClass);
+ if (getter.Method == null || getter.Method.IsDefined(typeof(CompilerGeneratedAttribute), false) == false)
+ {
+ log.ErrorFormat("Lazy or no-proxy property {0}.{1} is not an auto property, which may result in uninitialized property access", persistentClass.EntityName, prop.Name);
+ }
+ }
+
if (prop == persistentClass.Version)
{
tempVersionProperty = i;
- properties[i] = PropertyFactory.BuildVersionProperty(prop, lazyProperty);
+ properties[i] = PropertyFactory.BuildVersionProperty(prop, islazyProperty);
}
else
{
- properties[i] = PropertyFactory.BuildStandardProperty(prop, lazyProperty);
+ properties[i] = PropertyFactory.BuildStandardProperty(prop, islazyProperty);
}
if (prop.IsNaturalIdentifier)
@@ -151,16 +180,16 @@
foundNonIdentifierPropertyNamedId = true;
}
- if (lazyProperty)
+ if (islazyProperty)
{
hasLazy = true;
}
- if (prop.UnwrapProxy)
+ if (isUnwrapProxy)
{
hasUnwrapProxyForProperties = true;
}
- propertyLaziness[i] = lazyProperty;
+ propertyLaziness[i] = islazyProperty;
propertyNames[i] = properties[i].Name;
propertyTypes[i] = properties[i].Type;
@@ -170,7 +199,7 @@
insertInclusions[i] = DetermineInsertValueGenerationType(prop, properties[i]);
updateInclusions[i] = DetermineUpdateValueGenerationType(prop, properties[i]);
propertyVersionability[i] = properties[i].IsVersionable;
- nonlazyPropertyUpdateability[i] = properties[i].IsUpdateable && !lazyProperty;
+ nonlazyPropertyUpdateability[i] = properties[i].IsUpdateable && !islazyProperty;
propertyCheckability[i] = propertyUpdateability[i]
||
(propertyTypes[i].IsAssociationType
@@ -224,36 +253,24 @@
versionPropertyIndex = tempVersionProperty;
hasLazyProperties = hasLazy;
- lazy = persistentClass.IsLazy
- && (!persistentClass.HasPocoRepresentation || !ReflectHelper.IsFinalClass(persistentClass.ProxyInterface));
+ if(hadLazyProperties && !hasLazy)
+ {
+ log.WarnFormat("Disabled lazy properies fetching for {0} beacuse it does not support lazy at the entity level", name);
+ }
if (hasLazy)
{
- if (lazy == false)
- {
- log.WarnFormat("Disabled lazy properies fetching for {0} beacuse it does not support lazy at the entity level", name);
- hasLazyProperties = false;
- }
- else
- {
- log.Info("lazy property fetching available for: " + name);
- VerifyCanInterceptPropertiesForLazyOrGhostProperties(persistentClass);
- }
+ log.Info("lazy property fetching available for: " + name);
}
- if(hasUnwrapProxyForProperties)
+
+ if(hadNoProxyRelations && !hasUnwrapProxyForProperties)
{
- if (lazy == false)
- {
- log.WarnFormat("Disabled ghost properies fetching for {0} beacuse it does not support lazy at the entity level", name);
- hasUnwrapProxyForProperties = false;
- }
- else
- {
- log.Info("Ghost property fetching available for: " + name);
- if (hasLazy == false) // avoid double checking
- VerifyCanInterceptPropertiesForLazyOrGhostProperties(persistentClass);
- }
+ log.WarnFormat("Disabled ghost properies fetching for {0} beacuse it does not support lazy at the entity level", name);
}
+ if (hasUnwrapProxyForProperties)
+ {
+ log.Info("no-proxy property fetching available for: " + name);
+ }
mutable = persistentClass.IsMutable;
@@ -303,23 +320,6 @@
public bool HasPocoRepresentation { get; private set; }
- private static void VerifyCanInterceptPropertiesForLazyOrGhostProperties(PersistentClass persistentClass)
- {
- foreach (var prop in persistentClass.PropertyClosureIterator)
- {
- if (prop.IsLazy == false &&
- prop.UnwrapProxy == false)
- continue;
-
- var getter = prop.GetGetter(persistentClass.MappedClass);
- if(getter.Method == null ||
- getter.Method.IsDefined(typeof(CompilerGeneratedAttribute), false) == false)
- {
- log.ErrorFormat("Lazy or ghost property {0}.{1} is not an auto property, which may result in uninitialized property access", persistentClass.EntityName, prop.Name);
- }
- }
- }
-
private ValueInclusion DetermineInsertValueGenerationType(Mapping.Property mappingProperty, StandardProperty runtimeProperty)
{
if (runtimeProperty.IsInsertGenerated)
Modified: trunk/nhibernate/src/NHibernate.Test/GhostProperty/GhostPropertyFixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/GhostProperty/GhostPropertyFixture.cs 2011-04-07 20:44:05 UTC (rev 5633)
+++ trunk/nhibernate/src/NHibernate.Test/GhostProperty/GhostPropertyFixture.cs 2011-04-07 23:21:21 UTC (rev 5634)
@@ -69,7 +69,7 @@
[Test]
public void ShouldGenerateErrorForNonAutoPropGhostProp()
{
- Assert.IsTrue(log.Contains("Lazy or ghost property NHibernate.Test.GhostProperty.Order.Payment is not an auto property, which may result in uninitialized property access"));
+ Assert.IsTrue(log.Contains("NHibernate.Test.GhostProperty.Order.Payment is not an auto property, which may result in uninitialized property access"));
}
[Test]
Modified: trunk/nhibernate/src/NHibernate.Test/LazyProperty/LazyPropertyFixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/LazyProperty/LazyPropertyFixture.cs 2011-04-07 20:44:05 UTC (rev 5633)
+++ trunk/nhibernate/src/NHibernate.Test/LazyProperty/LazyPropertyFixture.cs 2011-04-07 23:21:21 UTC (rev 5634)
@@ -76,7 +76,7 @@
[Test]
public void ShouldGenerateErrorForNonAutoPropLazyProp()
{
- Assert.IsTrue(log.Contains("Lazy or ghost property NHibernate.Test.LazyProperty.Book.ALotOfText is not an auto property, which may result in uninitialized property access"));
+ Assert.IsTrue(log.Contains("NHibernate.Test.LazyProperty.Book.ALotOfText is not an auto property, which may result in uninitialized property access"));
}
[Test]
Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2632/Fixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2632/Fixture.cs 2011-04-07 20:44:05 UTC (rev 5633)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2632/Fixture.cs 2011-04-07 23:21:21 UTC (rev 5634)
@@ -86,7 +86,7 @@
}
}
- [Test, Ignore("Not fixed yet")]
+ [Test]
public void GettingCustomerDoesNotThrow()
{
using (var scenario = new Scenario(Sfi))
@@ -95,7 +95,9 @@
{
Customer customer = null;
Executing.This(()=> customer = session.Get<Customer>(scenario.CustomerId)).Should().NotThrow();
- NHibernateUtil.IsInitialized(customer.Address).Should().Be.False();
+ // An entity defined with lazy=false can't have lazy properties (as reported by the WARNING; see EntityMetamodel class)
+ NHibernateUtil.IsInitialized(customer.Address).Should().Be.True();
+ customer.Address.Should().Be("Bah?!??");
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-07 20:44:12
|
Revision: 5633
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5633&view=rev
Author: fabiomaulo
Date: 2011-04-07 20:44:05 +0000 (Thu, 07 Apr 2011)
Log Message:
-----------
Test for NH-2632 (not fixed yet)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2632/
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2632/Domain.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2632/Fixture.cs
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2632/Domain.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2632/Domain.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2632/Domain.cs 2011-04-07 20:44:05 UTC (rev 5633)
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+
+namespace NHibernate.Test.NHSpecificTest.NH2632
+{
+ public class Customer
+ {
+ public virtual Int64 Id
+ {
+ get;
+ private set;
+ }
+ public virtual String Name
+ {
+ get;
+ set;
+ }
+ public virtual String Address
+ {
+ get;
+ set;
+ }
+ public virtual IEnumerable<Order> Orders
+ {
+ get;
+ private set;
+ }
+ }
+
+ public class Order
+ {
+ public virtual Int32 Id
+ {
+ get;
+ private set;
+ }
+
+ public virtual DateTime Date
+ {
+ get;
+ set;
+ }
+
+ public virtual Customer Customer
+ {
+ get;
+ set;
+ }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2632/Fixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2632/Fixture.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2632/Fixture.cs 2011-04-07 20:44:05 UTC (rev 5633)
@@ -0,0 +1,103 @@
+using System;
+using NHibernate.Cfg;
+using NHibernate.Cfg.Loquacious;
+using NHibernate.Cfg.MappingSchema;
+using NHibernate.Mapping.ByCode;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.NHSpecificTest.NH2632
+{
+ public class Fixture: TestCaseMappingByCode
+ {
+ protected override HbmMapping GetMappings()
+ {
+ // The impl/mapping of the bidirectional one-to-many sucks but was provided as is
+ var mapper = new ModelMapper();
+ mapper.BeforeMapClass += (i, t, cm) => cm.Id(map =>
+ {
+ map.Column((t.Name + "Id").ToUpperInvariant());
+ map.Generator(Generators.HighLow, g => g.Params(new { max_lo = "1000" }));
+ });
+ mapper.Class<Customer>(ca =>
+ {
+ ca.Lazy(false);
+ ca.Id(x => x.Id, m => { });
+ ca.NaturalId(x => x.Property(c => c.Name, p => p.NotNullable(true)));
+ ca.Property(x => x.Address, p => p.Lazy(true));
+ ca.Set(c => c.Orders, c =>
+ {
+ c.Key(x => x.Column("CUSTOMERID"));
+ c.Inverse(true);
+ c.Cascade(Mapping.ByCode.Cascade.All);
+ }, c => c.OneToMany());
+ });
+ mapper.Class<Order>(cm =>
+ {
+ cm.Id(x => x.Id, m => { });
+ cm.Property(x => x.Date);
+ cm.ManyToOne(x => x.Customer, map => map.Column("CUSTOMERID"));
+ });
+ return mapper.CompileMappingForAllExplicitAddedEntities();
+ }
+
+ protected override void Configure(Cfg.Configuration configuration)
+ {
+ configuration.DataBaseIntegration(di => di.KeywordsAutoImport = Hbm2DDLKeyWords.AutoQuote);
+ }
+
+ private class Scenario : IDisposable
+ {
+ private readonly ISessionFactory factory;
+ private object customerId;
+
+ public Scenario(ISessionFactory factory)
+ {
+ this.factory = factory;
+ using (ISession s = factory.OpenSession())
+ {
+ using (ITransaction t = s.BeginTransaction())
+ {
+ var customer = new Customer { Name="Zombi", Address = "Bah?!??"};
+ var order = new Order { Date = DateTime.Today, Customer = customer };
+ customerId = s.Save(customer);
+ s.Save(order);
+ t.Commit();
+ }
+ }
+ }
+
+ public object CustomerId
+ {
+ get { return customerId; }
+ }
+
+ public void Dispose()
+ {
+ using (ISession s = factory.OpenSession())
+ {
+ using (ITransaction t = s.BeginTransaction())
+ {
+ s.Delete("from Order");
+ s.Delete("from Customer");
+ t.Commit();
+ }
+ }
+ }
+ }
+
+ [Test, Ignore("Not fixed yet")]
+ public void GettingCustomerDoesNotThrow()
+ {
+ using (var scenario = new Scenario(Sfi))
+ {
+ using (var session = OpenSession())
+ {
+ Customer customer = null;
+ Executing.This(()=> customer = session.Get<Customer>(scenario.CustomerId)).Should().NotThrow();
+ NHibernateUtil.IsInitialized(customer.Address).Should().Be.False();
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-07 19:44:21 UTC (rev 5632)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-07 20:44:05 UTC (rev 5633)
@@ -719,6 +719,8 @@
<Compile Include="NHSpecificTest\NH2580\Fixture.cs" />
<Compile Include="NHSpecificTest\NH2603\Fixture.cs" />
<Compile Include="NHSpecificTest\NH2603\Model.cs" />
+ <Compile Include="NHSpecificTest\NH2632\Domain.cs" />
+ <Compile Include="NHSpecificTest\NH2632\Fixture.cs" />
<Compile Include="NHSpecificTest\Properties\CompositePropertyRefTest.cs" />
<Compile Include="NHSpecificTest\Properties\DynamicEntityTest.cs" />
<Compile Include="NHSpecificTest\Properties\Model.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-07 19:44:28
|
Revision: 5632
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5632&view=rev
Author: fabiomaulo
Date: 2011-04-07 19:44:21 +0000 (Thu, 07 Apr 2011)
Log Message:
-----------
Base test class to work with sexy mapping
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
trunk/nhibernate/src/NHibernate.Test/TestCase.cs
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/TestCaseMappingByCode.cs
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-07 19:30:49 UTC (rev 5631)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-07 19:44:21 UTC (rev 5632)
@@ -749,6 +749,7 @@
<Compile Include="ReadOnly\VersionedNode.cs" />
<Compile Include="Subselect\ClassSubselectFixture.cs" />
<Compile Include="Subselect\Domain.cs" />
+ <Compile Include="TestCaseMappingByCode.cs" />
<Compile Include="TestDialect.cs" />
<Compile Include="TestDialects\PostgreSQL82TestDialect.cs" />
<Compile Include="TestDialects\SQLiteTestDialect.cs" />
Modified: trunk/nhibernate/src/NHibernate.Test/TestCase.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/TestCase.cs 2011-04-07 19:30:49 UTC (rev 5631)
+++ trunk/nhibernate/src/NHibernate.Test/TestCase.cs 2011-04-07 19:44:21 UTC (rev 5632)
@@ -222,16 +222,21 @@
if (TestConfigurationHelper.hibernateConfigFile != null)
cfg.Configure(TestConfigurationHelper.hibernateConfigFile);
+ AddMappings(cfg);
+
+ Configure(cfg);
+
+ ApplyCacheSettings(cfg);
+ }
+
+ protected virtual void AddMappings(Configuration configuration)
+ {
Assembly assembly = Assembly.Load(MappingsAssembly);
foreach (string file in Mappings)
{
- cfg.AddResource(MappingsAssembly + "." + file, assembly);
+ configuration.AddResource(MappingsAssembly + "." + file, assembly);
}
-
- Configure(cfg);
-
- ApplyCacheSettings(cfg);
}
protected virtual void CreateSchema()
Added: trunk/nhibernate/src/NHibernate.Test/TestCaseMappingByCode.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/TestCaseMappingByCode.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/TestCaseMappingByCode.cs 2011-04-07 19:44:21 UTC (rev 5632)
@@ -0,0 +1,25 @@
+using System.Collections;
+using NHibernate.Cfg.MappingSchema;
+
+namespace NHibernate.Test
+{
+ public abstract class TestCaseMappingByCode:TestCase
+ {
+ protected override IList Mappings
+ {
+ get { return new string[0]; }
+ }
+
+ protected override string MappingsAssembly
+ {
+ get { return null; }
+ }
+
+ protected override void AddMappings(Cfg.Configuration configuration)
+ {
+ configuration.AddDeserializedMapping(GetMappings(), "TestDomain");
+ }
+
+ protected abstract HbmMapping GetMappings();
+ }
+}
\ 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...> - 2011-04-07 19:30:55
|
Revision: 5631
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5631&view=rev
Author: fabiomaulo
Date: 2011-04-07 19:30:49 +0000 (Thu, 07 Apr 2011)
Log Message:
-----------
Fix NH-2630
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/AdoNet/Util/SqlStatementLogger.cs
Modified: trunk/nhibernate/src/NHibernate/AdoNet/Util/SqlStatementLogger.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/AdoNet/Util/SqlStatementLogger.cs 2011-04-07 17:30:46 UTC (rev 5630)
+++ trunk/nhibernate/src/NHibernate/AdoNet/Util/SqlStatementLogger.cs 2011-04-07 19:30:49 UTC (rev 5631)
@@ -109,23 +109,24 @@
}
- public string GetParameterLogableValue(IDataParameter parameter)
- {
- if (parameter.Value == null || DBNull.Value.Equals(parameter.Value))
+ public string GetParameterLogableValue(IDataParameter parameter)
{
- return "NULL";
+ const int maxLogableStringLength = 1000;
+ if (parameter.Value == null || DBNull.Value.Equals(parameter.Value))
+ {
+ return "NULL";
+ }
+ if (IsStringType(parameter.DbType))
+ {
+ return string.Concat("'", TruncateWithEllipsis(parameter.Value.ToString(), maxLogableStringLength), "'");
+ }
+ var buffer = parameter.Value as byte[];
+ if (buffer != null)
+ {
+ return GetBufferAsHexString(buffer);
+ }
+ return parameter.Value.ToString();
}
- if (IsStringType(parameter.DbType))
- {
- return string.Concat("'", parameter.Value.ToString(), "'");
- }
- var buffer = parameter.Value as byte[];
- if (buffer != null)
- {
- return GetBufferAsHexString(buffer);
- }
- return parameter.Value.ToString();
- }
private static string GetBufferAsHexString(byte[] buffer)
{
@@ -164,5 +165,15 @@
Console.Out.WriteLine("NHibernate: " + batchCommand);
}
}
+
+ private string TruncateWithEllipsis(string source, int length)
+ {
+ const string ellipsis = "...";
+ if (source.Length > length)
+ {
+ return source.Substring(0, length) + ellipsis;
+ }
+ return source;
+ }
}
}
\ 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...> - 2011-04-07 17:30:52
|
Revision: 5630
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5630&view=rev
Author: fabiomaulo
Date: 2011-04-07 17:30:46 +0000 (Thu, 07 Apr 2011)
Log Message:
-----------
passing test for NH-2628
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/DynamicProxyTests/ProxiedMembers/MetodWithRefDictionaryTest.cs
Added: trunk/nhibernate/src/NHibernate.Test/DynamicProxyTests/ProxiedMembers/MetodWithRefDictionaryTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/DynamicProxyTests/ProxiedMembers/MetodWithRefDictionaryTest.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/DynamicProxyTests/ProxiedMembers/MetodWithRefDictionaryTest.cs 2011-04-07 17:30:46 UTC (rev 5630)
@@ -0,0 +1,29 @@
+using System.Collections.Generic;
+using NHibernate.Proxy.DynamicProxy;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.DynamicProxyTests.ProxiedMembers
+{
+ public class MetodWithRefDictionaryTest
+ {
+ public class MyClass
+ {
+ public virtual void Method(ref Dictionary<string ,string> adictionary)
+ {
+ adictionary = new Dictionary<string, string>();
+ }
+ }
+
+ [Test]
+ public void Proxy()
+ {
+ var factory = new ProxyFactory();
+ var c = (MyClass)factory.CreateProxy(typeof(MyClass), new PassThroughInterceptor(new MyClass()), null);
+ var dictionary = new Dictionary<string, string>();
+ var myParam = dictionary;
+ c.Method(ref myParam);
+ myParam.Should().Not.Be.SameInstanceAs(dictionary);
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-07 17:19:55 UTC (rev 5629)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-07 17:30:46 UTC (rev 5630)
@@ -224,6 +224,7 @@
<Compile Include="DynamicProxyTests\LazyFieldInterceptorSerializable.cs" />
<Compile Include="DynamicProxyTests\PassThroughInterceptor.cs" />
<Compile Include="DynamicProxyTests\ProxiedMembers\Fixture.cs" />
+ <Compile Include="DynamicProxyTests\ProxiedMembers\MetodWithRefDictionaryTest.cs" />
<Compile Include="EngineTest\CallableParserFixture.cs" />
<Compile Include="EngineTest\NativeSQLQueryNonScalarReturnTest.cs" />
<Compile Include="EngineTest\NativeSQLQueryScalarReturnTest.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-07 17:20:01
|
Revision: 5629
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5629&view=rev
Author: fabiomaulo
Date: 2011-04-07 17:19:55 +0000 (Thu, 07 Apr 2011)
Log Message:
-----------
Fix NH-2622
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/NHibernate.csproj
trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/DefaultArgumentHandler.cs
trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/DefaultMethodEmitter.cs
trunk/nhibernate/src/NHibernate.Test/DynamicProxyTests/ProxiedMembers/Fixture.cs
Added Paths:
-----------
trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/OpCodesMap.cs
Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-04-06 21:06:29 UTC (rev 5628)
+++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-04-07 17:19:55 UTC (rev 5629)
@@ -499,6 +499,7 @@
<Compile Include="Proxy\DynamicProxy\IProxy.cs" />
<Compile Include="Proxy\DynamicProxy\IProxyCache.cs" />
<Compile Include="Proxy\DynamicProxy\IProxyMethodBuilder.cs" />
+ <Compile Include="Proxy\DynamicProxy\OpCodesMap.cs" />
<Compile Include="Proxy\DynamicProxy\ProxyCache.cs" />
<Compile Include="Proxy\DynamicProxy\ProxyCacheEntry.cs" />
<Compile Include="Proxy\DynamicProxy\ProxyDummy.cs" />
Modified: trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/DefaultArgumentHandler.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/DefaultArgumentHandler.cs 2011-04-06 21:06:29 UTC (rev 5628)
+++ trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/DefaultArgumentHandler.cs 2011-04-07 17:19:55 UTC (rev 5629)
@@ -6,7 +6,6 @@
#endregion
-using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -37,7 +36,7 @@
int argumentPosition = 1;
foreach (ParameterInfo param in parameters)
{
- System.Type parameterType = param.ParameterType;
+ System.Type parameterType = param.ParameterType.IsByRef ? param.ParameterType.GetElementType() : param.ParameterType;
// args[N] = argumentN (pseudocode)
IL.Emit(OpCodes.Ldloc_S, 0);
IL.Emit(OpCodes.Ldc_I4, index);
@@ -54,9 +53,17 @@
IL.Emit(OpCodes.Ldarg, argumentPosition);
- bool isGeneric = parameterType.IsGenericParameter;
+ if (param.ParameterType.IsByRef)
+ {
+ OpCode ldindInstruction;
+ if(!OpCodesMap.TryGetLdindOpCode(param.ParameterType.GetElementType(), out ldindInstruction))
+ {
+ ldindInstruction = OpCodes.Ldind_Ref;
+ }
+ IL.Emit(ldindInstruction);
+ }
- if (parameterType.IsValueType || isGeneric)
+ if (parameterType.IsValueType || param.ParameterType.IsByRef || parameterType.IsGenericParameter)
{
IL.Emit(OpCodes.Box, parameterType);
}
Modified: trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/DefaultMethodEmitter.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/DefaultMethodEmitter.cs 2011-04-06 21:06:29 UTC (rev 5628)
+++ trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/DefaultMethodEmitter.cs 2011-04-07 17:19:55 UTC (rev 5629)
@@ -30,7 +30,6 @@
private static readonly ConstructorInfo notImplementedConstructor = typeof(NotImplementedException).GetConstructor(new System.Type[0]);
- private static readonly Dictionary<string, OpCode> stindMap = new Dictionary<string, OpCode>();
private readonly IArgumentHandler _argumentHandler;
static DefaultMethodEmitter()
@@ -43,23 +42,6 @@
};
infoConstructor = typeof (InvocationInfo).GetConstructor(constructorTypes);
-
-
- stindMap["Bool&"] = OpCodes.Stind_I1;
- stindMap["Int8&"] = OpCodes.Stind_I1;
- stindMap["Uint8&"] = OpCodes.Stind_I1;
-
- stindMap["Int16&"] = OpCodes.Stind_I2;
- stindMap["Uint16&"] = OpCodes.Stind_I2;
-
- stindMap["Uint32&"] = OpCodes.Stind_I4;
- stindMap["Int32&"] = OpCodes.Stind_I4;
-
- stindMap["IntPtr"] = OpCodes.Stind_I4;
- stindMap["Uint64&"] = OpCodes.Stind_I8;
- stindMap["Int64&"] = OpCodes.Stind_I8;
- stindMap["Float32&"] = OpCodes.Stind_R4;
- stindMap["Float64&"] = OpCodes.Stind_R8;
}
public DefaultMethodEmitter() : this(new DefaultArgumentHandler()) {}
@@ -124,8 +106,8 @@
IL.Emit(OpCodes.Ldloc_1);
IL.Emit(OpCodes.Callvirt, handlerMethod);
- SaveRefArguments(IL, parameters);
PackageReturnType(method, IL);
+ SaveRefArguments(IL, parameters);
IL.Emit(OpCodes.Ret);
}
@@ -158,8 +140,7 @@
IL.Emit(OpCodes.Ldc_I4, param.Position);
IL.Emit(OpCodes.Ldelem_Ref);
- typeName = typeName.Replace("&", "");
- System.Type unboxedType = System.Type.GetType(typeName);
+ System.Type unboxedType = param.ParameterType.GetElementType();
IL.Emit(OpCodes.Unbox_Any, unboxedType);
@@ -170,23 +151,16 @@
private static OpCode GetStindInstruction(System.Type parameterType)
{
- if (parameterType.IsClass && !parameterType.Name.EndsWith("&"))
+ if (parameterType.IsByRef)
{
- return OpCodes.Stind_Ref;
+ OpCode stindOpCode;
+ if(OpCodesMap.TryGetStindOpCode(parameterType.GetElementType(), out stindOpCode))
+ {
+ return stindOpCode;
+ }
}
-
- string typeName = parameterType.Name;
-
- if (!stindMap.ContainsKey(typeName) && parameterType.IsByRef)
- {
- return OpCodes.Stind_Ref;
- }
-
- Debug.Assert(stindMap.ContainsKey(typeName));
- OpCode result = stindMap[typeName];
-
- return result;
+ return OpCodes.Stind_Ref;
}
private void PushStackTrace(ILGenerator IL)
Added: trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/OpCodesMap.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/OpCodesMap.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/OpCodesMap.cs 2011-04-07 17:19:55 UTC (rev 5629)
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Reflection.Emit;
+
+namespace NHibernate.Proxy.DynamicProxy
+{
+ public static class OpCodesMap
+ {
+ private static readonly Dictionary<System.Type, OpCode> LdindMap = new Dictionary<System.Type, OpCode>
+ {
+ {typeof (Boolean), OpCodes.Ldind_I1},
+ {typeof (SByte), OpCodes.Ldind_I1},
+ {typeof (Byte), OpCodes.Ldind_U1},
+ {typeof (Char), OpCodes.Ldind_I2},
+ {typeof (Int16), OpCodes.Ldind_I2},
+ {typeof (Int32), OpCodes.Ldind_I4},
+ {typeof (Int64), OpCodes.Ldind_I8},
+ {typeof (UInt16), OpCodes.Ldind_U2},
+ {typeof (UInt32), OpCodes.Ldind_U4},
+ {typeof (UInt64), OpCodes.Ldind_I8},
+ {typeof (Single), OpCodes.Ldind_R4},
+ {typeof (Double), OpCodes.Ldind_R8},
+ };
+ private static readonly Dictionary<System.Type, OpCode> StindMap = new Dictionary<System.Type, OpCode>
+ {
+ {typeof (Boolean), OpCodes.Stind_I1},
+ {typeof (SByte), OpCodes.Stind_I1},
+ {typeof (Byte), OpCodes.Stind_I1},
+ {typeof (Char), OpCodes.Stind_I2},
+ {typeof (Int16), OpCodes.Stind_I2},
+ {typeof (Int32), OpCodes.Stind_I4},
+ {typeof (Int64), OpCodes.Stind_I8},
+ {typeof (UInt16), OpCodes.Stind_I2},
+ {typeof (UInt32), OpCodes.Stind_I4},
+ {typeof (UInt64), OpCodes.Stind_I8},
+ {typeof (Single), OpCodes.Stind_R4},
+ {typeof (Double), OpCodes.Stind_R8},
+ };
+
+ public static bool TryGetLdindOpCode(System.Type valueType, out OpCode opCode)
+ {
+ return LdindMap.TryGetValue(valueType, out opCode);
+ }
+
+ public static bool TryGetStindOpCode(System.Type valueType, out OpCode opCode)
+ {
+ return StindMap.TryGetValue(valueType, out opCode);
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/DynamicProxyTests/ProxiedMembers/Fixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/DynamicProxyTests/ProxiedMembers/Fixture.cs 2011-04-06 21:06:29 UTC (rev 5628)
+++ trunk/nhibernate/src/NHibernate.Test/DynamicProxyTests/ProxiedMembers/Fixture.cs 2011-04-07 17:19:55 UTC (rev 5629)
@@ -20,7 +20,6 @@
public class Fixture
{
[Test]
- [Ignore]
public void Proxy()
{
var factory = new ProxyFactory();
@@ -28,11 +27,11 @@
int x;
c.Method1(out x);
- x.Should().Be(3);
+ Assert.AreEqual(3, x);
x = 4;
c.Method2(ref x);
- x.Should().Be(5);
+ Assert.AreEqual(5, x);
}
}
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|