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-04 17:31:22
|
Revision: 5603
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5603&view=rev
Author: fabiomaulo
Date: 2011-04-04 17:31:15 +0000 (Mon, 04 Apr 2011)
Log Message:
-----------
Renamed class to avoid namespace conflicts
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/IJoinMapper.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/IManyToOneMapper.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/JoinMapper.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/KeyManyToOneMapper.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/ManyToOneMapper.cs
trunk/nhibernate/src/NHibernate/NHibernate.csproj
trunk/nhibernate/src/NHibernate.Test/MappingByCode/MappersTests/JoinMapperTests.cs
Added Paths:
-----------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/FetchKind.cs
Removed Paths:
-------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/FetchMode.cs
Copied: trunk/nhibernate/src/NHibernate/Mapping/ByCode/FetchKind.cs (from rev 5602, trunk/nhibernate/src/NHibernate/Mapping/ByCode/FetchMode.cs)
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/FetchKind.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/FetchKind.cs 2011-04-04 17:31:15 UTC (rev 5603)
@@ -0,0 +1,47 @@
+using NHibernate.Cfg.MappingSchema;
+
+namespace NHibernate.Mapping.ByCode
+{
+ public abstract class FetchKind
+ {
+ public static FetchKind Select = new SelectFetchMode();
+ public static FetchKind Join = new JoinFetchMode();
+
+ public abstract HbmFetchMode ToHbm();
+ public abstract HbmJoinFetch ToHbmJoinFetch();
+
+ #region Nested type: JoinFetchMode
+
+ private class JoinFetchMode : FetchKind
+ {
+ public override HbmFetchMode ToHbm()
+ {
+ return HbmFetchMode.Join;
+ }
+
+ public override HbmJoinFetch ToHbmJoinFetch()
+ {
+ return HbmJoinFetch.Join;
+ }
+ }
+
+ #endregion
+
+ #region Nested type: SelectFetchMode
+
+ private class SelectFetchMode : FetchKind
+ {
+ public override HbmFetchMode ToHbm()
+ {
+ return HbmFetchMode.Select;
+ }
+
+ public override HbmJoinFetch ToHbmJoinFetch()
+ {
+ return HbmJoinFetch.Select;
+ }
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
Deleted: trunk/nhibernate/src/NHibernate/Mapping/ByCode/FetchMode.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/FetchMode.cs 2011-04-04 17:27:54 UTC (rev 5602)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/FetchMode.cs 2011-04-04 17:31:15 UTC (rev 5603)
@@ -1,47 +0,0 @@
-using NHibernate.Cfg.MappingSchema;
-
-namespace NHibernate.Mapping.ByCode
-{
- public abstract class FetchMode
- {
- public static FetchMode Select = new SelectFetchMode();
- public static FetchMode Join = new JoinFetchMode();
-
- public abstract HbmFetchMode ToHbm();
- public abstract HbmJoinFetch ToHbmJoinFetch();
-
- #region Nested type: JoinFetchMode
-
- private class JoinFetchMode : FetchMode
- {
- public override HbmFetchMode ToHbm()
- {
- return HbmFetchMode.Join;
- }
-
- public override HbmJoinFetch ToHbmJoinFetch()
- {
- return HbmJoinFetch.Join;
- }
- }
-
- #endregion
-
- #region Nested type: SelectFetchMode
-
- private class SelectFetchMode : FetchMode
- {
- public override HbmFetchMode ToHbm()
- {
- return HbmFetchMode.Select;
- }
-
- public override HbmJoinFetch ToHbmJoinFetch()
- {
- return HbmJoinFetch.Select;
- }
- }
-
- #endregion
- }
-}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/IJoinMapper.cs
===================================================================
(Binary files differ)
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/IManyToOneMapper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/IManyToOneMapper.cs 2011-04-04 17:27:54 UTC (rev 5602)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/IManyToOneMapper.cs 2011-04-04 17:31:15 UTC (rev 5603)
@@ -16,7 +16,7 @@
void Unique(bool unique);
void UniqueKey(string uniquekeyName);
void Index(string indexName);
- void Fetch(FetchMode fetchMode);
+ void Fetch(FetchKind fetchMode);
void Formula(string formula);
void Lazy(LazyRelation lazyRelation);
void Update(bool consideredInUpdateQuery);
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/JoinMapper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/JoinMapper.cs 2011-04-04 17:27:54 UTC (rev 5602)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/JoinMapper.cs 2011-04-04 17:31:15 UTC (rev 5603)
@@ -137,7 +137,7 @@
hbmJoin.optional = isOptional;
}
- public void Fetch(FetchMode fetchMode)
+ public void Fetch(FetchKind fetchMode)
{
hbmJoin.fetch = fetchMode.ToHbmJoinFetch();
}
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/KeyManyToOneMapper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/KeyManyToOneMapper.cs 2011-04-04 17:27:54 UTC (rev 5602)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/KeyManyToOneMapper.cs 2011-04-04 17:31:15 UTC (rev 5603)
@@ -70,7 +70,7 @@
Column(x => x.Index(indexName));
}
- public void Fetch(FetchMode fetchMode)
+ public void Fetch(FetchKind fetchMode)
{
// not supported by HbmKeyManyToOne
}
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/ManyToOneMapper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/ManyToOneMapper.cs 2011-04-04 17:27:54 UTC (rev 5602)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/ManyToOneMapper.cs 2011-04-04 17:31:15 UTC (rev 5603)
@@ -70,7 +70,7 @@
Column(x => x.Index(indexName));
}
- public void Fetch(FetchMode fetchMode)
+ public void Fetch(FetchKind fetchMode)
{
manyToOne.fetch = fetchMode.ToHbm();
manyToOne.fetchSpecified = manyToOne.fetch == HbmFetchMode.Join;
Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-04-04 17:27:54 UTC (rev 5602)
+++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-04-04 17:31:15 UTC (rev 5603)
@@ -282,7 +282,7 @@
<Compile Include="Mapping\ByCode\CollectionLazy.cs" />
<Compile Include="Mapping\ByCode\ExplicitlyDeclaredModel.cs" />
<Compile Include="Mapping\ByCode\FakeModelExplicitDeclarationsHolder.cs" />
- <Compile Include="Mapping\ByCode\FetchMode.cs" />
+ <Compile Include="Mapping\ByCode\FetchKind.cs" />
<Compile Include="Mapping\ByCode\ForClass.cs" />
<Compile Include="Mapping\ByCode\IAccessorPropertyMapper.cs" />
<Compile Include="Mapping\ByCode\IAnyMapper.cs" />
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/MappersTests/JoinMapperTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/MappersTests/JoinMapperTests.cs 2011-04-04 17:27:54 UTC (rev 5602)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/MappersTests/JoinMapperTests.cs 2011-04-04 17:31:15 UTC (rev 5603)
@@ -1,5 +1,6 @@
using System;
using NHibernate.Cfg.MappingSchema;
+using NHibernate.Mapping.ByCode;
using NHibernate.Mapping.ByCode.Impl;
using NUnit.Framework;
using SharpTestsEx;
@@ -172,7 +173,7 @@
var mapdoc = new HbmMapping();
var hbmJoin = new HbmJoin();
var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);
- mapper.Fetch(Mapping.ByCode.FetchMode.Select);
+ mapper.Fetch(FetchKind.Select);
hbmJoin.fetch.Should().Be(HbmJoinFetch.Select);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-04 17:28:00
|
Revision: 5602
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5602&view=rev
Author: fabiomaulo
Date: 2011-04-04 17:27:54 +0000 (Mon, 04 Apr 2011)
Log Message:
-----------
JoinMapper more methods
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/FetchMode.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/JoinMapper.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/MappersTests/JoinMapperTests.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/FetchMode.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/FetchMode.cs 2011-04-04 17:05:30 UTC (rev 5601)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/FetchMode.cs 2011-04-04 17:27:54 UTC (rev 5602)
@@ -8,6 +8,7 @@
public static FetchMode Join = new JoinFetchMode();
public abstract HbmFetchMode ToHbm();
+ public abstract HbmJoinFetch ToHbmJoinFetch();
#region Nested type: JoinFetchMode
@@ -17,6 +18,11 @@
{
return HbmFetchMode.Join;
}
+
+ public override HbmJoinFetch ToHbmJoinFetch()
+ {
+ return HbmJoinFetch.Join;
+ }
}
#endregion
@@ -29,6 +35,11 @@
{
return HbmFetchMode.Select;
}
+
+ public override HbmJoinFetch ToHbmJoinFetch()
+ {
+ return HbmJoinFetch.Select;
+ }
}
#endregion
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/JoinMapper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/JoinMapper.cs 2011-04-04 17:05:30 UTC (rev 5601)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/JoinMapper.cs 2011-04-04 17:27:54 UTC (rev 5602)
@@ -39,7 +39,7 @@
public event TableNameChangedHandler TableNameChanged;
- public void InvokeTableNameChanged(TableNameChangedEventArgs e)
+ private void InvokeTableNameChanged(TableNameChangedEventArgs e)
{
TableNameChangedHandler handler = TableNameChanged;
if (handler != null)
@@ -59,18 +59,38 @@
public void SqlInsert(string sql)
{
+ if (hbmJoin.SqlInsert == null)
+ {
+ hbmJoin.sqlinsert = new HbmCustomSQL();
+ }
+ hbmJoin.sqlinsert.Text = new[] { sql };
}
public void SqlUpdate(string sql)
{
+ if (hbmJoin.SqlUpdate == null)
+ {
+ hbmJoin.sqlupdate = new HbmCustomSQL();
+ }
+ hbmJoin.sqlupdate.Text = new[] { sql };
}
public void SqlDelete(string sql)
{
+ if (hbmJoin.SqlDelete == null)
+ {
+ hbmJoin.sqldelete = new HbmCustomSQL();
+ }
+ hbmJoin.sqldelete.Text = new[] { sql };
}
public void Subselect(string sql)
{
+ if (hbmJoin.Subselect == null)
+ {
+ hbmJoin.subselect = new HbmSubselect();
+ }
+ hbmJoin.subselect.Text = new[] { sql };
}
public void Table(string tableName)
@@ -95,10 +115,12 @@
public void Catalog(string catalogName)
{
+ hbmJoin.catalog = catalogName;
}
public void Schema(string schemaName)
{
+ hbmJoin.schema = schemaName;
}
public void Key(Action<IKeyMapper> keyMapping)
@@ -107,14 +129,17 @@
public void Inverse(bool value)
{
+ hbmJoin.inverse = value;
}
public void Optional(bool isOptional)
{
+ hbmJoin.optional = isOptional;
}
public void Fetch(FetchMode fetchMode)
{
+ hbmJoin.fetch = fetchMode.ToHbmJoinFetch();
}
}
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/MappersTests/JoinMapperTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/MappersTests/JoinMapperTests.cs 2011-04-04 17:05:30 UTC (rev 5601)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/MappersTests/JoinMapperTests.cs 2011-04-04 17:27:54 UTC (rev 5602)
@@ -77,5 +77,103 @@
mapper.Table(" Pizza ");
eventCalled.Should().Be.True();
}
+
+ [Test]
+ public void CanSetCatalog()
+ {
+ var mapdoc = new HbmMapping();
+ var hbmJoin = new HbmJoin();
+ var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);
+ mapper.Catalog("pizza");
+ hbmJoin.catalog.Should().Be("pizza");
+ }
+
+ [Test]
+ public void CanSetSchema()
+ {
+ var mapdoc = new HbmMapping();
+ var hbmJoin = new HbmJoin();
+ var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);
+ mapper.Schema("pizza");
+ hbmJoin.schema.Should().Be("pizza");
+ }
+
+ [Test]
+ public void CanSetSqlInsert()
+ {
+ var mapdoc = new HbmMapping();
+ var hbmJoin = new HbmJoin();
+ var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);
+ mapper.SqlInsert("blah");
+
+ hbmJoin.SqlInsert.Should().Not.Be.Null();
+ hbmJoin.SqlInsert.Text[0].Should().Be("blah");
+ }
+
+ [Test]
+ public void SetSqlUpdate()
+ {
+ var mapdoc = new HbmMapping();
+ var hbmJoin = new HbmJoin();
+ var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);
+ mapper.SqlUpdate("blah");
+
+ hbmJoin.SqlUpdate.Should().Not.Be.Null();
+ hbmJoin.SqlUpdate.Text[0].Should().Be("blah");
+ }
+
+ [Test]
+ public void SetSqlDelete()
+ {
+ var mapdoc = new HbmMapping();
+ var hbmJoin = new HbmJoin();
+ var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);
+ mapper.SqlDelete("blah");
+
+ hbmJoin.SqlDelete.Should().Not.Be.Null();
+ hbmJoin.SqlDelete.Text[0].Should().Be("blah");
+ }
+
+ [Test]
+ public void CanSetSqlSubselect()
+ {
+ var mapdoc = new HbmMapping();
+ var hbmJoin = new HbmJoin();
+ var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);
+ mapper.Subselect("blah");
+
+ hbmJoin.Subselect.Should().Not.Be.Null();
+ hbmJoin.subselect.Text[0].Should().Be("blah");
+ }
+
+ [Test]
+ public void CanSetInverse()
+ {
+ var mapdoc = new HbmMapping();
+ var hbmJoin = new HbmJoin();
+ var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);
+ mapper.Inverse(true);
+ hbmJoin.inverse.Should().Be.True();
+ }
+
+ [Test]
+ public void CanSetOptional()
+ {
+ var mapdoc = new HbmMapping();
+ var hbmJoin = new HbmJoin();
+ var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);
+ mapper.Optional(true);
+ hbmJoin.optional.Should().Be.True();
+ }
+
+ [Test]
+ public void CanSetFetch()
+ {
+ var mapdoc = new HbmMapping();
+ var hbmJoin = new HbmJoin();
+ var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);
+ mapper.Fetch(Mapping.ByCode.FetchMode.Select);
+ hbmJoin.fetch.Should().Be(HbmJoinFetch.Select);
+ }
}
}
\ 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-04 17:05:36
|
Revision: 5601
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5601&view=rev
Author: fabiomaulo
Date: 2011-04-04 17:05:30 +0000 (Mon, 04 Apr 2011)
Log Message:
-----------
Ctor and TableName management for JoinMapper
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/IClassMapper.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/IJoinMapper.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/ClassMapper.cs
trunk/nhibernate/src/NHibernate/NHibernate.csproj
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/JoinMapper.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/MappersTests/
trunk/nhibernate/src/NHibernate.Test/MappingByCode/MappersTests/JoinMapperTests.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/IClassMapper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/IClassMapper.cs 2011-04-04 15:22:56 UTC (rev 5600)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/IClassMapper.cs 2011-04-04 17:05:30 UTC (rev 5601)
@@ -22,7 +22,10 @@
void SchemaAction(SchemaAction action);
}
- public interface IClassMapper : IClassAttributesMapper, IPropertyContainerMapper {}
+ public interface IClassMapper : IClassAttributesMapper, IPropertyContainerMapper
+ {
+ void Join(Action<IJoinMapper> splittedMapping);
+ }
public interface IClassAttributesMapper<TEntity> : IEntityAttributesMapper, IEntitySqlsMapper where TEntity : class
{
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/IJoinMapper.cs
===================================================================
(Binary files differ)
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/ClassMapper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/ClassMapper.cs 2011-04-04 15:22:56 UTC (rev 5600)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/ClassMapper.cs 2011-04-04 17:05:30 UTC (rev 5601)
@@ -168,6 +168,11 @@
classMapping.schemaaction = action.ToSchemaActionString();
}
+ public void Join(Action<IJoinMapper> splittedMapping)
+ {
+ throw new NotImplementedException();
+ }
+
#endregion
#region Implementation of IEntityAttributesMapper
Added: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/JoinMapper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/JoinMapper.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/JoinMapper.cs 2011-04-04 17:05:30 UTC (rev 5601)
@@ -0,0 +1,120 @@
+using System;
+using NHibernate.Cfg.MappingSchema;
+
+namespace NHibernate.Mapping.ByCode.Impl
+{
+ public class TableNameChangedEventArgs
+ {
+ public TableNameChangedEventArgs(string oldName, string newName)
+ {
+ OldName = oldName;
+ NewName = newName;
+ }
+ public string OldName { get; private set; }
+ public string NewName { get; private set; }
+ }
+ public delegate void TableNameChangedHandler(IJoinMapper mapper, TableNameChangedEventArgs args);
+
+ public class JoinMapper: AbstractPropertyContainerMapper,IJoinMapper
+ {
+ private readonly HbmJoin hbmJoin;
+
+ public JoinMapper(System.Type container, string splitGroupId, HbmJoin hbmJoin, HbmMapping mapDoc) : base(container, mapDoc)
+ {
+ if (splitGroupId == null)
+ {
+ throw new ArgumentNullException("splitGroupId");
+ }
+ if (hbmJoin == null)
+ {
+ throw new ArgumentNullException("hbmJoin");
+ }
+ this.hbmJoin = hbmJoin;
+ this.hbmJoin.table = splitGroupId.Trim();
+ if (string.IsNullOrEmpty(this.hbmJoin.table))
+ {
+ throw new ArgumentOutOfRangeException("splitGroupId", "The table-name cant be empty.");
+ }
+ }
+
+ public event TableNameChangedHandler TableNameChanged;
+
+ public void InvokeTableNameChanged(TableNameChangedEventArgs e)
+ {
+ TableNameChangedHandler handler = TableNameChanged;
+ if (handler != null)
+ {
+ handler(this, e);
+ }
+ }
+
+ protected override void AddProperty(object property)
+ {
+ }
+
+ public void Loader(string namedQueryReference)
+ {
+ // not supported by Join
+ }
+
+ public void SqlInsert(string sql)
+ {
+ }
+
+ public void SqlUpdate(string sql)
+ {
+ }
+
+ public void SqlDelete(string sql)
+ {
+ }
+
+ public void Subselect(string sql)
+ {
+ }
+
+ public void Table(string tableName)
+ {
+ if (tableName == null)
+ {
+ throw new ArgumentNullException("tableName");
+ }
+
+ var trimmedName = tableName.Trim();
+ if (string.IsNullOrEmpty(trimmedName))
+ {
+ throw new ArgumentOutOfRangeException("tableName", "The table-name cant be empty.");
+ }
+ var oldName = hbmJoin.table;
+ hbmJoin.table = trimmedName;
+ if(!trimmedName.Equals(oldName))
+ {
+ InvokeTableNameChanged(new TableNameChangedEventArgs(oldName, trimmedName));
+ }
+ }
+
+ public void Catalog(string catalogName)
+ {
+ }
+
+ public void Schema(string schemaName)
+ {
+ }
+
+ public void Key(Action<IKeyMapper> keyMapping)
+ {
+ }
+
+ public void Inverse(bool value)
+ {
+ }
+
+ public void Optional(bool isOptional)
+ {
+ }
+
+ public void Fetch(FetchMode fetchMode)
+ {
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-04-04 15:22:56 UTC (rev 5600)
+++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-04-04 17:05:30 UTC (rev 5601)
@@ -370,6 +370,7 @@
<Compile Include="Mapping\ByCode\Impl\ICustomizersHolder.cs" />
<Compile Include="Mapping\ByCode\Impl\IdMapper.cs" />
<Compile Include="Mapping\ByCode\Impl\JoinedSubclassMapper.cs" />
+ <Compile Include="Mapping\ByCode\Impl\JoinMapper.cs" />
<Compile Include="Mapping\ByCode\Impl\KeyManyToOneMapper.cs" />
<Compile Include="Mapping\ByCode\Impl\KeyMapper.cs" />
<Compile Include="Mapping\ByCode\Impl\KeyPropertyMapper.cs" />
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/MappersTests/JoinMapperTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/MappersTests/JoinMapperTests.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/MappersTests/JoinMapperTests.cs 2011-04-04 17:05:30 UTC (rev 5601)
@@ -0,0 +1,81 @@
+using System;
+using NHibernate.Cfg.MappingSchema;
+using NHibernate.Mapping.ByCode.Impl;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.MappingByCode.MappersTests
+{
+ public class JoinMapperTests
+ {
+ private class MyClass
+ {
+ public int Something { get; set; }
+ }
+
+ [Test]
+ public void WhenCreateWithEmptySplitGroupThenThrows()
+ {
+ var mapdoc = new HbmMapping();
+ var hbmJoin = new HbmJoin();
+ Executing.This(() => new JoinMapper(typeof(MyClass), null, hbmJoin, mapdoc)).Should().Throw<ArgumentNullException>();
+ Executing.This(() => new JoinMapper(typeof(MyClass), "", hbmJoin, mapdoc)).Should().Throw<ArgumentOutOfRangeException>();
+ Executing.This(() => new JoinMapper(typeof(MyClass), " ", hbmJoin, mapdoc)).Should().Throw<ArgumentOutOfRangeException>();
+ }
+
+ [Test]
+ public void WhenCreateWithNullHbmJoinThenThrows()
+ {
+ var mapdoc = new HbmMapping();
+ Executing.This(() => new JoinMapper(typeof(MyClass), "AA", null, mapdoc)).Should().Throw<ArgumentNullException>();
+ }
+
+ [Test]
+ public void WhenCreateThenSetDefaultTableName()
+ {
+ var mapdoc = new HbmMapping();
+ var hbmJoin = new HbmJoin();
+ new JoinMapper(typeof(MyClass), " AA ", hbmJoin, mapdoc);
+ hbmJoin.table.Should().Be("AA");
+ }
+
+ [Test]
+ public void CanSetTable()
+ {
+ var mapdoc = new HbmMapping();
+ var hbmJoin = new HbmJoin();
+ var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);
+ mapper.Table(" Pizza ");
+ hbmJoin.table.Should().Be("Pizza");
+ }
+
+ [Test]
+ public void WhenSetTableNameEmptyThenThrows()
+ {
+ var mapdoc = new HbmMapping();
+ var hbmJoin = new HbmJoin();
+ var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);
+ mapper.Executing(x => x.Table(null)).Throws<ArgumentNullException>();
+ mapper.Executing(x => x.Table("")).Throws<ArgumentOutOfRangeException>();
+ mapper.Executing(x => x.Table(" ")).Throws<ArgumentOutOfRangeException>();
+ }
+
+ [Test]
+ public void WhenTableNameChangesValueThenNotify()
+ {
+ bool eventCalled = false;
+ var mapdoc = new HbmMapping();
+ var hbmJoin = new HbmJoin();
+ var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);
+ mapper.TableNameChanged += (m, x) =>
+ {
+ m.Should().Be.SameInstanceAs(mapper);
+ x.OldName.Should().Be("AA");
+ x.NewName.Should().Be("Pizza");
+ eventCalled = true;
+ };
+ mapper.Table(" Pizza ");
+ eventCalled.Should().Be.True();
+ }
+ }
+}
\ 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-04 15:22:56 UTC (rev 5600)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-04 17:05:30 UTC (rev 5601)
@@ -522,6 +522,7 @@
<Compile Include="MappingByCode\ExpliticMappingTests\RootClassPropertiesSplitsTests.cs" />
<Compile Include="MappingByCode\ExpliticMappingTests\VersionTests.cs" />
<Compile Include="MappingByCode\For.cs" />
+ <Compile Include="MappingByCode\MappersTests\JoinMapperTests.cs" />
<Compile Include="MappingByCode\NatureDemo\Naturalness\Address.cs" />
<Compile Include="MappingByCode\NatureDemo\Naturalness\Animal.cs" />
<Compile Include="MappingByCode\NatureDemo\Naturalness\Classification.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-04 15:23:03
|
Revision: 5600
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5600&view=rev
Author: fabiomaulo
Date: 2011-04-04 15:22:56 +0000 (Mon, 04 Apr 2011)
Log Message:
-----------
Starting properties split management (<join>)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/IClassMapper.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/IModelInspector.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/IPropertyContainerMapper.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ClassCustomizer.cs
trunk/nhibernate/src/NHibernate/NHibernate.csproj
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/IJoinMapper.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/RootClassPropertiesSplitsTests.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-03 19:15:17 UTC (rev 5599)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-04 15:22:56 UTC (rev 5600)
@@ -368,6 +368,11 @@
return IsMappedFor(tablePerClassEntities, type);
}
+ public bool IsTablePerClassSplit(System.Type type, object splitGroupId, MemberInfo member)
+ {
+ return false;
+ }
+
public bool IsTablePerClassHierarchy(System.Type type)
{
ExecuteDelayedTypeRegistration(type);
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/IClassMapper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/IClassMapper.cs 2011-04-03 19:15:17 UTC (rev 5599)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/IClassMapper.cs 2011-04-04 15:22:56 UTC (rev 5600)
@@ -44,5 +44,8 @@
void SchemaAction(SchemaAction action);
}
- public interface IClassMapper<TEntity> : IClassAttributesMapper<TEntity>, IPropertyContainerMapper<TEntity> where TEntity : class {}
+ public interface IClassMapper<TEntity> : IClassAttributesMapper<TEntity>, IPropertyContainerMapper<TEntity> where TEntity : class
+ {
+ void Join(Action<IJoinMapper<TEntity>> splittedMapping);
+ }
}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate/Mapping/ByCode/IJoinMapper.cs
===================================================================
(Binary files differ)
Property changes on: trunk/nhibernate/src/NHibernate/Mapping/ByCode/IJoinMapper.cs
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/IModelInspector.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/IModelInspector.cs 2011-04-03 19:15:17 UTC (rev 5599)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/IModelInspector.cs 2011-04-04 15:22:56 UTC (rev 5600)
@@ -9,6 +9,7 @@
bool IsEntity(System.Type type);
bool IsTablePerClass(System.Type type);
+ bool IsTablePerClassSplit(System.Type type, object splitGroupId, MemberInfo member);
bool IsTablePerClassHierarchy(System.Type type);
bool IsTablePerConcreteClass(System.Type type);
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/IPropertyContainerMapper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/IPropertyContainerMapper.cs 2011-04-03 19:15:17 UTC (rev 5599)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/IPropertyContainerMapper.cs 2011-04-04 15:22:56 UTC (rev 5600)
@@ -5,7 +5,7 @@
namespace NHibernate.Mapping.ByCode
{
- public interface IPropertyContainerMapper : IPlainPropertyContainerMapper
+ public interface ICollectionPropertiesContainerMapper
{
void Set(MemberInfo property, Action<ISetPropertiesMapper> collectionMapping,
Action<ICollectionElementRelation> mapping);
@@ -21,7 +21,9 @@
Action<ICollectionElementRelation> mapping);
}
- public interface IPropertyContainerMapper<TEntity> : IPlainPropertyContainerMapper<TEntity> where TEntity : class
+ public interface IPropertyContainerMapper : ICollectionPropertiesContainerMapper, IPlainPropertyContainerMapper {}
+
+ public interface ICollectionPropertiesContainerMapper<TEntity> where TEntity : class
{
void Set<TElement>(Expression<Func<TEntity, IEnumerable<TElement>>> property,
Action<ISetPropertiesMapper<TEntity, TElement>> collectionMapping,
@@ -39,8 +41,11 @@
Action<IMapPropertiesMapper<TEntity, TKey, TElement>> collectionMapping,
Action<IMapKeyRelation<TKey>> keyMapping,
Action<ICollectionElementRelation<TElement>> mapping);
+
void Map<TKey, TElement>(Expression<Func<TEntity, IDictionary<TKey, TElement>>> property,
- Action<IMapPropertiesMapper<TEntity, TKey, TElement>> collectionMapping,
- Action<ICollectionElementRelation<TElement>> mapping);
+ Action<IMapPropertiesMapper<TEntity, TKey, TElement>> collectionMapping,
+ Action<ICollectionElementRelation<TElement>> mapping);
}
+
+ public interface IPropertyContainerMapper<TEntity> : ICollectionPropertiesContainerMapper<TEntity>, IPlainPropertyContainerMapper<TEntity> where TEntity : class {}
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ClassCustomizer.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ClassCustomizer.cs 2011-04-03 19:15:17 UTC (rev 5599)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ClassCustomizer.cs 2011-04-04 15:22:56 UTC (rev 5600)
@@ -109,6 +109,11 @@
CustomizersHolder.AddCustomizer(typeof (TEntity), (IClassAttributesMapper m) => m.SchemaAction(action));
}
+ public void Join(Action<IJoinMapper<TEntity>> splittedMapping)
+ {
+ throw new NotImplementedException();
+ }
+
public void EntityName(string value)
{
CustomizersHolder.AddCustomizer(typeof (TEntity), (IClassAttributesMapper m) => m.EntityName(value));
Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-04-03 19:15:17 UTC (rev 5599)
+++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-04-04 15:22:56 UTC (rev 5600)
@@ -309,6 +309,7 @@
<Compile Include="Mapping\ByCode\IGeneratorMapper.cs" />
<Compile Include="Mapping\ByCode\IIdMapper.cs" />
<Compile Include="Mapping\ByCode\IJoinedSubclassMapper.cs" />
+ <Compile Include="Mapping\ByCode\IJoinMapper.cs" />
<Compile Include="Mapping\ByCode\IKeyMapper.cs" />
<Compile Include="Mapping\ByCode\IListIndexMapper.cs" />
<Compile Include="Mapping\ByCode\IListPropertiesMapper.cs" />
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/RootClassPropertiesSplitsTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/RootClassPropertiesSplitsTests.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/RootClassPropertiesSplitsTests.cs 2011-04-04 15:22:56 UTC (rev 5600)
@@ -0,0 +1,51 @@
+using NHibernate.Mapping.ByCode;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.MappingByCode.ExpliticMappingTests
+{
+ public class RootClassPropertiesSplitsTests
+ {
+ private class MyClass
+ {
+ public int Id { get; set; }
+ public string Something0 { get; set; }
+ public string SomethingA1 { get; set; }
+ public string SomethingA2 { get; set; }
+ public string SomethingB1 { get; set; }
+ public string SomethingB2 { get; set; }
+ }
+
+ [Test, Ignore("Not implemented yet")]
+ public void WhenSplittedPropertiesThenRegister()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ var mapper = new ModelMapper(inspector);
+ mapper.Class<MyClass>(map =>
+ {
+ map.Id(x => x.Id, idmap => { });
+ map.Join(mj=>
+ {
+ mj.Table("MyClassSplit1");
+ mj.Property(x => x.SomethingA1);
+ mj.Property(x => x.SomethingA2);
+ });
+ map.Join(mj =>
+ {
+ mj.Table("MyClassSplit2");
+ mj.Property(x => x.SomethingB1);
+ mj.Property(x => x.SomethingB2);
+ });
+ map.Property(x => x.Something0);
+ });
+
+ inspector.IsTablePerClassSplit(typeof(MyClass), "MyClassSplit1", For<MyClass>.Property(x => x.Something0)).Should().Be.False();
+ inspector.IsTablePerClassSplit(typeof(MyClass), "MyClassSplit2", For<MyClass>.Property(x => x.Something0)).Should().Be.False();
+
+ inspector.IsTablePerClassSplit(typeof(MyClass), "MyClassSplit1", For<MyClass>.Property(x => x.SomethingA1)).Should().Be.True();
+ inspector.IsTablePerClassSplit(typeof(MyClass), "MyClassSplit1", For<MyClass>.Property(x => x.SomethingA2)).Should().Be.True();
+ inspector.IsTablePerClassSplit(typeof(MyClass), "MyClassSplit2", For<MyClass>.Property(x => x.SomethingB1)).Should().Be.True();
+ inspector.IsTablePerClassSplit(typeof(MyClass), "MyClassSplit2", For<MyClass>.Property(x => x.SomethingB2)).Should().Be.True();
+ }
+ }
+}
\ 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-03 19:15:17 UTC (rev 5599)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-04 15:22:56 UTC (rev 5600)
@@ -519,6 +519,7 @@
<Compile Include="MappingByCode\ExpliticMappingTests\MappingOfPrivateMembersOnRootEntity.cs" />
<Compile Include="MappingByCode\ExpliticMappingTests\NaturalIdTests.cs" />
<Compile Include="MappingByCode\ExpliticMappingTests\PoidTests.cs" />
+ <Compile Include="MappingByCode\ExpliticMappingTests\RootClassPropertiesSplitsTests.cs" />
<Compile Include="MappingByCode\ExpliticMappingTests\VersionTests.cs" />
<Compile Include="MappingByCode\For.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-03 19:15:24
|
Revision: 5599
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5599&view=rev
Author: fabiomaulo
Date: 2011-04-03 19:15:17 +0000 (Sun, 03 Apr 2011)
Log Message:
-----------
Removed not well thought possible API
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/IModelExplicitDeclarationsHolder.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/IModelInspector.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/ComponentMappingRegistrationTests.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/JoinedSubclassMappingStrategyTests.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/RootClassMappingStrategyTests.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassMappingStrategyTests.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/UnionSubclassMappingStrategyTests.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Removed Paths:
-------------
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassJoinMappingStrategyTests.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassJoinSequenceRegistrationTests.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-03 17:53:11 UTC (rev 5598)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-03 19:15:17 UTC (rev 5599)
@@ -26,7 +26,6 @@
private readonly HashSet<MemberInfo> sets = new HashSet<MemberInfo>();
private readonly HashSet<System.Type> tablePerClassEntities = new HashSet<System.Type>();
private readonly HashSet<System.Type> tablePerClassHierarchyEntities = new HashSet<System.Type>();
- private readonly HashSet<System.Type> tablePerClassHierarchyJoinEntities = new HashSet<System.Type>();
private readonly HashSet<System.Type> tablePerConcreteClassEntities = new HashSet<System.Type>();
private readonly HashSet<MemberInfo> versionProperties = new HashSet<MemberInfo>();
private readonly Dictionary<System.Type, Action<System.Type>> delayedEntityRegistrations = new Dictionary<System.Type, Action<System.Type>>();
@@ -53,11 +52,6 @@
get { return tablePerClassHierarchyEntities; }
}
- public IEnumerable<System.Type> TablePerClassHierarchyJoinEntities
- {
- get { return tablePerClassHierarchyJoinEntities; }
- }
-
public IEnumerable<System.Type> TablePerConcreteClassEntities
{
get { return tablePerConcreteClassEntities; }
@@ -209,7 +203,7 @@
{
throw new MappingException(string.Format("Abiguous mapping of {0}. It was registered as root-entity and as subclass for table-per-class-hierarchy strategy", type.FullName));
}
- if (IsMappedFor(tablePerClassEntities, type) || tablePerClassHierarchyJoinEntities.Contains(type) || IsMappedFor(tablePerConcreteClassEntities, type))
+ if (IsMappedFor(tablePerClassEntities, type) || IsMappedFor(tablePerConcreteClassEntities, type))
{
throw new MappingException(string.Format("Abiguous mapping of {0}. It was registered with more than one class-hierarchy strategy", type.FullName));
}
@@ -225,41 +219,6 @@
}
}
- public void AddAsTablePerClassHierarchyJoinEntity(System.Type type)
- {
- AddAsTablePerClassHierarchyJoinEntity(type, false);
- }
-
- public void AddAsTablePerClassHierarchyJoinEntity(System.Type type, bool rootEntityMustExists)
- {
- if (IsComponent(type))
- {
- throw new MappingException(string.Format("Abiguous mapping of {0}. It was registered as entity and as component", type.FullName));
- }
- var rootEntity = GetRootEntityOrNull(type);
- if (rootEntity != null)
- {
- if (rootEntity.Equals(type))
- {
- throw new MappingException(string.Format("Abiguous mapping of {0}. It was registered as root-entity and as subclass for table-per-class-hierarchy strategy", type.FullName));
- }
- if (IsMappedFor(tablePerClassEntities, type) || IsMappedFor(tablePerClassHierarchyEntities, type) || IsMappedFor(tablePerConcreteClassEntities, type))
- {
- throw new MappingException(string.Format("Abiguous mapping of {0}. It was registered with more than one class-hierarchy strategy", type.FullName));
- }
- tablePerClassHierarchyEntities.Add(rootEntity);
- tablePerClassHierarchyJoinEntities.Add(type);
- }
- else
- {
- if (rootEntityMustExists)
- {
- throw new MappingException(string.Format("The root entity for {0} was never registered", type.FullName));
- }
- EnlistTypeRegistration(type, t => AddAsTablePerClassHierarchyJoinEntity(t, true));
- }
- }
-
public void AddAsTablePerConcreteClassEntity(System.Type type)
{
AddAsTablePerConcreteClassEntity(type, false);
@@ -415,12 +374,6 @@
return IsMappedFor(tablePerClassHierarchyEntities, type);
}
- public bool IsTablePerClassHierarchyJoin(System.Type type)
- {
- ExecuteDelayedTypeRegistration(type);
- return tablePerClassHierarchyJoinEntities.Contains(type);
- }
-
public bool IsTablePerConcreteClass(System.Type type)
{
ExecuteDelayedTypeRegistration(type);
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/IModelExplicitDeclarationsHolder.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/IModelExplicitDeclarationsHolder.cs 2011-04-03 17:53:11 UTC (rev 5598)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/IModelExplicitDeclarationsHolder.cs 2011-04-03 19:15:17 UTC (rev 5599)
@@ -9,7 +9,6 @@
IEnumerable<System.Type> Components { get; }
IEnumerable<System.Type> TablePerClassEntities { get; }
IEnumerable<System.Type> TablePerClassHierarchyEntities { get; }
- IEnumerable<System.Type> TablePerClassHierarchyJoinEntities { get; }
IEnumerable<System.Type> TablePerConcreteClassEntities { get; }
IEnumerable<MemberInfo> OneToOneRelations { get; }
@@ -34,7 +33,6 @@
void AddAsComponent(System.Type type);
void AddAsTablePerClassEntity(System.Type type);
void AddAsTablePerClassHierarchyEntity(System.Type type);
- void AddAsTablePerClassHierarchyJoinEntity(System.Type type);
void AddAsTablePerConcreteClassEntity(System.Type type);
void AddAsOneToOneRelation(MemberInfo member);
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/IModelInspector.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/IModelInspector.cs 2011-04-03 17:53:11 UTC (rev 5598)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/IModelInspector.cs 2011-04-03 19:15:17 UTC (rev 5599)
@@ -10,7 +10,6 @@
bool IsTablePerClass(System.Type type);
bool IsTablePerClassHierarchy(System.Type type);
- bool IsTablePerClassHierarchyJoin(System.Type type);
bool IsTablePerConcreteClass(System.Type type);
bool IsOneToOne(MemberInfo member);
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/ComponentMappingRegistrationTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/ComponentMappingRegistrationTests.cs 2011-04-03 17:53:11 UTC (rev 5598)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/ComponentMappingRegistrationTests.cs 2011-04-03 19:15:17 UTC (rev 5599)
@@ -57,15 +57,6 @@
}
[Test]
- public void WhenRegisteredAsComponetThenCantRegisterAsSubclassJoin()
- {
- var inspector = new ExplicitlyDeclaredModel();
- inspector.AddAsComponent(typeof(MyComponent));
-
- inspector.Executing(x => x.AddAsTablePerClassHierarchyJoinEntity(typeof(MyComponent))).Throws<MappingException>();
- }
-
- [Test]
public void WhenRegisteredAsComponetThenCantRegisterAsUnionSubclass()
{
var inspector = new ExplicitlyDeclaredModel();
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/JoinedSubclassMappingStrategyTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/JoinedSubclassMappingStrategyTests.cs 2011-04-03 17:53:11 UTC (rev 5598)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/JoinedSubclassMappingStrategyTests.cs 2011-04-03 19:15:17 UTC (rev 5599)
@@ -28,7 +28,6 @@
inspector.IsTablePerClass(typeof(Inherited1)).Should().Be.True();
inspector.IsTablePerClassHierarchy(typeof(Inherited1)).Should().Be.False();
- inspector.IsTablePerClassHierarchyJoin(typeof(Inherited1)).Should().Be.False();
inspector.IsTablePerConcreteClass(typeof(Inherited1)).Should().Be.False();
}
@@ -41,7 +40,6 @@
inspector.IsTablePerClass(typeof(Inherited2)).Should().Be.True();
inspector.IsTablePerClassHierarchy(typeof(Inherited2)).Should().Be.False();
- inspector.IsTablePerClassHierarchyJoin(typeof(Inherited2)).Should().Be.False();
inspector.IsTablePerConcreteClass(typeof(Inherited2)).Should().Be.False();
}
@@ -56,16 +54,6 @@
}
[Test]
- public void WhenRegisteredAsJoinedSubclassThenCantRegisterAsSubclassJoin()
- {
- var inspector = new ExplicitlyDeclaredModel();
- inspector.AddAsRootEntity(typeof(MyClass));
- inspector.AddAsTablePerClassEntity(typeof(Inherited1));
-
- inspector.Executing(x => x.AddAsTablePerClassHierarchyJoinEntity(typeof(Inherited1))).Throws<MappingException>();
- }
-
- [Test]
public void WhenRegisteredAsJoinedSubclassThenCantRegisterAsUnionSubclass()
{
var inspector = new ExplicitlyDeclaredModel();
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/RootClassMappingStrategyTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/RootClassMappingStrategyTests.cs 2011-04-03 17:53:11 UTC (rev 5598)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/RootClassMappingStrategyTests.cs 2011-04-03 19:15:17 UTC (rev 5599)
@@ -26,7 +26,6 @@
inspector.AddAsRootEntity(typeof(MyClass));
inspector.IsTablePerClass(typeof(MyClass)).Should().Be.False();
inspector.IsTablePerClassHierarchy(typeof(MyClass)).Should().Be.False();
- inspector.IsTablePerClassHierarchyJoin(typeof(MyClass)).Should().Be.False();
inspector.IsTablePerConcreteClass(typeof(MyClass)).Should().Be.False();
}
@@ -38,7 +37,6 @@
inspector.AddAsTablePerClassEntity(typeof(Inherited1));
inspector.IsTablePerClass(typeof(MyClass)).Should().Be.True();
inspector.IsTablePerClassHierarchy(typeof(MyClass)).Should().Be.False();
- inspector.IsTablePerClassHierarchyJoin(typeof(MyClass)).Should().Be.False();
inspector.IsTablePerConcreteClass(typeof(MyClass)).Should().Be.False();
}
@@ -50,7 +48,6 @@
inspector.AddAsTablePerClassEntity(typeof(Inherited2));
inspector.IsTablePerClass(typeof(MyClass)).Should().Be.True();
inspector.IsTablePerClassHierarchy(typeof(MyClass)).Should().Be.False();
- inspector.IsTablePerClassHierarchyJoin(typeof(MyClass)).Should().Be.False();
inspector.IsTablePerConcreteClass(typeof(MyClass)).Should().Be.False();
}
@@ -62,7 +59,6 @@
inspector.AddAsTablePerClassHierarchyEntity(typeof(Inherited1));
inspector.IsTablePerClass(typeof(MyClass)).Should().Be.False();
inspector.IsTablePerClassHierarchy(typeof(MyClass)).Should().Be.True();
- inspector.IsTablePerClassHierarchyJoin(typeof(MyClass)).Should().Be.False();
inspector.IsTablePerConcreteClass(typeof(MyClass)).Should().Be.False();
}
@@ -75,37 +71,11 @@
inspector.IsTablePerClass(typeof(MyClass)).Should().Be.False();
inspector.IsTablePerClassHierarchy(typeof(MyClass)).Should().Be.True();
- inspector.IsTablePerClassHierarchyJoin(typeof(MyClass)).Should().Be.False();
inspector.IsTablePerConcreteClass(typeof(MyClass)).Should().Be.False();
}
- [Test]
- public void WhenRegisteredSubclassJoinThenTheStrategyIsDefinedEvenForRoot()
- {
- var inspector = new ExplicitlyDeclaredModel();
- inspector.AddAsRootEntity(typeof(MyClass));
- inspector.AddAsTablePerClassHierarchyJoinEntity(typeof(Inherited1));
- inspector.IsTablePerClass(typeof(MyClass)).Should().Be.False();
- inspector.IsTablePerClassHierarchy(typeof(MyClass)).Should().Be.True();
- inspector.IsTablePerClassHierarchyJoin(typeof(MyClass)).Should().Be.False();
- inspector.IsTablePerConcreteClass(typeof(MyClass)).Should().Be.False();
- }
-
[Test]
- public void WhenRegisteredDeepSubclassJoinThenTheStrategyIsDefinedEvenForRoot()
- {
- var inspector = new ExplicitlyDeclaredModel();
- inspector.AddAsRootEntity(typeof(MyClass));
- inspector.AddAsTablePerClassHierarchyJoinEntity(typeof(Inherited2));
-
- inspector.IsTablePerClass(typeof(MyClass)).Should().Be.False();
- inspector.IsTablePerClassHierarchy(typeof(MyClass)).Should().Be.True();
- inspector.IsTablePerClassHierarchyJoin(typeof(MyClass)).Should().Be.False();
- inspector.IsTablePerConcreteClass(typeof(MyClass)).Should().Be.False();
- }
-
- [Test]
public void WhenRegisteredConcreteClassThenTheStrategyIsDefinedEvenForRoot()
{
var inspector = new ExplicitlyDeclaredModel();
@@ -114,7 +84,6 @@
inspector.IsTablePerClass(typeof(MyClass)).Should().Be.False();
inspector.IsTablePerClassHierarchy(typeof(MyClass)).Should().Be.False();
- inspector.IsTablePerClassHierarchyJoin(typeof(MyClass)).Should().Be.False();
inspector.IsTablePerConcreteClass(typeof(MyClass)).Should().Be.True();
}
@@ -127,7 +96,6 @@
inspector.IsTablePerClass(typeof(MyClass)).Should().Be.False();
inspector.IsTablePerClassHierarchy(typeof(MyClass)).Should().Be.False();
- inspector.IsTablePerClassHierarchyJoin(typeof(MyClass)).Should().Be.False();
inspector.IsTablePerConcreteClass(typeof(MyClass)).Should().Be.True();
}
Deleted: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassJoinMappingStrategyTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassJoinMappingStrategyTests.cs 2011-04-03 17:53:11 UTC (rev 5598)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassJoinMappingStrategyTests.cs 2011-04-03 19:15:17 UTC (rev 5599)
@@ -1,88 +0,0 @@
-using NHibernate.Mapping.ByCode;
-using NUnit.Framework;
-using SharpTestsEx;
-
-namespace NHibernate.Test.MappingByCode.ExplicitlyDeclaredModelTests
-{
- public class SubclassJoinMappingStrategyTests
- {
- private class MyClass
- {
-
- }
- private class Inherited1 : MyClass
- {
-
- }
- private class Inherited2 : Inherited1
- {
-
- }
-
- [Test]
- public void WhenRegisteredAsSubclassJoinThenIsRegistered()
- {
- var inspector = new ExplicitlyDeclaredModel();
- inspector.AddAsRootEntity(typeof(MyClass));
- inspector.AddAsTablePerClassHierarchyJoinEntity(typeof(Inherited1));
-
- inspector.IsTablePerClass(typeof(Inherited1)).Should().Be.False();
- inspector.IsTablePerClassHierarchy(typeof(Inherited1)).Should().Be.True();
- inspector.IsTablePerClassHierarchyJoin(typeof(Inherited1)).Should().Be.True();
- inspector.IsTablePerConcreteClass(typeof(Inherited1)).Should().Be.False();
- }
-
- [Test]
- public void WhenRegisteredAsDeepSubclassJoinThenIsRegistered()
- {
- var inspector = new ExplicitlyDeclaredModel();
- inspector.AddAsRootEntity(typeof(MyClass));
- inspector.AddAsTablePerClassHierarchyJoinEntity(typeof(Inherited2));
-
- inspector.IsTablePerClass(typeof(Inherited2)).Should().Be.False();
- inspector.IsTablePerClassHierarchy(typeof(Inherited2)).Should().Be.True();
- inspector.IsTablePerClassHierarchyJoin(typeof(Inherited2)).Should().Be.True();
- inspector.IsTablePerConcreteClass(typeof(Inherited2)).Should().Be.False();
- }
-
- [Test]
- public void WhenRegisteredAsSubclassJoinThenCantRegisterAsJoinedSubclass()
- {
- var inspector = new ExplicitlyDeclaredModel();
- inspector.AddAsRootEntity(typeof(MyClass));
- inspector.AddAsTablePerClassHierarchyJoinEntity(typeof(Inherited1));
-
- inspector.Executing(x => x.AddAsTablePerClassEntity(typeof(Inherited1))).Throws<MappingException>();
- }
-
- [Test]
- public void WhenRegisteredAsSubclassJoinThenCantRegisterAsSubclass()
- {
- var inspector = new ExplicitlyDeclaredModel();
- inspector.AddAsRootEntity(typeof(MyClass));
- inspector.AddAsTablePerClassHierarchyJoinEntity(typeof(Inherited1));
-
- inspector.Executing(x => x.AddAsTablePerClassHierarchyEntity(typeof(Inherited1))).Throws<MappingException>();
- }
-
- [Test]
- public void WhenRegisteredAsSubclassJoinThenCantRegisterAsUnionSubclass()
- {
- var inspector = new ExplicitlyDeclaredModel();
- inspector.AddAsRootEntity(typeof(MyClass));
- inspector.AddAsTablePerClassHierarchyJoinEntity(typeof(Inherited1));
-
- inspector.Executing(x => x.AddAsTablePerConcreteClassEntity(typeof(Inherited1))).Throws<MappingException>();
- }
-
- [Test]
- public void WhenRegisteredAsSubclassJoinThenIsEntity()
- {
- var inspector = new ExplicitlyDeclaredModel();
- inspector.AddAsRootEntity(typeof(MyClass));
- inspector.AddAsTablePerClassHierarchyJoinEntity(typeof(Inherited1));
-
- inspector.IsEntity(typeof(Inherited1)).Should().Be.True();
- }
- }
-}
\ No newline at end of file
Deleted: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassJoinSequenceRegistrationTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassJoinSequenceRegistrationTests.cs 2011-04-03 17:53:11 UTC (rev 5598)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassJoinSequenceRegistrationTests.cs 2011-04-03 19:15:17 UTC (rev 5599)
@@ -1,37 +0,0 @@
-using NHibernate.Mapping.ByCode;
-using NUnit.Framework;
-using SharpTestsEx;
-
-namespace NHibernate.Test.MappingByCode.ExplicitlyDeclaredModelTests
-{
- public class SubclassJoinSequenceRegistrationTests
- {
- private class MyClass
- {
-
- }
- private class Inherited1 : MyClass
- {
-
- }
-
- [Test]
- public void WhenRegisterSubclassJoinBeforeRootThenIsRegistered()
- {
- var inspector = new ExplicitlyDeclaredModel();
- inspector.AddAsTablePerClassHierarchyJoinEntity(typeof(Inherited1));
-
- inspector.AddAsRootEntity(typeof(MyClass));
- inspector.IsTablePerClassHierarchyJoin(typeof(Inherited1)).Should().Be.True();
- }
-
- [Test]
- public void WhenRegisterSubclassWithNoRootThenThrows()
- {
- var inspector = new ExplicitlyDeclaredModel();
- inspector.AddAsTablePerClassHierarchyJoinEntity(typeof(Inherited1));
-
- inspector.Executing(x => x.IsTablePerClassHierarchyJoin(typeof(Inherited1))).Throws<MappingException>();
- }
- }
-}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassMappingStrategyTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassMappingStrategyTests.cs 2011-04-03 17:53:11 UTC (rev 5598)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassMappingStrategyTests.cs 2011-04-03 19:15:17 UTC (rev 5599)
@@ -28,7 +28,6 @@
inspector.IsTablePerClass(typeof(Inherited1)).Should().Be.False();
inspector.IsTablePerClassHierarchy(typeof(Inherited1)).Should().Be.True();
- inspector.IsTablePerClassHierarchyJoin(typeof(Inherited1)).Should().Be.False();
inspector.IsTablePerConcreteClass(typeof(Inherited1)).Should().Be.False();
}
@@ -41,7 +40,6 @@
inspector.IsTablePerClass(typeof(Inherited2)).Should().Be.False();
inspector.IsTablePerClassHierarchy(typeof(Inherited2)).Should().Be.True();
- inspector.IsTablePerClassHierarchyJoin(typeof(Inherited2)).Should().Be.False();
inspector.IsTablePerConcreteClass(typeof(Inherited2)).Should().Be.False();
}
@@ -56,16 +54,6 @@
}
[Test]
- public void WhenRegisteredAsSubclassThenCantRegisterAsSubclassJoin()
- {
- var inspector = new ExplicitlyDeclaredModel();
- inspector.AddAsRootEntity(typeof(MyClass));
- inspector.AddAsTablePerClassHierarchyEntity(typeof(Inherited1));
-
- inspector.Executing(x => x.AddAsTablePerClassHierarchyJoinEntity(typeof(Inherited1))).Throws<MappingException>();
- }
-
- [Test]
public void WhenRegisteredAsSubclassThenCantRegisterAsUnionSubclass()
{
var inspector = new ExplicitlyDeclaredModel();
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/UnionSubclassMappingStrategyTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/UnionSubclassMappingStrategyTests.cs 2011-04-03 17:53:11 UTC (rev 5598)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/UnionSubclassMappingStrategyTests.cs 2011-04-03 19:15:17 UTC (rev 5599)
@@ -28,7 +28,6 @@
inspector.IsTablePerClass(typeof(Inherited1)).Should().Be.False();
inspector.IsTablePerClassHierarchy(typeof(Inherited1)).Should().Be.False();
- inspector.IsTablePerClassHierarchyJoin(typeof(Inherited1)).Should().Be.False();
inspector.IsTablePerConcreteClass(typeof(Inherited1)).Should().Be.True();
}
@@ -41,7 +40,6 @@
inspector.IsTablePerClass(typeof(Inherited2)).Should().Be.False();
inspector.IsTablePerClassHierarchy(typeof(Inherited2)).Should().Be.False();
- inspector.IsTablePerClassHierarchyJoin(typeof(Inherited2)).Should().Be.False();
inspector.IsTablePerConcreteClass(typeof(Inherited2)).Should().Be.True();
}
@@ -56,16 +54,6 @@
}
[Test]
- public void WhenRegisteredAsUnionSubclassThenCantRegisterAsSubclassJoin()
- {
- var inspector = new ExplicitlyDeclaredModel();
- inspector.AddAsRootEntity(typeof(MyClass));
- inspector.AddAsTablePerConcreteClassEntity(typeof(Inherited1));
-
- inspector.Executing(x => x.AddAsTablePerClassHierarchyJoinEntity(typeof(Inherited1))).Throws<MappingException>();
- }
-
- [Test]
public void WhenRegisteredAsUnionSubclassThenCantRegisterAsJoinedSubclass()
{
var inspector = new ExplicitlyDeclaredModel();
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-03 17:53:11 UTC (rev 5598)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-03 19:15:17 UTC (rev 5599)
@@ -512,8 +512,6 @@
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\JoinedSubclassMappingStrategyTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\JoinedSubclassSequenceRegistrationTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\RootClassMappingStrategyTests.cs" />
- <Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\SubclassJoinMappingStrategyTests.cs" />
- <Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\SubclassJoinSequenceRegistrationTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\SubclassMappingStrategyTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\SubclassSequenceRegistrationTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\UnionSubclassMappingStrategyTests.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-03 17:53:18
|
Revision: 5598
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5598&view=rev
Author: fabiomaulo
Date: 2011-04-03 17:53:11 +0000 (Sun, 03 Apr 2011)
Log Message:
-----------
Minor (changed method name)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/IModelInspector.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/ModelMapper.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-03 17:03:44 UTC (rev 5597)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-03 17:53:11 UTC (rev 5598)
@@ -447,7 +447,7 @@
return oneToManyRelations.Contains(member);
}
- public bool IsHeterogeneousAssociation(MemberInfo member)
+ public bool IsAny(MemberInfo member)
{
return any.Contains(member);
}
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/IModelInspector.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/IModelInspector.cs 2011-04-03 17:03:44 UTC (rev 5597)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/IModelInspector.cs 2011-04-03 17:53:11 UTC (rev 5598)
@@ -17,7 +17,7 @@
bool IsManyToOne(MemberInfo member);
bool IsManyToMany(MemberInfo member);
bool IsOneToMany(MemberInfo member);
- bool IsHeterogeneousAssociation(MemberInfo member);
+ bool IsAny(MemberInfo member);
bool IsPersistentId(MemberInfo member);
bool IsVersion(MemberInfo member);
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/ModelMapper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/ModelMapper.cs 2011-04-03 17:03:44 UTC (rev 5597)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/ModelMapper.cs 2011-04-03 17:53:11 UTC (rev 5598)
@@ -730,7 +730,7 @@
{
MapProperty(member, memberPath, naturalIdMapper);
}
- else if (modelInspector.IsHeterogeneousAssociation(member))
+ else if (modelInspector.IsAny(member))
{
MapAny(member, memberPath, naturalIdMapper);
}
@@ -774,7 +774,7 @@
{
MapProperty(member, memberPath, propertiesContainer);
}
- else if (modelInspector.IsHeterogeneousAssociation(member))
+ else if (modelInspector.IsAny(member))
{
MapAny(member, memberPath, propertiesContainer);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-03 17:03:50
|
Revision: 5597
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5597&view=rev
Author: fabiomaulo
Date: 2011-04-03 17:03:44 +0000 (Sun, 03 Apr 2011)
Log Message:
-----------
Fixed nuget template ;)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/NHibernate.nuspec.template
Modified: trunk/nhibernate/src/NHibernate/NHibernate.nuspec.template
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernate.nuspec.template 2011-04-03 17:00:28 UTC (rev 5596)
+++ trunk/nhibernate/src/NHibernate/NHibernate.nuspec.template 2011-04-03 17:03:44 UTC (rev 5597)
@@ -4,12 +4,10 @@
<id>NHibernate</id>
<version>x.y.z</version>
<authors>NHibernate community, Hibernate community</authors>
- <summary>DONT INSTALL IT DIRECTLY. Use only as reference for others frameworks.</summary>
+ <summary>
+ NHibernate is a mature, open source object-relational mapper for the .NET framework. It's actively developed , fully featured and used in thousands of successful projects.
+ </summary>
<description>
- DONT INSTALL IT DIRECTLY
- Only as reference for others frameworks.
- see NHibernate.Castle, NHibernate.LinFu, NHibernate.Spring.
-
NHibernate is a mature, open source object-relational mapper for the .NET framework. It's actively developed , fully featured and used in thousands of successful projects.
</description>
<language>en-US</language>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-03 17:00:34
|
Revision: 5596
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5596&view=rev
Author: fabiomaulo
Date: 2011-04-03 17:00:28 +0000 (Sun, 03 Apr 2011)
Log Message:
-----------
Fixed version property registration
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ClassCustomizer.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/VersionTests.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ClassCustomizer.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ClassCustomizer.cs 2011-04-03 16:35:43 UTC (rev 5595)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ClassCustomizer.cs 2011-04-03 17:00:28 UTC (rev 5596)
@@ -74,6 +74,7 @@
public void Version<TProperty>(Expression<Func<TEntity, TProperty>> versionProperty, Action<IVersionMapper> versionMapping)
{
MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(versionProperty);
+ ExplicitDeclarationsHolder.AddAsVersionProperty(member);
CustomizersHolder.AddCustomizer(typeof (TEntity), (IClassAttributesMapper m) => m.Version(member, versionMapping));
}
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/VersionTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/VersionTests.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/VersionTests.cs 2011-04-03 17:00:28 UTC (rev 5596)
@@ -0,0 +1,30 @@
+using NHibernate.Mapping.ByCode;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.MappingByCode.ExpliticMappingTests
+{
+ public class VersionTests
+ {
+ private class MyClass
+ {
+ public int Id { get; set; }
+ public int Version { get; set; }
+ }
+
+ [Test]
+ public void WhenPropertyUsedAsPoidThenRegister()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ var mapper = new ModelMapper(inspector);
+ mapper.Class<MyClass>(
+ map =>
+ {
+ map.Id(x => x.Id, idmap => { });
+ map.Version(x => x.Version, vm => { });
+ });
+
+ inspector.IsVersion(For<MyClass>.Property(x => x.Version)).Should().Be.True();
+ }
+ }
+}
\ 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-03 16:35:43 UTC (rev 5595)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-03 17:00:28 UTC (rev 5596)
@@ -521,6 +521,7 @@
<Compile Include="MappingByCode\ExpliticMappingTests\MappingOfPrivateMembersOnRootEntity.cs" />
<Compile Include="MappingByCode\ExpliticMappingTests\NaturalIdTests.cs" />
<Compile Include="MappingByCode\ExpliticMappingTests\PoidTests.cs" />
+ <Compile Include="MappingByCode\ExpliticMappingTests\VersionTests.cs" />
<Compile Include="MappingByCode\For.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-03 16:35:49
|
Revision: 5595
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5595&view=rev
Author: fabiomaulo
Date: 2011-04-03 16:35:43 +0000 (Sun, 03 Apr 2011)
Log Message:
-----------
Fixed poid properties registration
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ClassCustomizer.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/PoidTests.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ClassCustomizer.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ClassCustomizer.cs 2011-04-03 16:25:16 UTC (rev 5594)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ClassCustomizer.cs 2011-04-03 16:35:43 UTC (rev 5595)
@@ -27,11 +27,13 @@
public void Id<TProperty>(Expression<Func<TEntity, TProperty>> idProperty, Action<IIdMapper> idMapper)
{
MemberInfo 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);
CustomizersHolder.AddCustomizer(typeof(TEntity), m => m.Id(idProperty, idMapper));
}
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/PoidTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/PoidTests.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/PoidTests.cs 2011-04-03 16:35:43 UTC (rev 5595)
@@ -0,0 +1,24 @@
+using NHibernate.Mapping.ByCode;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.MappingByCode.ExpliticMappingTests
+{
+ public class PoidTests
+ {
+ private class MyClass
+ {
+ public int Id { get; set; }
+ }
+
+ [Test]
+ public void WhenPropertyUsedAsPoidThenRegister()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ var mapper = new ModelMapper(inspector);
+ mapper.Class<MyClass>(map => map.Id(x => x.Id, idmap => { }));
+
+ inspector.IsPersistentId(For<MyClass>.Property(x => x.Id)).Should().Be.True();
+ }
+ }
+}
\ 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-03 16:25:16 UTC (rev 5594)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-03 16:35:43 UTC (rev 5595)
@@ -520,6 +520,7 @@
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\UnionSubclassSequenceRegistrationTests.cs" />
<Compile Include="MappingByCode\ExpliticMappingTests\MappingOfPrivateMembersOnRootEntity.cs" />
<Compile Include="MappingByCode\ExpliticMappingTests\NaturalIdTests.cs" />
+ <Compile Include="MappingByCode\ExpliticMappingTests\PoidTests.cs" />
<Compile Include="MappingByCode\For.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-03 16:25:23
|
Revision: 5594
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5594&view=rev
Author: fabiomaulo
Date: 2011-04-03 16:25:16 +0000 (Sun, 03 Apr 2011)
Log Message:
-----------
Natural Id mapping fixed
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/IClassMapper.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/IPlainPropertyContainerMapper.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ClassCustomizer.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/PropertyContainerCustomizer.cs
trunk/nhibernate/src/NHibernate/NHibernate.csproj
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/NaturalIdCustomizer.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/NaturalIdTests.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/For.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/IClassMapper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/IClassMapper.cs 2011-04-03 14:46:14 UTC (rev 5593)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/IClassMapper.cs 2011-04-03 16:25:16 UTC (rev 5594)
@@ -36,7 +36,8 @@
void Schema(string schemaName);
void Mutable(bool isMutable);
void Version<TProperty>(Expression<Func<TEntity, TProperty>> versionProperty, Action<IVersionMapper> versionMapping);
- void NaturalId(Action<INaturalIdAttributesMapper> naturalIdMapping);
+ void NaturalId(Action<IBasePlainPropertyContainerMapper<TEntity>> naturalIdPropertiesMapping, Action<INaturalIdAttributesMapper> naturalIdMapping);
+ void NaturalId(Action<IBasePlainPropertyContainerMapper<TEntity>> naturalIdPropertiesMapping);
void Cache(Action<ICacheMapper> cacheMapping);
void Filter(string filterName, Action<IFilterMapper> filterMapping);
void Where(string whereClause);
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/IPlainPropertyContainerMapper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/IPlainPropertyContainerMapper.cs 2011-04-03 14:46:14 UTC (rev 5593)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/IPlainPropertyContainerMapper.cs 2011-04-03 16:25:16 UTC (rev 5594)
@@ -19,19 +19,23 @@
void OneToOne(MemberInfo property, Action<IOneToOneMapper> mapping);
}
- public interface IPlainPropertyContainerMapper<TContainer>
+ public interface IBasePlainPropertyContainerMapper<TContainer>
{
void Property<TProperty>(Expression<Func<TContainer, TProperty>> property);
void Property<TProperty>(Expression<Func<TContainer, TProperty>> property, Action<IPropertyMapper> mapping);
void Property(FieldInfo member, Action<IPropertyMapper> mapping);
void Component<TComponent>(Expression<Func<TContainer, TComponent>> property,
- Action<IComponentMapper<TComponent>> mapping) where TComponent : class;
+ Action<IComponentMapper<TComponent>> mapping) where TComponent : class;
void ManyToOne<TProperty>(Expression<Func<TContainer, TProperty>> property, Action<IManyToOneMapper> mapping) where TProperty : class;
void ManyToOne<TProperty>(Expression<Func<TContainer, TProperty>> property) where TProperty : class;
- void OneToOne<TProperty>(Expression<Func<TContainer, TProperty>> property, Action<IOneToOneMapper> mapping) where TProperty : class;
void Any<TProperty>(Expression<Func<TContainer, TProperty>> property, System.Type idTypeOfMetaType, Action<IAnyMapper> mapping) where TProperty : class;
}
+
+ public interface IPlainPropertyContainerMapper<TContainer> : IBasePlainPropertyContainerMapper<TContainer>
+ {
+ void OneToOne<TProperty>(Expression<Func<TContainer, TProperty>> property, Action<IOneToOneMapper> mapping) where TProperty : class;
+ }
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ClassCustomizer.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ClassCustomizer.cs 2011-04-03 14:46:14 UTC (rev 5593)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ClassCustomizer.cs 2011-04-03 16:25:16 UTC (rev 5594)
@@ -75,11 +75,17 @@
CustomizersHolder.AddCustomizer(typeof (TEntity), (IClassAttributesMapper m) => m.Version(member, versionMapping));
}
- public void NaturalId(Action<INaturalIdAttributesMapper> naturalIdMapping)
+ public void NaturalId(Action<IBasePlainPropertyContainerMapper<TEntity>> naturalIdPropertiesMapping, Action<INaturalIdAttributesMapper> naturalIdMapping)
{
- CustomizersHolder.AddCustomizer(typeof (TEntity), (IClassAttributesMapper m) => m.NaturalId(nidm => naturalIdMapping(nidm)));
+ naturalIdPropertiesMapping(new NaturalIdCustomizer<TEntity>(ExplicitDeclarationsHolder, CustomizersHolder));
+ CustomizersHolder.AddCustomizer(typeof(TEntity), (IClassAttributesMapper m) => m.NaturalId(nidm => naturalIdMapping(nidm)));
}
+ public void NaturalId(Action<IBasePlainPropertyContainerMapper<TEntity>> naturalIdPropertiesMapping)
+ {
+ NaturalId(naturalIdPropertiesMapping, mapAttr => { });
+ }
+
public void Cache(Action<ICacheMapper> cacheMapping)
{
CustomizersHolder.AddCustomizer(typeof (TEntity), (IClassAttributesMapper m) => m.Cache(cacheMapping));
Added: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/NaturalIdCustomizer.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/NaturalIdCustomizer.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/NaturalIdCustomizer.cs 2011-04-03 16:25:16 UTC (rev 5594)
@@ -0,0 +1,61 @@
+using System.Reflection;
+
+namespace NHibernate.Mapping.ByCode.Impl.CustomizersImpl
+{
+ public class NaturalIdCustomizer<TEntity> : PropertyContainerCustomizer<TEntity>, IBasePlainPropertyContainerMapper<TEntity> where TEntity : class
+ {
+ public NaturalIdCustomizer(IModelExplicitDeclarationsHolder explicitDeclarationsHolder, ICustomizersHolder customizersHolder)
+ : base(explicitDeclarationsHolder, customizersHolder, null) {}
+
+ public override void Property<TProperty>(System.Linq.Expressions.Expression<System.Func<TEntity, TProperty>> property, System.Action<IPropertyMapper> mapping)
+ {
+ MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property);
+ MemberInfo memberOf = TypeExtensions.DecodeMemberAccessExpressionOf(property);
+ ExplicitDeclarationsHolder.AddAsNaturalId(member);
+ ExplicitDeclarationsHolder.AddAsNaturalId(memberOf);
+ base.Property(property, mapping);
+ }
+
+ public override void Property(FieldInfo member, System.Action<IPropertyMapper> mapping)
+ {
+ ExplicitDeclarationsHolder.AddAsNaturalId(member);
+ base.Property(member, mapping);
+ }
+
+ public override void Component<TComponent>(System.Linq.Expressions.Expression<System.Func<TEntity, TComponent>> property, System.Action<IComponentMapper<TComponent>> mapping)
+ {
+ MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property);
+ MemberInfo memberOf = TypeExtensions.DecodeMemberAccessExpressionOf(property);
+ ExplicitDeclarationsHolder.AddAsNaturalId(member);
+ ExplicitDeclarationsHolder.AddAsNaturalId(memberOf);
+ base.Component(property, mapping);
+ }
+
+ public override void Any<TProperty>(System.Linq.Expressions.Expression<System.Func<TEntity, TProperty>> property, System.Type idTypeOfMetaType, System.Action<IAnyMapper> mapping)
+ {
+ MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property);
+ MemberInfo memberOf = TypeExtensions.DecodeMemberAccessExpressionOf(property);
+ ExplicitDeclarationsHolder.AddAsNaturalId(member);
+ ExplicitDeclarationsHolder.AddAsNaturalId(memberOf);
+ base.Any(property, idTypeOfMetaType, mapping);
+ }
+
+ public override void ManyToOne<TProperty>(System.Linq.Expressions.Expression<System.Func<TEntity, TProperty>> property)
+ {
+ MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property);
+ MemberInfo memberOf = TypeExtensions.DecodeMemberAccessExpressionOf(property);
+ ExplicitDeclarationsHolder.AddAsNaturalId(member);
+ ExplicitDeclarationsHolder.AddAsNaturalId(memberOf);
+ base.ManyToOne(property);
+ }
+
+ public override void ManyToOne<TProperty>(System.Linq.Expressions.Expression<System.Func<TEntity, TProperty>> property, System.Action<IManyToOneMapper> mapping)
+ {
+ MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property);
+ MemberInfo memberOf = TypeExtensions.DecodeMemberAccessExpressionOf(property);
+ ExplicitDeclarationsHolder.AddAsNaturalId(member);
+ ExplicitDeclarationsHolder.AddAsNaturalId(memberOf);
+ base.ManyToOne(property, mapping);
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/PropertyContainerCustomizer.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/PropertyContainerCustomizer.cs 2011-04-03 14:46:14 UTC (rev 5593)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/PropertyContainerCustomizer.cs 2011-04-03 16:25:16 UTC (rev 5594)
@@ -22,13 +22,17 @@
protected ICustomizersHolder CustomizersHolder { get; private set; }
protected PropertyPath PropertyPath { get; private set; }
+ protected IModelExplicitDeclarationsHolder ExplicitDeclarationsHolder
+ {
+ get { return explicitDeclarationsHolder; }
+ }
public void Property<TProperty>(Expression<Func<TEntity, TProperty>> property)
{
Property(property, x => { });
}
- public void Property<TProperty>(Expression<Func<TEntity, TProperty>> property, Action<IPropertyMapper> mapping)
+ public virtual void Property<TProperty>(Expression<Func<TEntity, TProperty>> property, Action<IPropertyMapper> mapping)
{
MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property);
MemberInfo memberOf = TypeExtensions.DecodeMemberAccessExpressionOf(property);
@@ -38,13 +42,13 @@
explicitDeclarationsHolder.AddAsProperty(memberOf);
}
- public void Property(FieldInfo member, Action<IPropertyMapper> mapping)
+ public virtual void Property(FieldInfo member, Action<IPropertyMapper> mapping)
{
CustomizersHolder.AddCustomizer(new PropertyPath(PropertyPath, member), mapping);
explicitDeclarationsHolder.AddAsProperty(member);
}
- public void Component<TComponent>(Expression<Func<TEntity, TComponent>> property,
+ public virtual void Component<TComponent>(Expression<Func<TEntity, TComponent>> property,
Action<IComponentMapper<TComponent>> mapping) where TComponent : class
{
MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property);
@@ -53,7 +57,7 @@
mapping(new ComponentCustomizer<TComponent>(explicitDeclarationsHolder, CustomizersHolder, new PropertyPath(PropertyPath, memberOf)));
}
- public void ManyToOne<TProperty>(Expression<Func<TEntity, TProperty>> property, Action<IManyToOneMapper> mapping)
+ public virtual void ManyToOne<TProperty>(Expression<Func<TEntity, TProperty>> property, Action<IManyToOneMapper> mapping)
where TProperty : class
{
MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property);
@@ -64,7 +68,7 @@
explicitDeclarationsHolder.AddAsManyToOneRelation(memberOf);
}
- public void ManyToOne<TProperty>(Expression<Func<TEntity, TProperty>> property) where TProperty : class
+ public virtual void ManyToOne<TProperty>(Expression<Func<TEntity, TProperty>> property) where TProperty : class
{
ManyToOne(property, x => { });
}
@@ -80,7 +84,7 @@
explicitDeclarationsHolder.AddAsOneToOneRelation(memberOf);
}
- public void Any<TProperty>(Expression<Func<TEntity, TProperty>> property, System.Type idTypeOfMetaType, Action<IAnyMapper> mapping)
+ public virtual void Any<TProperty>(Expression<Func<TEntity, TProperty>> property, System.Type idTypeOfMetaType, Action<IAnyMapper> mapping)
where TProperty : class
{
MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property);
Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-04-03 14:46:14 UTC (rev 5593)
+++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-04-03 16:25:16 UTC (rev 5594)
@@ -353,6 +353,7 @@
<Compile Include="Mapping\ByCode\Impl\CustomizersImpl\MapKeyManyToManyCustomizer.cs" />
<Compile Include="Mapping\ByCode\Impl\CustomizersImpl\MapKeyRelationCustomizer.cs" />
<Compile Include="Mapping\ByCode\Impl\CustomizersImpl\MapPropertiesCustomizer.cs" />
+ <Compile Include="Mapping\ByCode\Impl\CustomizersImpl\NaturalIdCustomizer.cs" />
<Compile Include="Mapping\ByCode\Impl\CustomizersImpl\OneToManyCustomizer.cs" />
<Compile Include="Mapping\ByCode\Impl\CustomizersImpl\PropertyContainerCustomizer.cs" />
<Compile Include="Mapping\ByCode\Impl\CustomizersImpl\SetPropertiesCustomizer.cs" />
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/NaturalIdTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/NaturalIdTests.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/NaturalIdTests.cs 2011-04-03 16:25:16 UTC (rev 5594)
@@ -0,0 +1,55 @@
+using System;
+using NHibernate.Mapping.ByCode;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.MappingByCode.ExpliticMappingTests
+{
+ public class NaturalIdTests
+ {
+ private class MyClass
+ {
+ public int Id { get; set; }
+ public string Name { get; set; }
+ public Related Related { get; set; }
+ public MyComponent MyComponent { get; set; }
+ public object Any { get; set; }
+ }
+
+ private class Related
+ {
+ public int Id { get; set; }
+ }
+
+ private class MyComponent
+ {
+ public string FirstName { get; set; }
+ }
+
+ [Test]
+ public void WhenDefineRootEntityThenRegister()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ var mapper = new ModelMapper(inspector);
+ mapper.Class<MyClass>(map =>
+ {
+ map.Id(x => x.Id, idmap => { });
+ map.NaturalId(nidm =>
+ {
+ nidm.Property(x => x.Name);
+ nidm.ManyToOne(x => x.Related);
+ nidm.Component(x => x.MyComponent, cmap =>
+ {
+ cmap.Property(y => y.FirstName);
+ });
+ nidm.Any(x => x.Any, typeof(int), anymap => { });
+ });
+ });
+
+ inspector.IsMemberOfNaturalId(For<MyClass>.Property(x => x.Name)).Should().Be.True();
+ inspector.IsMemberOfNaturalId(For<MyClass>.Property(x => x.Related)).Should().Be.True();
+ inspector.IsMemberOfNaturalId(For<MyClass>.Property(x => x.MyComponent)).Should().Be.True();
+ inspector.IsMemberOfNaturalId(For<MyClass>.Property(x => x.Any)).Should().Be.True();
+ }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/For.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/For.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/For.cs 2011-04-03 16:25:16 UTC (rev 5594)
@@ -0,0 +1,19 @@
+using System;
+using System.Linq.Expressions;
+using System.Reflection;
+using NHibernate.Mapping.ByCode;
+
+namespace NHibernate.Test.MappingByCode
+{
+ public static class For<T>
+ {
+ public static MemberInfo Property(Expression<Func<T, object>> propertyGetter)
+ {
+ if (propertyGetter == null)
+ {
+ return null;
+ }
+ return TypeExtensions.DecodeMemberAccessExpression(propertyGetter);
+ }
+ }
+}
\ 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-03 14:46:14 UTC (rev 5593)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-03 16:25:16 UTC (rev 5594)
@@ -519,6 +519,8 @@
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\UnionSubclassMappingStrategyTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\UnionSubclassSequenceRegistrationTests.cs" />
<Compile Include="MappingByCode\ExpliticMappingTests\MappingOfPrivateMembersOnRootEntity.cs" />
+ <Compile Include="MappingByCode\ExpliticMappingTests\NaturalIdTests.cs" />
+ <Compile Include="MappingByCode\For.cs" />
<Compile Include="MappingByCode\NatureDemo\Naturalness\Address.cs" />
<Compile Include="MappingByCode\NatureDemo\Naturalness\Animal.cs" />
<Compile Include="MappingByCode\NatureDemo\Naturalness\Classification.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-03 14:46:25
|
Revision: 5593
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5593&view=rev
Author: fabiomaulo
Date: 2011-04-03 14:46:14 +0000 (Sun, 03 Apr 2011)
Log Message:
-----------
Minor (reorganized namespace)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/BasicMappingOfSimpleClass.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/ColumnsNamingConvetions.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/MappingOfPrivateMembersOnRootEntity.cs
Removed Paths:
-------------
trunk/nhibernate/src/NHibernate.Test/MappingByCode/BasicMappingOfSimpleClass.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ColumnsNamingConvetions.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/MappingOfPrivateMembersOnRootEntity.cs
Deleted: trunk/nhibernate/src/NHibernate.Test/MappingByCode/BasicMappingOfSimpleClass.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/BasicMappingOfSimpleClass.cs 2011-04-03 14:03:09 UTC (rev 5592)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/BasicMappingOfSimpleClass.cs 2011-04-03 14:46:14 UTC (rev 5593)
@@ -1,98 +0,0 @@
-using System.Linq;
-using NHibernate.Cfg.MappingSchema;
-using NHibernate.Mapping.ByCode;
-using NHibernate.Mapping.ByCode.Impl;
-using NUnit.Framework;
-using SharpTestsEx;
-
-namespace NHibernate.Test.MappingByCode
-{
- public class BasicMappingOfSimpleClass
- {
- public class MyClass
- {
- public int Id { get; set; }
- public string Something { get; set; }
- }
-
- [Test]
- public void MapClassWithIdAndProperty()
- {
- var mapper = new ModelMapper();
- mapper.Class<MyClass>(ca =>
- {
- ca.Id(x => x.Id, map =>
- {
- map.Column("MyClassId");
- map.Generator(Generators.HighLow, gmap => gmap.Params(new { max_low = 100 }));
- });
- ca.Property(x => x.Something, map => map.Length(150));
- });
- var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) });
- ModelIsWellFormed(hbmMapping);
- }
-
- [Test]
- public void WhenDuplicatePropertiesDoesNotDuplicateMapping()
- {
- var mapper = new ModelMapper();
- mapper.Class<MyClass>(ca =>
- {
- ca.Id(x => x.Id, map =>
- {
- map.Column("MyClassId");
- });
- ca.Id(x => x.Id, map =>
- {
- map.Generator(Generators.HighLow, gmap => gmap.Params(new { max_low = 100 }));
- });
- ca.Property(x => x.Something);
- ca.Property(x => x.Something, map => map.Length(150));
- });
- var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) });
- ModelIsWellFormed(hbmMapping);
- }
-
- [Test]
- public void WhenDuplicateClassDoesNotDuplicateMapping()
- {
- var mapper = new ModelMapper();
- mapper.Class<MyClass>(ca =>
- {
- ca.Id(x => x.Id, map =>
- {
- map.Generator(Generators.HighLow, gmap => gmap.Params(new { max_low = 100 }));
- });
- ca.Property(x => x.Something);
- });
-
- mapper.Class<MyClass>(ca =>
- {
- ca.Id(x => x.Id, map =>
- {
- map.Column("MyClassId");
- });
- ca.Property(x => x.Something, map => map.Length(150));
- });
- var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) });
- ModelIsWellFormed(hbmMapping);
- }
-
- private void ModelIsWellFormed(HbmMapping hbmMapping)
- {
- var hbmClass = hbmMapping.RootClasses[0];
- hbmClass.Should().Not.Be.Null();
- var hbmId = hbmClass.Id;
- hbmId.Should().Not.Be.Null();
- hbmId.name.Should().Be("Id");
- var hbmGenerator = hbmId.generator;
- hbmGenerator.Should().Not.Be.Null();
- hbm...@cl...().Be("hilo");
- hbmGenerator.param[0].name.Should().Be("max_low");
- hbmGenerator.param[0].GetText().Should().Be("100");
- var hbmProperty = hbmClass.Properties.OfType<HbmProperty>().Single();
- hbmProperty.name.Should().Be("Something");
- hbmProperty.length.Should().Be("150");
- }
- }
-}
\ No newline at end of file
Deleted: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ColumnsNamingConvetions.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ColumnsNamingConvetions.cs 2011-04-03 14:03:09 UTC (rev 5592)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ColumnsNamingConvetions.cs 2011-04-03 14:46:14 UTC (rev 5593)
@@ -1,67 +0,0 @@
-using System.Linq;
-using NHibernate.Cfg.MappingSchema;
-using NHibernate.Mapping.ByCode;
-using NUnit.Framework;
-using SharpTestsEx;
-
-namespace NHibernate.Test.MappingByCode
-{
- public class ColumnsNamingConvetions
- {
- public class MyClass
- {
- public int Id { get; set; }
- public string Something { get; set; }
- }
-
- [Test]
- public void MapClassWithConventions()
- {
- var mapper = new ModelMapper();
-
- mapper.BeforeMapClass +=
- (mi, t, map) => map.Id(x => x.Column((t.Name+"id").ToUpper()));
- mapper.BeforeMapProperty +=
- (mi, propertyPath, map) => map.Column(propertyPath.ToColumnName().ToUpper());
-
- mapper.Class<MyClass>(ca =>
- {
- ca.Id(x => x.Id, map => { });
- ca.Property(x => x.Something);
- });
- var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) });
-
- var hbmClass = hbmMapping.RootClasses[0];
- hbmClass.Should().Not.Be.Null();
- var hbmId = hbmClass.Id;
- hbmId.column1.Should().Be("MYCLASSID");
- var hbmProperty = hbmClass.Properties.OfType<HbmProperty>().Single();
- hbmProperty.column.Should().Be("SOMETHING");
- }
-
- [Test]
- public void MapClassWithHardConventions()
- {
- var mapper = new ModelMapper();
-
- mapper.AfterMapClass +=
- (mi, t, map) => map.Id(x => x.Column((t.Name + "id").ToUpper()));
- mapper.AfterMapProperty +=
- (mi, propertyPath, map) => map.Column(propertyPath.ToColumnName().ToUpper());
-
- mapper.Class<MyClass>(ca =>
- {
- ca.Id(x => x.Id, map => map.Column("Whatever"));
- ca.Property(x => x.Something, map => map.Column("Whatever"));
- });
- var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) });
-
- var hbmClass = hbmMapping.RootClasses[0];
- hbmClass.Should().Not.Be.Null();
- var hbmId = hbmClass.Id;
- hbmId.column1.Should().Be("MYCLASSID");
- var hbmProperty = hbmClass.Properties.OfType<HbmProperty>().Single();
- hbmProperty.column.Should().Be("SOMETHING");
- }
- }
-}
\ No newline at end of file
Copied: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/BasicMappingOfSimpleClass.cs (from rev 5587, trunk/nhibernate/src/NHibernate.Test/MappingByCode/BasicMappingOfSimpleClass.cs)
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/BasicMappingOfSimpleClass.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/BasicMappingOfSimpleClass.cs 2011-04-03 14:46:14 UTC (rev 5593)
@@ -0,0 +1,97 @@
+using System.Linq;
+using NHibernate.Cfg.MappingSchema;
+using NHibernate.Mapping.ByCode;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.MappingByCode.ExpliticMappingTests
+{
+ public class BasicMappingOfSimpleClass
+ {
+ public class MyClass
+ {
+ public int Id { get; set; }
+ public string Something { get; set; }
+ }
+
+ [Test]
+ public void MapClassWithIdAndProperty()
+ {
+ var mapper = new ModelMapper();
+ mapper.Class<MyClass>(ca =>
+ {
+ ca.Id(x => x.Id, map =>
+ {
+ map.Column("MyClassId");
+ map.Generator(Generators.HighLow, gmap => gmap.Params(new { max_low = 100 }));
+ });
+ ca.Property(x => x.Something, map => map.Length(150));
+ });
+ var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) });
+ ModelIsWellFormed(hbmMapping);
+ }
+
+ [Test]
+ public void WhenDuplicatePropertiesDoesNotDuplicateMapping()
+ {
+ var mapper = new ModelMapper();
+ mapper.Class<MyClass>(ca =>
+ {
+ ca.Id(x => x.Id, map =>
+ {
+ map.Column("MyClassId");
+ });
+ ca.Id(x => x.Id, map =>
+ {
+ map.Generator(Generators.HighLow, gmap => gmap.Params(new { max_low = 100 }));
+ });
+ ca.Property(x => x.Something);
+ ca.Property(x => x.Something, map => map.Length(150));
+ });
+ var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) });
+ ModelIsWellFormed(hbmMapping);
+ }
+
+ [Test]
+ public void WhenDuplicateClassDoesNotDuplicateMapping()
+ {
+ var mapper = new ModelMapper();
+ mapper.Class<MyClass>(ca =>
+ {
+ ca.Id(x => x.Id, map =>
+ {
+ map.Generator(Generators.HighLow, gmap => gmap.Params(new { max_low = 100 }));
+ });
+ ca.Property(x => x.Something);
+ });
+
+ mapper.Class<MyClass>(ca =>
+ {
+ ca.Id(x => x.Id, map =>
+ {
+ map.Column("MyClassId");
+ });
+ ca.Property(x => x.Something, map => map.Length(150));
+ });
+ var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) });
+ ModelIsWellFormed(hbmMapping);
+ }
+
+ private void ModelIsWellFormed(HbmMapping hbmMapping)
+ {
+ var hbmClass = hbmMapping.RootClasses[0];
+ hbmClass.Should().Not.Be.Null();
+ var hbmId = hbmClass.Id;
+ hbmId.Should().Not.Be.Null();
+ hbmId.name.Should().Be("Id");
+ var hbmGenerator = hbmId.generator;
+ hbmGenerator.Should().Not.Be.Null();
+ hbm...@cl...().Be("hilo");
+ hbmGenerator.param[0].name.Should().Be("max_low");
+ hbmGenerator.param[0].GetText().Should().Be("100");
+ var hbmProperty = hbmClass.Properties.OfType<HbmProperty>().Single();
+ hbmProperty.name.Should().Be("Something");
+ hbmProperty.length.Should().Be("150");
+ }
+ }
+}
\ No newline at end of file
Copied: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/ColumnsNamingConvetions.cs (from rev 5587, trunk/nhibernate/src/NHibernate.Test/MappingByCode/ColumnsNamingConvetions.cs)
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/ColumnsNamingConvetions.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/ColumnsNamingConvetions.cs 2011-04-03 14:46:14 UTC (rev 5593)
@@ -0,0 +1,67 @@
+using System.Linq;
+using NHibernate.Cfg.MappingSchema;
+using NHibernate.Mapping.ByCode;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.MappingByCode.ExpliticMappingTests
+{
+ public class ColumnsNamingConvetions
+ {
+ public class MyClass
+ {
+ public int Id { get; set; }
+ public string Something { get; set; }
+ }
+
+ [Test]
+ public void MapClassWithConventions()
+ {
+ var mapper = new ModelMapper();
+
+ mapper.BeforeMapClass +=
+ (mi, t, map) => map.Id(x => x.Column((t.Name+"id").ToUpper()));
+ mapper.BeforeMapProperty +=
+ (mi, propertyPath, map) => map.Column(propertyPath.ToColumnName().ToUpper());
+
+ mapper.Class<MyClass>(ca =>
+ {
+ ca.Id(x => x.Id, map => { });
+ ca.Property(x => x.Something);
+ });
+ var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) });
+
+ var hbmClass = hbmMapping.RootClasses[0];
+ hbmClass.Should().Not.Be.Null();
+ var hbmId = hbmClass.Id;
+ hbmId.column1.Should().Be("MYCLASSID");
+ var hbmProperty = hbmClass.Properties.OfType<HbmProperty>().Single();
+ hbmProperty.column.Should().Be("SOMETHING");
+ }
+
+ [Test]
+ public void MapClassWithHardConventions()
+ {
+ var mapper = new ModelMapper();
+
+ mapper.AfterMapClass +=
+ (mi, t, map) => map.Id(x => x.Column((t.Name + "id").ToUpper()));
+ mapper.AfterMapProperty +=
+ (mi, propertyPath, map) => map.Column(propertyPath.ToColumnName().ToUpper());
+
+ mapper.Class<MyClass>(ca =>
+ {
+ ca.Id(x => x.Id, map => map.Column("Whatever"));
+ ca.Property(x => x.Something, map => map.Column("Whatever"));
+ });
+ var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) });
+
+ var hbmClass = hbmMapping.RootClasses[0];
+ hbmClass.Should().Not.Be.Null();
+ var hbmId = hbmClass.Id;
+ hbmId.column1.Should().Be("MYCLASSID");
+ var hbmProperty = hbmClass.Properties.OfType<HbmProperty>().Single();
+ hbmProperty.column.Should().Be("SOMETHING");
+ }
+ }
+}
\ No newline at end of file
Copied: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/MappingOfPrivateMembersOnRootEntity.cs (from rev 5587, trunk/nhibernate/src/NHibernate.Test/MappingByCode/MappingOfPrivateMembersOnRootEntity.cs)
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/MappingOfPrivateMembersOnRootEntity.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/MappingOfPrivateMembersOnRootEntity.cs 2011-04-03 14:46:14 UTC (rev 5593)
@@ -0,0 +1,48 @@
+using System.Linq;
+using NHibernate.Cfg.MappingSchema;
+using NHibernate.Mapping.ByCode;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.MappingByCode.ExpliticMappingTests
+{
+ public class MappingOfPrivateMembersOnRootEntity
+ {
+ public class MyClass
+ {
+ private int id;
+ private string something;
+ }
+
+ [Test]
+ public void MapClassWithIdAndProperty()
+ {
+ var mapper = new ModelMapper();
+ mapper.Class<MyClass>(ca =>
+ {
+ ca.Id(ForClass<MyClass>.Field("id"), map =>
+ {
+ map.Column("MyClassId");
+ map.Generator(Generators.HighLow, gmap => gmap.Params(new { max_low = 100 }));
+ });
+ ca.Property(ForClass<MyClass>.Field("something"), map => map.Length(150));
+ });
+ 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.name.Should().Be("id");
+ hbmId.access.Should().Be("field");
+ var hbmGenerator = hbmId.generator;
+ hbmGenerator.Should().Not.Be.Null();
+ hbm...@cl...().Be("hilo");
+ hbmGenerator.param[0].name.Should().Be("max_low");
+ hbmGenerator.param[0].GetText().Should().Be("100");
+ var hbmProperty = hbmClass.Properties.OfType<HbmProperty>().Single();
+ hbmProperty.name.Should().Be("something");
+ hbmProperty.access.Should().Be("field");
+ hbmProperty.length.Should().Be("150");
+ }
+ }
+}
\ No newline at end of file
Deleted: trunk/nhibernate/src/NHibernate.Test/MappingByCode/MappingOfPrivateMembersOnRootEntity.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/MappingOfPrivateMembersOnRootEntity.cs 2011-04-03 14:03:09 UTC (rev 5592)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/MappingOfPrivateMembersOnRootEntity.cs 2011-04-03 14:46:14 UTC (rev 5593)
@@ -1,49 +0,0 @@
-using System.Linq;
-using NHibernate.Cfg.MappingSchema;
-using NHibernate.Mapping.ByCode;
-using NHibernate.Mapping.ByCode.Impl;
-using NUnit.Framework;
-using SharpTestsEx;
-
-namespace NHibernate.Test.MappingByCode
-{
- public class MappingOfPrivateMembersOnRootEntity
- {
- public class MyClass
- {
- private int id;
- private string something;
- }
-
- [Test]
- public void MapClassWithIdAndProperty()
- {
- var mapper = new ModelMapper();
- mapper.Class<MyClass>(ca =>
- {
- ca.Id(ForClass<MyClass>.Field("id"), map =>
- {
- map.Column("MyClassId");
- map.Generator(Generators.HighLow, gmap => gmap.Params(new { max_low = 100 }));
- });
- ca.Property(ForClass<MyClass>.Field("something"), map => map.Length(150));
- });
- 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.name.Should().Be("id");
- hbmId.access.Should().Be("field");
- var hbmGenerator = hbmId.generator;
- hbmGenerator.Should().Not.Be.Null();
- hbm...@cl...().Be("hilo");
- hbmGenerator.param[0].name.Should().Be("max_low");
- hbmGenerator.param[0].GetText().Should().Be("100");
- var hbmProperty = hbmClass.Properties.OfType<HbmProperty>().Single();
- hbmProperty.name.Should().Be("something");
- hbmProperty.access.Should().Be("field");
- hbmProperty.length.Should().Be("150");
- }
- }
-}
\ 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-03 14:03:09 UTC (rev 5592)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-03 14:46:14 UTC (rev 5593)
@@ -506,8 +506,8 @@
<Compile Include="Linq\ByMethod\SumTests.cs" />
<Compile Include="Logging\Log4NetLoggerTest.cs" />
<Compile Include="Logging\LoggerProviderTest.cs" />
- <Compile Include="MappingByCode\BasicMappingOfSimpleClass.cs" />
- <Compile Include="MappingByCode\ColumnsNamingConvetions.cs" />
+ <Compile Include="MappingByCode\ExpliticMappingTests\BasicMappingOfSimpleClass.cs" />
+ <Compile Include="MappingByCode\ExpliticMappingTests\ColumnsNamingConvetions.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\ComponentMappingRegistrationTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\JoinedSubclassMappingStrategyTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\JoinedSubclassSequenceRegistrationTests.cs" />
@@ -518,7 +518,7 @@
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\SubclassSequenceRegistrationTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\UnionSubclassMappingStrategyTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\UnionSubclassSequenceRegistrationTests.cs" />
- <Compile Include="MappingByCode\MappingOfPrivateMembersOnRootEntity.cs" />
+ <Compile Include="MappingByCode\ExpliticMappingTests\MappingOfPrivateMembersOnRootEntity.cs" />
<Compile Include="MappingByCode\NatureDemo\Naturalness\Address.cs" />
<Compile Include="MappingByCode\NatureDemo\Naturalness\Animal.cs" />
<Compile Include="MappingByCode\NatureDemo\Naturalness\Classification.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-03 14:03:15
|
Revision: 5592
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5592&view=rev
Author: fabiomaulo
Date: 2011-04-03 14:03:09 +0000 (Sun, 03 Apr 2011)
Log Message:
-----------
Mapping component just once
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/ShowXmlDemo.cs
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/ShowXmlDemo.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/ShowXmlDemo.cs 2011-04-03 13:52:47 UTC (rev 5591)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/ShowXmlDemo.cs 2011-04-03 14:03:09 UTC (rev 5592)
@@ -19,8 +19,17 @@
{
var mapper = new ModelMapper();
- mapper.Class<Animal>(rc=>
+ mapper.Component<Address>(comp =>
{
+ comp.Property(address => address.Street);
+ comp.Property(address => address.City);
+ comp.Property(address => address.PostalCode);
+ comp.Property(address => address.Country);
+ comp.ManyToOne(address => address.StateProvince);
+ });
+
+ mapper.Class<Animal>(rc =>
+ {
rc.Id(x => x.Id, map => map.Generator(Generators.Native));
rc.Property(animal => animal.Description);
@@ -73,14 +82,7 @@
cm.Lazy(CollectionLazy.NoLazy);
cm.Sort();
}, cer => { });
- jsc.Map(human => human.Addresses, cm => { }, rel => rel.Component(comp =>
- {
- comp.Property(address => address.Street);
- comp.Property(address => address.City);
- comp.Property(address => address.PostalCode);
- comp.Property(address => address.Country);
- comp.ManyToOne(address => address.StateProvince);
- }));
+ jsc.Map(human => human.Addresses, cm => { }, rel => rel.Component(comp => { }));
});
mapper.Class<User>(rc =>
@@ -99,14 +101,7 @@
rc.Property(zoo => zoo.Classification);
rc.Map(zoo => zoo.Mammals, cm => { }, rel => rel.OneToMany());
rc.Map(zoo => zoo.Animals, cm => { cm.Inverse(true); }, rel => rel.OneToMany());
- rc.Component(zoo => zoo.Address, comp =>
- {
- comp.Property(address => address.Street);
- comp.Property(address => address.City);
- comp.Property(address => address.PostalCode);
- comp.Property(address => address.Country);
- comp.ManyToOne(address => address.StateProvince);
- });
+ rc.Component(zoo => zoo.Address, comp => { });
});
mapper.Subclass<PettingZoo>(sc => { });
@@ -119,6 +114,5 @@
});
return mapper.CompileMappingFor(typeof (Animal).Assembly.GetTypes().Where(t => t.Namespace == typeof (Animal).Namespace));
}
-
}
}
\ 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-03 13:52:53
|
Revision: 5591
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5591&view=rev
Author: fabiomaulo
Date: 2011-04-03 13:52:47 +0000 (Sun, 03 Apr 2011)
Log Message:
-----------
Minor
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/ShowXmlDemo.cs
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/ShowXmlDemo.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/ShowXmlDemo.cs 2011-04-03 13:52:07 UTC (rev 5590)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/ShowXmlDemo.cs 2011-04-03 13:52:47 UTC (rev 5591)
@@ -73,7 +73,7 @@
cm.Lazy(CollectionLazy.NoLazy);
cm.Sort();
}, cer => { });
- jsc.Map(human => human.Addresses, cm => { }, mk => { }, rel => rel.Component(comp =>
+ jsc.Map(human => human.Addresses, cm => { }, rel => rel.Component(comp =>
{
comp.Property(address => address.Street);
comp.Property(address => address.City);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-03 13:52:13
|
Revision: 5590
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5590&view=rev
Author: fabiomaulo
Date: 2011-04-03 13:52:07 +0000 (Sun, 03 Apr 2011)
Log Message:
-----------
Simplified API
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/IPropertyContainerMapper.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/PropertyContainerCustomizer.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/ShowXmlDemo.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/IPropertyContainerMapper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/IPropertyContainerMapper.cs 2011-04-03 13:43:54 UTC (rev 5589)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/IPropertyContainerMapper.cs 2011-04-03 13:52:07 UTC (rev 5590)
@@ -39,5 +39,8 @@
Action<IMapPropertiesMapper<TEntity, TKey, TElement>> collectionMapping,
Action<IMapKeyRelation<TKey>> keyMapping,
Action<ICollectionElementRelation<TElement>> mapping);
+ void Map<TKey, TElement>(Expression<Func<TEntity, IDictionary<TKey, TElement>>> property,
+ Action<IMapPropertiesMapper<TEntity, TKey, TElement>> collectionMapping,
+ Action<ICollectionElementRelation<TElement>> mapping);
}
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/PropertyContainerCustomizer.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/PropertyContainerCustomizer.cs 2011-04-03 13:43:54 UTC (rev 5589)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/PropertyContainerCustomizer.cs 2011-04-03 13:52:07 UTC (rev 5590)
@@ -149,5 +149,12 @@
keyMapping(new MapKeyRelationCustomizer<TKey>(explicitDeclarationsHolder, memberOfPath, CustomizersHolder));
mapping(new CollectionElementRelationCustomizer<TElement>(explicitDeclarationsHolder, memberOfPath, CustomizersHolder));
}
+
+ public void Map<TKey, TElement>(Expression<Func<TEntity, IDictionary<TKey, TElement>>> property,
+ Action<IMapPropertiesMapper<TEntity, TKey, TElement>> collectionMapping,
+ Action<ICollectionElementRelation<TElement>> mapping)
+ {
+ Map(property, collectionMapping, keyMapping => { }, mapping);
+ }
}
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/ShowXmlDemo.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/ShowXmlDemo.cs 2011-04-03 13:43:54 UTC (rev 5589)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/ShowXmlDemo.cs 2011-04-03 13:52:07 UTC (rev 5590)
@@ -66,7 +66,7 @@
jsc.Property(human => human.BigDecimalValue);
jsc.Property(human => human.BigIntegerValue);
jsc.Bag(human => human.Friends, cm => { }, rel => rel.ManyToMany());
- jsc.Map(human => human.Family, cm => { }, km=> { }, rel => rel.ManyToMany());
+ jsc.Map(human => human.Family, cm => { }, rel => rel.ManyToMany());
jsc.Bag(human => human.Pets, cm => { cm.Inverse(true); }, rel => rel.OneToMany());
jsc.Set(human => human.NickNames, cm =>
{
@@ -97,8 +97,8 @@
rc.Id(x => x.Id, map => map.Generator(Generators.Native));
rc.Property(zoo => zoo.Name);
rc.Property(zoo => zoo.Classification);
- rc.Map(zoo => zoo.Mammals, cm => { }, km => { km.Element(); }, rel => rel.OneToMany());
- rc.Map(zoo => zoo.Animals, cm => { cm.Inverse(true); }, km => { km.Element(); }, rel => rel.OneToMany());
+ rc.Map(zoo => zoo.Mammals, cm => { }, rel => rel.OneToMany());
+ rc.Map(zoo => zoo.Animals, cm => { cm.Inverse(true); }, rel => rel.OneToMany());
rc.Component(zoo => zoo.Address, comp =>
{
comp.Property(address => address.Street);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-03 13:44:00
|
Revision: 5589
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5589&view=rev
Author: fabiomaulo
Date: 2011-04-03 13:43:54 +0000 (Sun, 03 Apr 2011)
Log Message:
-----------
Minor (only fixed for Alpha1)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/ModelMapper.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/ModelMapper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/ModelMapper.cs 2011-04-03 13:29:00 UTC (rev 5588)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/ModelMapper.cs 2011-04-03 13:43:54 UTC (rev 5589)
@@ -1040,7 +1040,10 @@
private IMapKeyRelationMapper DetermineMapKeyRelationType(MemberInfo member, PropertyPath propertyPath, System.Type dictionaryKeyType)
{
- if (modelInspector.IsManyToMany(member) || modelInspector.IsOneToMany(member))
+ // Perhaps we have to change IModelInspector with IsDictionaryKeyManyToMany(member), IsDictionaryKeyComponent(member) and so on
+
+ //if (modelInspector.IsManyToMany(member) || modelInspector.IsOneToMany(member))
+ if (modelInspector.IsEntity(dictionaryKeyType))
{
// OneToMany is not possible as map-key so we map it as many-to-many instead ignore the case
return new KeyManyToManyRelationMapper(propertyPath, customizerHolder, this);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-03 13:29:07
|
Revision: 5588
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5588&view=rev
Author: fabiomaulo
Date: 2011-04-03 13:29:00 +0000 (Sun, 03 Apr 2011)
Log Message:
-----------
Fixed IsEntity
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/JoinedSubclassMappingStrategyTests.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/RootClassMappingStrategyTests.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassJoinMappingStrategyTests.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassMappingStrategyTests.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/UnionSubclassMappingStrategyTests.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-03 11:20:11 UTC (rev 5587)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-03 13:29:00 UTC (rev 5588)
@@ -400,13 +400,7 @@
public bool IsEntity(System.Type type)
{
- return rootEntities.Contains(type) ||
- tablePerClassEntities.Contains(type) ||
- tablePerClassHierarchyEntities.Contains(type) ||
- tablePerClassHierarchyJoinEntities.Contains(type) ||
- tablePerConcreteClassEntities.Contains(type) ||
- HasDelayedEntityRegistration(type)
- ;
+ return rootEntities.Contains(type) || type.GetBaseTypes().Any(t => rootEntities.Contains(t)) || HasDelayedEntityRegistration(type);
}
public bool IsTablePerClass(System.Type type)
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/JoinedSubclassMappingStrategyTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/JoinedSubclassMappingStrategyTests.cs 2011-04-03 11:20:11 UTC (rev 5587)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/JoinedSubclassMappingStrategyTests.cs 2011-04-03 13:29:00 UTC (rev 5588)
@@ -74,5 +74,15 @@
inspector.Executing(x => x.AddAsTablePerConcreteClassEntity(typeof(Inherited1))).Throws<MappingException>();
}
+
+ [Test]
+ public void WhenRegisteredAsJoinedSubclassThenIsEntity()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsRootEntity(typeof(MyClass));
+ inspector.AddAsTablePerClassEntity(typeof(Inherited1));
+
+ inspector.IsEntity(typeof(Inherited1)).Should().Be.True();
+ }
}
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/RootClassMappingStrategyTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/RootClassMappingStrategyTests.cs 2011-04-03 11:20:11 UTC (rev 5587)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/RootClassMappingStrategyTests.cs 2011-04-03 13:29:00 UTC (rev 5588)
@@ -154,5 +154,14 @@
inspector.AddAsRootEntity(typeof(MyClass));
inspector.Executing(x => x.AddAsTablePerClassEntity(typeof(MyClass))).Throws<MappingException>();
}
+
+ [Test]
+ public void WhenRegisteredAsRootThenIsEntity()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsRootEntity(typeof(MyClass));
+
+ inspector.IsEntity(typeof(MyClass)).Should().Be.True();
+ }
}
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassJoinMappingStrategyTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassJoinMappingStrategyTests.cs 2011-04-03 11:20:11 UTC (rev 5587)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassJoinMappingStrategyTests.cs 2011-04-03 13:29:00 UTC (rev 5588)
@@ -74,5 +74,15 @@
inspector.Executing(x => x.AddAsTablePerConcreteClassEntity(typeof(Inherited1))).Throws<MappingException>();
}
+
+ [Test]
+ public void WhenRegisteredAsSubclassJoinThenIsEntity()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsRootEntity(typeof(MyClass));
+ inspector.AddAsTablePerClassHierarchyJoinEntity(typeof(Inherited1));
+
+ inspector.IsEntity(typeof(Inherited1)).Should().Be.True();
+ }
}
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassMappingStrategyTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassMappingStrategyTests.cs 2011-04-03 11:20:11 UTC (rev 5587)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassMappingStrategyTests.cs 2011-04-03 13:29:00 UTC (rev 5588)
@@ -75,5 +75,14 @@
inspector.Executing(x => x.AddAsTablePerConcreteClassEntity(typeof(Inherited1))).Throws<MappingException>();
}
+ [Test]
+ public void WhenRegisteredAsSubclassThenIsEntity()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsRootEntity(typeof(MyClass));
+ inspector.AddAsTablePerClassHierarchyEntity(typeof(Inherited1));
+
+ inspector.IsEntity(typeof(Inherited1)).Should().Be.True();
+ }
}
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/UnionSubclassMappingStrategyTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/UnionSubclassMappingStrategyTests.cs 2011-04-03 11:20:11 UTC (rev 5587)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/UnionSubclassMappingStrategyTests.cs 2011-04-03 13:29:00 UTC (rev 5588)
@@ -74,5 +74,15 @@
inspector.Executing(x => x.AddAsTablePerClassEntity(typeof(Inherited1))).Throws<MappingException>();
}
+
+ [Test]
+ public void WhenRegisteredAsUnionSubclassThenIsEntity()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsRootEntity(typeof(MyClass));
+ inspector.AddAsTablePerConcreteClassEntity(typeof(Inherited1));
+
+ inspector.IsEntity(typeof(Inherited1)).Should().Be.True();
+ }
}
}
\ 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: <ric...@us...> - 2011-04-03 11:20:20
|
Revision: 5587
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5587&view=rev
Author: ricbrown
Date: 2011-04-03 11:20:11 +0000 (Sun, 03 Apr 2011)
Log Message:
-----------
Reverted FB .Net provider from 2.6 to 2.5.2: http://tracker.firebirdsql.org/browse/DNET-377
Modified Paths:
--------------
trunk/nhibernate/lib/teamcity/firebird/FirebirdSql.Data.FirebirdClient.dll
trunk/nhibernate/lib/teamcity/firebird/NHibernate.Test.last-results.xml
Modified: trunk/nhibernate/lib/teamcity/firebird/FirebirdSql.Data.FirebirdClient.dll
===================================================================
(Binary files differ)
Modified: trunk/nhibernate/lib/teamcity/firebird/NHibernate.Test.last-results.xml
===================================================================
--- trunk/nhibernate/lib/teamcity/firebird/NHibernate.Test.last-results.xml 2011-04-02 23:00:42 UTC (rev 5586)
+++ trunk/nhibernate/lib/teamcity/firebird/NHibernate.Test.last-results.xml 2011-04-03 11:20:11 UTC (rev 5587)
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!--This file represents the results of running a test suite-->
-<test-results name="../../build/NHibernate-3.0.1.GA-debug/bin/net-3.5/NHibernate.Test.dll" errors="199" failures="669" not-run="246" inconclusive="0" ignored="245" skipped="0" invalid="1">
- <environment nunit-version="2.5.5.10112" clr-version="2.0.50727.4952" os-version="Microsoft Windows NT 6.1.7600.0" platform="Win32NT" />
+<test-results name="../../build/NHibernate-3.2.0.GA-debug/bin/net-3.5/NHibernate.Test.dll" errors="90" failures="435" not-run="354" inconclusive="0" ignored="354" skipped="0" invalid="0">
+ <environment nunit-version="2.5.5.10112" clr-version="2.0.50727.5420" os-version="Microsoft Windows NT 6.1.7601 Service Pack 1" platform="Win32NT" />
<culture-info current-culture="en-GB" current-uiculture="en-US" />
- <test-suite type="Assembly" name="../../build/NHibernate-3.0.1.GA-debug/bin/net-3.5/NHibernate.Test.dll" executed="True" result="Failure" success="False" asserts="0">
+ <test-suite type="Assembly" name="../../build/NHibernate-3.2.0.GA-debug/bin/net-3.5/NHibernate.Test.dll" executed="True" result="Failure" success="False" asserts="0">
<results>
<test-suite type="Namespace" name="NHibernate" executed="True" result="Failure" success="False" asserts="0">
<results>
@@ -104,7 +104,7 @@
<test-case name="NHibernate.Test.Bytecode.Lightweight.BytecodeProviderFixture.DoesNotImplementProxyFactoryFactory" executed="True" result="Success" success="True" asserts="1" />
<test-case name="NHibernate.Test.Bytecode.Lightweight.BytecodeProviderFixture.InvalidCollectionTypeFactoryCtor" executed="True" result="Success" success="True" asserts="1" />
<test-case name="NHibernate.Test.Bytecode.Lightweight.BytecodeProviderFixture.NotConfiguredCollectionTypeFactory" executed="True" result="Success" success="True" asserts="1" />
- <test-case name="NHibernate.Test.Bytecode.Lightweight.BytecodeProviderFixture.NotConfiguredProxyFactoryFactory" executed="True" result="Success" success="True" asserts="2" />
+ <test-case name="NHibernate.Test.Bytecode.Lightweight.BytecodeProviderFixture.NotConfiguredProxyFactoryFactory" executed="True" result="Success" success="True" asserts="0" />
<test-case name="NHibernate.Test.Bytecode.Lightweight.BytecodeProviderFixture.SetCollectionTypeFactoryClassByName" executed="True" result="Success" success="True" asserts="3" />
<test-case name="NHibernate.Test.Bytecode.Lightweight.BytecodeProviderFixture.SetCollectionTypeFactoryClassByType" executed="True" result="Success" success="True" asserts="2" />
<test-case name="NHibernate.Test.Bytecode.Lightweight.BytecodeProviderFixture.UnableToLoadProxyFactoryFactory" executed="True" result="Success" success="True" asserts="3" />
@@ -221,7 +221,7 @@
<test-suite type="TestFixture" name="TimestamperFixture" executed="True" result="Inconclusive" success="False" asserts="0" />
</results>
</test-suite>
- <test-suite type="Namespace" name="Cascade" executed="True" result="Failure" success="False" asserts="0">
+ <test-suite type="Namespace" name="Cascade" executed="True" result="Success" success="True" asserts="0">
<results>
<test-suite type="Namespace" name="Circle" executed="True" result="Success" success="True" asserts="0">
<results>
@@ -287,17 +287,9 @@
<test-case name="NHibernate.Test.Cascade.MultiPathCascadeTest.MultiPathUpdateModifiedDetached" executed="True" result="Success" success="True" asserts="15" />
</results>
</test-suite>
- <test-suite type="TestFixture" name="RefreshFixture" executed="True" result="Failure" success="False" asserts="0">
+ <test-suite type="TestFixture" name="RefreshFixture" executed="True" result="Success" success="True" asserts="0">
<results>
- <test-case name="NHibernate.Test.Cascade.RefreshFixture.RefreshCascade" executed="True" result="Error" success="False" asserts="0">
- <failure>
- <message><![CDATA[NHibernate.Exceptions.GenericADOException : could not insert: [NHibernate.Test.Cascade.Job#3][SQL: INSERT INTO T_JOB (BATCH_ID, JOB_STATUS, PI, JOB_ID) VALUES (?, ?, ?, ?)]
- ----> FirebirdSql.Data.FirebirdClient.FbException : arithmetic exception, numeric overflow, or string truncation
-string right truncation
- ----> FirebirdSql.Data.Common.IscException : arithmetic exception, numeric overflow, or string truncation
-string right truncation]]></message>
- </failure>
- </test-case>
+ <test-case name="NHibernate.Test.Cascade.RefreshFixture.RefreshCascade" executed="True" result="Success" success="True" asserts="2" />
<test-case name="NHibernate.Test.Cascade.RefreshFixture.RefreshIgnoringTransient" executed="True" result="Success" success="True" asserts="0" />
<test-case name="NHibernate.Test.Cascade.RefreshFixture.RefreshIgnoringTransientInCollection" executed="True" result="Success" success="True" asserts="1" />
<test-case name="NHibernate.Test.Cascade.RefreshFixture.RefreshNotIgnoringTransientByUnsavedValue" executed="True" result="Success" success="True" asserts="0" />
@@ -514,18 +506,9 @@
</test-suite>
<test-suite type="Namespace" name="CollectionTest" executed="True" result="Failure" success="False" asserts="0">
<results>
- <test-suite type="TestFixture" name="IdBagFixture" executed="True" result="Failure" success="False" asserts="0">
+ <test-suite type="TestFixture" name="IdBagFixture" executed="True" result="Success" success="True" asserts="0">
<results>
- <test-case name="NHibernate.Test.CollectionTest.IdBagFixture.Simple" executed="True" result="Error" success="False" asserts="0">
- <failure>
- <message><![CDATA[NHibernate.Exceptions.GenericADOException : could not insert collection: [NHibernate.Test.CollectionTest.A.Items#1][SQL: INSERT INTO Items (a_id, item_id, id) VALUES (@p0, @p1, @p2)]
- ----> FirebirdSql.Data.FirebirdClient.FbException : arithmetic exception, numeric overflow, or string truncation
-string right truncation
- ----> FirebirdSql.Data.Common.IscException : arithmetic exception, numeric overflow, or string truncation
-string right truncation
-TearDown : NUnit.Framework.AssertionException : Test didn't clean up after itself. session closed: False database cleaned: True connection closed: True]]></message>
- </failure>
- </test-case>
+ <test-case name="NHibernate.Test.CollectionTest.IdBagFixture.Simple" executed="True" result="Success" success="True" asserts="5" />
</results>
</test-suite>
<test-suite type="TestFixture" name="NullableValueTypeElementMapFixture" executed="True" result="Error" success="False" asserts="0">
@@ -568,147 +551,28 @@
</test-suite>
</results>
</test-suite>
- <test-suite type="Namespace" name="Component" executed="True" result="Failure" success="False" asserts="0">
+ <test-suite type="Namespace" name="Component" executed="True" result="Success" success="True" asserts="0">
<results>
- <test-suite type="Namespace" name="Basic" executed="True" result="Failure" success="False" asserts="0">
+ <test-suite type="Namespace" name="Basic" executed="True" result="Success" success="True" asserts="0">
<results>
- <test-suite type="TestFixture" name="ComponentTest" executed="True" result="Failure" success="False" asserts="0">
+ <test-suite type="TestFixture" name="ComponentTest" executed="True" result="Success" success="True" asserts="0">
<results>
- <test-case name="NHibernate.Test.Component.Basic.ComponentTest.TestComponent" executed="True" result="Error" success="False" asserts="0">
- <failure>
- <message><![CDATA[NHibernate.Exceptions.GenericADOException : could not load an entity: [NHibernate.Test.Component.Basic.User#gavin][SQL: SELECT user0_.UserName as UserName76_0_, user0_.LastModified as LastModi2_76_0_, user0_.Password as Password76_0_, user0_.Name as Name76_0_, user0_.Dob as Dob76_0_, user0_.Address as Address76_0_, user0_.PreviousAddress as Previous7_76_0_, user0_.address as address76_0_, year(user0_.dob) as formula0_0_ FROM T_USER user0_ WHERE user0_.UserName=?]
- ----> FirebirdSql.Data.FirebirdClient.FbException : Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 273
-year
- ----> FirebirdSql.Data.Common.IscException : Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 273
-year
-TearDown : NHibernate.Exceptions.GenericADOException : could not execute query
-[ select user0_.UserName as UserName76_, user0_.LastModified as LastModi2_76_, user0_.Password as Password76_, user0_.Name as Name76_, user0_.Dob as Dob76_, user0_.Address as Address76_, user0_.PreviousAddress as Previous7_76_, user0_.address as address76_, year(user0_.dob) as formula0_ from T_USER user0_ ]
-[SQL: select user0_.UserName as UserName76_, user0_.LastModified as LastModi2_76_, user0_.Password as Password76_, user0_.Name as Name76_, user0_.Dob as Dob76_, user0_.Address as Address76_, user0_.PreviousAddress as Previous7_76_, user0_.address as address76_, year(user0_.dob) as formula0_ from T_USER user0_]
- ----> FirebirdSql.Data.FirebirdClient.FbException : Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 257
-year
- ----> FirebirdSql.Data.Common.IscException : Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 257
-year]]></message>
- </failure>
- </test-case>
- <test-case name="NHibernate.Test.Component.Basic.ComponentTest.TestComponentFormulaQuery" executed="True" result="Error" success="False" asserts="0">
- <failure>
- <message><![CDATA[NHibernate.Exceptions.GenericADOException : could not execute query
-[ select user0_.UserName as UserName76_, user0_.LastModified as LastModi2_76_, user0_.Password as Password76_, user0_.Name as Name76_, user0_.Dob as Dob76_, user0_.Address as Address76_, user0_.PreviousAddress as Previous7_76_, user0_.address as address76_, year(user0_.dob) as formula0_ from T_USER user0_ where year(user0_.dob)=1999 ]
-[SQL: select user0_.UserName as UserName76_, user0_.LastModified as LastModi2_76_, user0_.Password as Password76_, user0_.Name as Name76_, user0_.Dob as Dob76_, user0_.Address as Address76_, user0_.PreviousAddress as Previous7_76_, user0_.address as address76_, year(user0_.dob) as formula0_ from T_USER user0_ where year(user0_.dob)=1999]
- ----> FirebirdSql.Data.FirebirdClient.FbException : Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 257
-year
- ----> FirebirdSql.Data.Common.IscException : Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 257
-year
-TearDown : NHibernate.Exceptions.GenericADOException : could not execute query
-[ select user0_.UserName as UserName76_, user0_.LastModified as LastModi2_76_, user0_.Password as Password76_, user0_.Name as Name76_, user0_.Dob as Dob76_, user0_.Address as Address76_, user0_.PreviousAddress as Previous7_76_, user0_.address as address76_, year(user0_.dob) as formula0_ from T_USER user0_ ]
-[SQL: select user0_.UserName as UserName76_, user0_.LastModified as LastModi2_76_, user0_.Password as Password76_, user0_.Name as Name76_, user0_.Dob as Dob76_, user0_.Address as Address76_, user0_.PreviousAddress as Previous7_76_, user0_.address as address76_, year(user0_.dob) as formula0_ from T_USER user0_]
- ----> FirebirdSql.Data.FirebirdClient.FbException : Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 257
-year
- ----> FirebirdSql.Data.Common.IscException : Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 257
-year]]></message>
- </failure>
- </test-case>
+ <test-case name="NHibernate.Test.Component.Basic.ComponentTest.TestComponent" executed="True" result="Success" success="True" asserts="6" />
+ <test-case name="NHibernate.Test.Component.Basic.ComponentTest.TestComponentFormulaQuery" executed="True" result="Success" success="True" asserts="0" />
<test-case name="NHibernate.Test.Component.Basic.ComponentTest.TestComponentQueries" executed="False" result="Ignored">
<reason>
<message><![CDATA[Ported from Hibernate - failing in NH]]></message>
</reason>
</test-case>
- <test-case name="NHibernate.Test.Component.Basic.ComponentTest.TestComponentStateChangeAndDirtiness" executed="True" result="Error" success="False" asserts="2">
- <failure>
- <message><![CDATA[TearDown : NHibernate.Exceptions.GenericADOException : could not execute query
-[ select user0_.UserName as UserName76_, user0_.LastModified as LastModi2_76_, user0_.Password as Password76_, user0_.Name as Name76_, user0_.Dob as Dob76_, user0_.Address as Address76_, user0_.PreviousAddress as Previous7_76_, user0_.address as address76_, year(user0_.dob) as formula0_ from T_USER user0_ ]
-[SQL: select user0_.UserName as UserName76_, user0_.LastModified as LastModi2_76_, user0_.Password as Password76_, user0_.Name as Name76_, user0_.Dob as Dob76_, user0_.Address as Address76_, user0_.PreviousAddress as Previous7_76_, user0_.address as address76_, year(user0_.dob) as formula0_ from T_USER user0_]
- ----> FirebirdSql.Data.FirebirdClient.FbException : Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 257
-year
- ----> FirebirdSql.Data.Common.IscException : Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 257
-year]]></message>
- </failure>
- </test-case>
+ <test-case name="NHibernate.Test.Component.Basic.ComponentTest.TestComponentStateChangeAndDirtiness" executed="True" result="Success" success="True" asserts="2" />
<test-case name="NHibernate.Test.Component.Basic.ComponentTest.TestCustomColumnReadAndWrite" executed="False" result="Ignored">
<reason>
<message><![CDATA[Ported from Hibernate. Read properties not supported in NH yet.]]></message>
</reason>
</test-case>
- <test-case name="NHibernate.Test.Component.Basic.ComponentTest.TestMergeComponent" executed="True" result="Error" success="False" asserts="11">
- <failure>
- <message><![CDATA[TearDown : NHibernate.Exceptions.GenericADOException : could not execute query
-[ select user0_.UserName as UserName76_, user0_.LastModified as LastModi2_76_, user0_.Password as Password76_, user0_.Name as Name76_, user0_.Dob as Dob76_, user0_.Address as Address76_, user0_.PreviousAddress as Previous7_76_, user0_.address as address76_, year(user0_.dob) as formula0_ from T_USER user0_ ]
-[SQL: select user0_.UserName as UserName76_, user0_.LastModified as LastModi2_76_, user0_.Password as Password76_, user0_.Name as Name76_, user0_.Dob as Dob76_, user0_.Address as Address76_, user0_.PreviousAddress as Previous7_76_, user0_.address as address76_, year(user0_.dob) as formula0_ from T_USER user0_]
- ----> FirebirdSql.Data.FirebirdClient.FbException : Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 257
-year
- ----> FirebirdSql.Data.Common.IscException : Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 257
-year]]></message>
- </failure>
- </test-case>
- <test-case name="NHibernate.Test.Component.Basic.ComponentTest.TestNamedQuery" executed="True" result="Error" success="False" asserts="0">
- <failure>
- <message><![CDATA[NHibernate.Exceptions.GenericADOException : could not execute query
-[ select user0_.UserName as UserName76_, user0_.LastModified as LastModi2_76_, user0_.Password as Password76_, user0_.Name as Name76_, user0_.Dob as Dob76_, user0_.Address as Address76_, user0_.PreviousAddress as Previous7_76_, user0_.address as address76_, year(user0_.dob) as formula0_ from T_USER user0_ where user0_.Name in (@p0 , @p1 , @p2) or user0_.UserName in (@p0 , @p1 , @p2) ]
- Name:nameList_0_ - Value:1ovthafew Name:nameList_1_ - Value:turin Name:nameList_2_ - Value:xam
-[SQL: select user0_.UserName as UserName76_, user0_.LastModified as LastModi2_76_, user0_.Password as Password76_, user0_.Name as Name76_, user0_.Dob as Dob76_, user0_.Address as Address76_, user0_.PreviousAddress as Previous7_76_, user0_.address as address76_, year(user0_.dob) as formula0_ from T_USER user0_ where user0_.Name in (@p0 , @p1 , @p2) or user0_.UserName in (@p0 , @p1 , @p2)]
- ----> FirebirdSql.Data.FirebirdClient.FbException : Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 257
-year
- ----> FirebirdSql.Data.Common.IscException : Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 257
-year
-TearDown : NHibernate.Exceptions.GenericADOException : could not execute query
-[ select user0_.UserName as UserName76_, user0_.LastModified as LastModi2_76_, user0_.Password as Password76_, user0_.Name as Name76_, user0_.Dob as Dob76_, user0_.Address as Address76_, user0_.PreviousAddress as Previous7_76_, user0_.address as address76_, year(user0_.dob) as formula0_ from T_USER user0_ ]
-[SQL: select user0_.UserName as UserName76_, user0_.LastModified as LastModi2_76_, user0_.Password as Password76_, user0_.Name as Name76_, user0_.Dob as Dob76_, user0_.Address as Address76_, user0_.PreviousAddress as Previous7_76_, user0_.address as address76_, year(user0_.dob) as formula0_ from T_USER user0_]
- ----> FirebirdSql.Data.FirebirdClient.FbException : Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 257
-year
- ----> FirebirdSql.Data.Common.IscException : Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 257
-year]]></message>
- </failure>
- </test-case>
- <test-case name="NHibernate.Test.Component.Basic.ComponentTest.TestUpdateFalse" executed="True" result="Error" success="False" asserts="0">
- <failure>
- <message><![CDATA[NHibernate.Exceptions.GenericADOException : could not insert: [NHibernate.Test.Component.Basic.User#gavin][SQL: INSERT INTO T_USER (LastModified, Password, Name, Dob, Address, UserName) VALUES (?, ?, ?, ?, ?, ?)]
- ----> FirebirdSql.Data.FirebirdClient.FbException : violation of PRIMARY or UNIQUE KEY constraint "INTEG_110" on table "T_USER"
- ----> FirebirdSql.Data.Common.IscException : violation of PRIMARY or UNIQUE KEY constraint "INTEG_110" on table "T_USER"
-TearDown : NHibernate.Exceptions.GenericADOException : could not execute query
-[ select user0_.UserName as UserName76_, user0_.LastModified as LastModi2_76_, user0_.Password as Password76_, user0_.Name as Name76_, user0_.Dob as Dob76_, user0_.Address as Address76_, user0_.PreviousAddress as Previous7_76_, user0_.address as address76_, year(user0_.dob) as formula0_ from T_USER user0_ ]
-[SQL: select user0_.UserName as UserName76_, user0_.LastModified as LastModi2_76_, user0_.Password as Password76_, user0_.Name as Name76_, user0_.Dob as Dob76_, user0_.Address as Address76_, user0_.PreviousAddress as Previous7_76_, user0_.address as address76_, year(user0_.dob) as formula0_ from T_USER user0_]
- ----> FirebirdSql.Data.FirebirdClient.FbException : Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 257
-year
- ----> FirebirdSql.Data.Common.IscException : Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 257
-year]]></message>
- </failure>
- </test-case>
+ <test-case name="NHibernate.Test.Component.Basic.ComponentTest.TestMergeComponent" executed="True" result="Success" success="True" asserts="11" />
+ <test-case name="NHibernate.Test.Component.Basic.ComponentTest.TestNamedQuery" executed="True" result="Success" success="True" asserts="0" />
+ <test-case name="NHibernate.Test.Component.Basic.ComponentTest.TestUpdateFalse" executed="True" result="Success" success="True" asserts="4" />
</results>
</test-suite>
</results>
@@ -925,6 +789,11 @@
<message><![CDATA[TestFixtureSetUp failed in CriteriaQueryTest]]></message>
</failure>
</test-case>
+ <test-case name="NHibernate.Test.Criteria.CriteriaQueryTest.IgnoreCase" executed="True" result="Failure" success="False" asserts="0">
+ <failure>
+ <message><![CDATA[TestFixtureSetUp failed in CriteriaQueryTest]]></message>
+ </failure>
+ </test-case>
<test-case name="NHibernate.Test.Criteria.CriteriaQueryTest.InsensitiveLikeProjectionUsingRestrictionsTest" executed="True" result="Failure" success="False" asserts="0">
<failure>
<message><![CDATA[TestFixtureSetUp failed in CriteriaQueryTest]]></message>
@@ -1189,15 +1058,15 @@
<results>
<test-suite type="TestFixture" name="CriteriaAssertFixture" executed="True" result="Success" success="True" asserts="0">
<results>
- <test-case name="NHibernate.Test.Criteria.Lambda.CriteriaAssertFixture.DifferentAliases" executed="True" result="Success" success="True" asserts="34" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.CriteriaAssertFixture.DifferentAliases" executed="True" result="Success" success="True" asserts="35" />
<test-case name="NHibernate.Test.Criteria.Lambda.CriteriaAssertFixture.DifferentFetchMode" executed="True" result="Success" success="True" asserts="12" />
- <test-case name="NHibernate.Test.Criteria.Lambda.CriteriaAssertFixture.DifferentJoinType" executed="True" result="Success" success="True" asserts="41" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.CriteriaAssertFixture.DifferentJoinType" executed="True" result="Success" success="True" asserts="42" />
<test-case name="NHibernate.Test.Criteria.Lambda.CriteriaAssertFixture.DifferentLockMode" executed="True" result="Success" success="True" asserts="14" />
<test-case name="NHibernate.Test.Criteria.Lambda.CriteriaAssertFixture.DifferentNestedCriterion" executed="True" result="Success" success="True" asserts="18" />
<test-case name="NHibernate.Test.Criteria.Lambda.CriteriaAssertFixture.DifferentOperators" executed="True" result="Success" success="True" asserts="17" />
<test-case name="NHibernate.Test.Criteria.Lambda.CriteriaAssertFixture.DifferentOrder" executed="True" result="Success" success="True" asserts="12" />
<test-case name="NHibernate.Test.Criteria.Lambda.CriteriaAssertFixture.DifferentPaths" executed="True" result="Success" success="True" asserts="11" />
- <test-case name="NHibernate.Test.Criteria.Lambda.CriteriaAssertFixture.DifferentProjections" executed="True" result="Success" success="True" asserts="41" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.CriteriaAssertFixture.DifferentProjections" executed="True" result="Success" success="True" asserts="42" />
<test-case name="NHibernate.Test.Criteria.Lambda.CriteriaAssertFixture.DifferentPropertyName" executed="True" result="Success" success="True" asserts="9" />
<test-case name="NHibernate.Test.Criteria.Lambda.CriteriaAssertFixture.DifferentSubCriteria" executed="True" result="Success" success="True" asserts="17" />
<test-case name="NHibernate.Test.Criteria.Lambda.CriteriaAssertFixture.DifferentSubquery" executed="True" result="Success" success="True" asserts="21" />
@@ -1235,11 +1104,13 @@
<message><![CDATA[System.NotSupportedException : The driver NHibernate.Driver.FirebirdClientDriver does not support multiple queries.]]></message>
</failure>
</test-case>
+ <test-case name="NHibernate.Test.Criteria.Lambda.IntegrationFixture.OnClause" executed="True" result="Success" success="True" asserts="0" />
<test-case name="NHibernate.Test.Criteria.Lambda.IntegrationFixture.OverrideEagerJoin" executed="True" result="Success" success="True" asserts="3" />
<test-case name="NHibernate.Test.Criteria.Lambda.IntegrationFixture.Project_MultipleProperties" executed="True" result="Success" success="True" asserts="2" />
<test-case name="NHibernate.Test.Criteria.Lambda.IntegrationFixture.Project_SingleProperty" executed="True" result="Success" success="True" asserts="1" />
<test-case name="NHibernate.Test.Criteria.Lambda.IntegrationFixture.Project_TransformToDto" executed="True" result="Success" success="True" asserts="5" />
<test-case name="NHibernate.Test.Criteria.Lambda.IntegrationFixture.RowCount" executed="True" result="Success" success="True" asserts="5" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.IntegrationFixture.StatelessSession" executed="True" result="Success" success="True" asserts="2" />
<test-case name="NHibernate.Test.Criteria.Lambda.IntegrationFixture.SubCriteria" executed="True" result="Success" success="True" asserts="2" />
<test-case name="NHibernate.Test.Criteria.Lambda.IntegrationFixture.SubCriteriaProjections" executed="True" result="Success" success="True" asserts="6" />
<test-case name="NHibernate.Test.Criteria.Lambda.IntegrationFixture.SubQuery" executed="True" result="Success" success="True" asserts="5" />
@@ -1248,84 +1119,90 @@
</test-suite>
<test-suite type="TestFixture" name="ProjectionsFixture" executed="True" result="Success" success="True" asserts="0">
<results>
- <test-case name="NHibernate.Test.Criteria.Lambda.ProjectionsFixture.ArbitraryProjections" executed="True" result="Success" success="True" asserts="261" />
- <test-case name="NHibernate.Test.Criteria.Lambda.ProjectionsFixture.InlineProjectionList" executed="True" result="Success" success="True" asserts="258" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.ProjectionsFixture.ArbitraryProjections" executed="True" result="Success" success="True" asserts="263" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.ProjectionsFixture.InlineProjectionList" executed="True" result="Success" success="True" asserts="260" />
</results>
</test-suite>
<test-suite type="TestFixture" name="QueryOverFixture" executed="True" result="Success" success="True" asserts="0">
<results>
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.Alias_Join" executed="True" result="Success" success="True" asserts="68" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.Alias_JoinAlias" executed="True" result="Success" success="True" asserts="68" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.Alias_JoinCombinations" executed="True" result="Success" success="True" asserts="146" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.AllowSingleCallSyntax" executed="True" result="Success" success="True" asserts="66" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.Cachable" executed="True" result="Success" success="True" asserts="44" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.CloneIQueryOver" executed="True" result="Success" success="True" asserts="60" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.CloneIQueryOverWithSubType" executed="True" result="Success" success="True" asserts="53" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.CloneQueryOver" executed="True" result="Success" success="True" asserts="60" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.CustomMethodExpression" executed="True" result="Success" success="True" asserts="67" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.DetachedQueryOver" executed="True" result="Success" success="True" asserts="56" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.Fetch" executed="True" result="Success" success="True" asserts="46" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.LockAlias" executed="True" result="Success" success="True" asserts="49" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.LockAll" executed="True" result="Success" success="True" asserts="49" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.MultipleCriterionExpression" executed="True" result="Success" success="True" asserts="76" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.Negation" executed="True" result="Success" success="True" asserts="68" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.OrderBy" executed="True" result="Success" success="True" asserts="90" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.Paging" executed="True" result="Success" success="True" asserts="42" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.PrivateProperties" executed="True" result="Success" success="True" asserts="82" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.Project" executed="True" result="Success" success="True" asserts="64" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.PropertyCriterion_NoAlias" executed="True" result="Success" success="True" asserts="97" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.ResultTransformer" executed="True" result="Success" success="True" asserts="53" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.SimpleCriterion_AliasReferenceSyntax" executed="True" result="Success" success="True" asserts="139" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.SimpleCriterion_Char" executed="True" result="Success" success="True" asserts="67" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.SimpleCriterion_NoAlias" executed="True" result="Success" success="True" asserts="139" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.SubCriteria_JoinQueryOver_ToMany" executed="True" result="Success" success="True" asserts="65" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.SubCriteria_JoinQueryOver_ToManyAlias" executed="True" result="Success" success="True" asserts="65" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.SubCriteria_JoinQueryOver_ToOne" executed="True" result="Success" success="True" asserts="65" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.SubCriteria_JoinQueryOver_ToOneAlias" executed="True" result="Success" success="True" asserts="65" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.SubCriteria_JoinQueryOverCombinations" executed="True" result="Success" success="True" asserts="136" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.TransformQueryOverToRowCount" executed="True" result="Success" success="True" asserts="77" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.TransformQueryOverToRowCount64" executed="True" result="Success" success="True" asserts="77" />
- <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.Where_BehavesTheSameAs_And" executed="True" result="Success" success="True" asserts="92" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.Alias_Join" executed="True" result="Success" success="True" asserts="69" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.Alias_JoinAlias" executed="True" result="Success" success="True" asserts="69" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.Alias_JoinCombinations" executed="True" result="Success" success="True" asserts="147" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.AllowSingleCallSyntax" executed="True" result="Success" success="True" asserts="69" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.Cachable" executed="True" result="Success" success="True" asserts="45" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.CloneIQueryOver" executed="True" result="Success" success="True" asserts="61" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.CloneIQueryOverWithSubType" executed="True" result="Success" success="True" asserts="54" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.CloneQueryOver" executed="True" result="Success" success="True" asserts="61" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.CustomMethodExpression" executed="True" result="Success" success="True" asserts="68" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.DetachedQueryOver" executed="True" result="Success" success="True" asserts="57" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.Fetch" executed="True" result="Success" success="True" asserts="47" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.LockAlias" executed="True" result="Success" success="True" asserts="50" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.LockAll" executed="True" result="Success" success="True" asserts="50" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.MultipleCriterionExpression" executed="True" result="Success" success="True" asserts="77" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.Negation" executed="True" result="Success" success="True" asserts="69" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.OnClause_Alias" executed="True" result="Success" success="True" asserts="303" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.OnClause_SubCriteria" executed="True" result="Success" success="True" asserts="303" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.OnClauseDetached_Alias" executed="True" result="Success" success="True" asserts="305" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.OnClauseDetached_SubCriteria" executed="True" result="Success" success="True" asserts="305" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.OrderBy" executed="True" result="Success" success="True" asserts="103" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.Paging" executed="True" result="Success" success="True" asserts="43" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.PrivateProperties" executed="True" result="Success" success="True" asserts="85" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.Project" executed="True" result="Success" success="True" asserts="65" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.PropertyCriterion_NoAlias" executed="True" result="Success" success="True" asserts="98" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.Readonly" executed="True" result="Success" success="True" asserts="44" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.ResultTransformer" executed="True" result="Success" success="True" asserts="54" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.SimpleCriterion_AliasReferenceSyntax" executed="True" result="Success" success="True" asserts="140" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.SimpleCriterion_Char" executed="True" result="Success" success="True" asserts="68" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.SimpleCriterion_NoAlias" executed="True" result="Success" success="True" asserts="140" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.SubCriteria_JoinQueryOver_ToMany" executed="True" result="Success" success="True" asserts="66" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.SubCriteria_JoinQueryOver_ToManyAlias" executed="True" result="Success" success="True" asserts="66" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.SubCriteria_JoinQueryOver_ToOne" executed="True" result="Success" success="True" asserts="66" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.SubCriteria_JoinQueryOver_ToOneAlias" executed="True" result="Success" success="True" asserts="66" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.SubCriteria_JoinQueryOverCombinations" executed="True" result="Success" success="True" asserts="137" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.TransformQueryOverToRowCount" executed="True" result="Success" success="True" asserts="78" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.TransformQueryOverToRowCount64" executed="True" result="Success" success="True" asserts="78" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.VisualBasicStringComparison" executed="True" result="Success" success="True" asserts="171" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.QueryOverFixture.Where_BehavesTheSameAs_And" executed="True" result="Success" success="True" asserts="93" />
</results>
</test-suite>
<test-suite type="TestFixture" name="RestrictionsFixture" executed="True" result="Success" success="True" asserts="0">
<results>
- <test-case name="NHibernate.Test.Criteria.Lambda.RestrictionsFixture.ArbitraryCriterion" executed="True" result="Success" success="True" asserts="92" />
- <test-case name="NHibernate.Test.Criteria.Lambda.RestrictionsFixture.DetachedRestrictions" executed="True" result="Success" success="True" asserts="92" />
- <test-case name="NHibernate.Test.Criteria.Lambda.RestrictionsFixture.Junction" executed="True" result="Success" success="True" asserts="92" />
- <test-case name="NHibernate.Test.Criteria.Lambda.RestrictionsFixture.NullRestriction" executed="True" result="Success" success="True" asserts="152" />
- <test-case name="NHibernate.Test.Criteria.Lambda.RestrictionsFixture.RestrictionsExtensions" executed="True" result="Success" success="True" asserts="130" />
- <test-case name="NHibernate.Test.Criteria.Lambda.RestrictionsFixture.SqlOperators" executed="True" result="Success" success="True" asserts="240" />
- <test-case name="NHibernate.Test.Criteria.Lambda.RestrictionsFixture.SqlOperatorsInline" executed="True" result="Success" success="True" asserts="208" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.RestrictionsFixture.ArbitraryCriterion" executed="True" result="Success" success="True" asserts="93" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.RestrictionsFixture.DetachedRestrictions" executed="True" result="Success" success="True" asserts="93" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.RestrictionsFixture.Junction" executed="True" result="Success" success="True" asserts="93" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.RestrictionsFixture.NullRestriction" executed="True" result="Success" success="True" asserts="153" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.RestrictionsFixture.RestrictionsExtensions" executed="True" result="Success" success="True" asserts="131" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.RestrictionsFixture.SqlOperators" executed="True" result="Success" success="True" asserts="241" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.RestrictionsFixture.SqlOperatorsInline" executed="True" result="Success" success="True" asserts="209" />
</results>
</test-suite>
<test-suite type="TestFixture" name="SubqueryFixture" executed="True" result="Success" success="True" asserts="0">
<results>
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.DetachedSubquery" executed="True" result="Success" success="True" asserts="186" />
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.Property" executed="True" result="Success" success="True" asserts="610" />
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyAlias" executed="True" result="Success" success="True" asserts="113" />
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyAliasCriterion" executed="True" result="Success" success="True" asserts="113" />
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyAll" executed="True" result="Success" success="True" asserts="402" />
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyAllCriterion" executed="True" result="Success" success="True" asserts="402" />
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyAsAllSyntax" executed="True" result="Success" success="True" asserts="402" />
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyAsAllSyntaxCriterion" executed="True" result="Success" success="True" asserts="402" />
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyAsSomeSyntax" executed="True" result="Success" success="True" asserts="330" />
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyAsSomeSyntaxCrtierion" executed="True" result="Success" success="True" asserts="330" />
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyAsSyntax" executed="True" result="Success" success="True" asserts="468" />
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyAsSyntaxAlias" executed="True" result="Success" success="True" asserts="257" />
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyAsSyntaxAliasCriterion" executed="True" result="Success" success="True" asserts="257" />
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyAsSyntaxCriterion" executed="True" result="Success" success="True" asserts="113" />
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyCriterion" executed="True" result="Success" success="True" asserts="610" />
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertySome" executed="True" result="Success" success="True" asserts="330" />
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertySomeCriterion" executed="True" result="Success" success="True" asserts="330" />
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.UntypedSubqueries" executed="True" result="Success" success="True" asserts="172" />
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.UntypedSubqueriesCriterion" executed="True" result="Success" success="True" asserts="172" />
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.Value" executed="True" result="Success" success="True" asserts="610" />
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.ValueAll" executed="True" result="Success" success="True" asserts="402" />
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.ValueAllCriterion" executed="True" result="Success" success="True" asserts="402" />
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.ValueCriterion" executed="True" result="Success" success="True" asserts="610" />
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.ValueSome" executed="True" result="Success" success="True" asserts="330" />
- <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.ValueSomeCriterion" executed="True" result="Success" success="True" asserts="330" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.DetachedSubquery" executed="True" result="Success" success="True" asserts="189" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.Property" executed="True" result="Success" success="True" asserts="619" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyAlias" executed="True" result="Success" success="True" asserts="115" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyAliasCriterion" executed="True" result="Success" success="True" asserts="115" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyAll" executed="True" result="Success" success="True" asserts="408" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyAllCriterion" executed="True" result="Success" success="True" asserts="408" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyAsAllSyntax" executed="True" result="Success" success="True" asserts="408" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyAsAllSyntaxCriterion" executed="True" result="Success" success="True" asserts="408" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyAsSomeSyntax" executed="True" result="Success" success="True" asserts="335" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyAsSomeSyntaxCrtierion" executed="True" result="Success" success="True" asserts="335" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyAsSyntax" executed="True" result="Success" success="True" asserts="475" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyAsSyntaxAlias" executed="True" result="Success" success="True" asserts="261" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyAsSyntaxAliasCriterion" executed="True" result="Success" success="True" asserts="261" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyAsSyntaxCriterion" executed="True" result="Success" success="True" asserts="115" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertyCriterion" executed="True" result="Success" success="True" asserts="619" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertySome" executed="True" result="Success" success="True" asserts="335" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.PropertySomeCriterion" executed="True" result="Success" success="True" asserts="335" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.UntypedSubqueries" executed="True" result="Success" success="True" asserts="175" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.UntypedSubqueriesCriterion" executed="True" result="Success" success="True" asserts="175" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.Value" executed="True" result="Success" success="True" asserts="619" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.ValueAll" executed="True" result="Success" success="True" asserts="408" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.ValueAllCriterion" executed="True" result="Success" success="True" asserts="408" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.ValueCriterion" executed="True" result="Success" success="True" asserts="619" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.ValueSome" executed="True" result="Success" success="True" asserts="335" />
+ <test-case name="NHibernate.Test.Criteria.Lambda.SubqueryFixture.ValueSomeCriterion" executed="True" result="Success" success="True" asserts="335" />
</results>
</test-suite>
</results>
@@ -1496,6 +1373,7 @@
<test-case name="NHibernate.Test.DialectTest.DialectFixture.UnQuoteAlreadyQuoted" executed="True" result="Success" success="True" asserts="2" />
<test-case name="NHibernate.Test.DialectTest.DialectFixture.UnQuoteArray" executed="True" result="Success" success="True" asserts="3" />
<test-case name="NHibernate.Test.DialectTest.DialectFixture.UnQuoteNeedingQuote" executed="True" result="Success" success="True" asserts="2" />
+ <test-case name="NHibernate.Test.DialectTest.DialectFixture.WhenNullOrEmptyIsQuotedFalse" executed="True" result="Success" success="True" asserts="0" />
</results>
</test-suite>
<test-suite type="TestFixture" name="FirebirdDialectFixture" executed="True" result="Success" success="True" asserts="0">
@@ -1547,6 +1425,7 @@
<test-case name="NHibernate.Test.DialectTest.MsSqlDialectFixture.DialectFixture.UnQuoteAlreadyQuoted" executed="True" result="Success" success="True" asserts="2" />
<test-case name="NHibernate.Test.DialectTest.MsSqlDialectFixture.DialectFixture.UnQuoteArray" executed="True" result="Success" success="True" asserts="3" />
<test-case name="NHibernate.Test.DialectTest.MsSqlDialectFixture.DialectFixture.UnQuoteNeedingQuote" executed="True" result="Success" success="True" asserts="2" />
+ <test-case name="NHibernate.Test.DialectTest.MsSqlDialectFixture.DialectFixture.WhenNullOrEmptyIsQuotedFalse" executed="True" result="Success" success="True" asserts="0" />
<test-case name="NHibernate.Test.DialectTest.MsSqlDialectFixture.GetLimitString" executed="True" result="Success" success="True" asserts="5" />
<test-case name="NHibernate.Test.DialectTest.MsSqlDialectFixture.TimestampRounding" executed="True" result="Success" success="True" asserts="1" />
</results>
@@ -1576,7 +1455,7 @@
</test-suite>
</results>
</test-suite>
- <test-suite type="Namespace" name="DriverTest" executed="True" result="Failure" success="False" asserts="0">
+ <test-suite type="Namespace" name="DriverTest" executed="True" result="Success" success="True" asserts="0">
<results>
<test-suite type="TestFixture" name="DbProviderFactoryDriveConnectionCommandProviderTest" executed="True" result="Success" success="True" asserts="0">
<results>
@@ -1609,7 +1488,10 @@
<test-case name="NHibernate.Test.DriverTest.ReflectionBasedDriverTest.WhenCreatedWithNullAssemblyAndGoodDbProviderThenNotThrows" executed="True" result="Success" success="True" asserts="0" />
</results>
</test-suite>
- <test-suite type="TestFixture" name="Sql2008DateTime2Test" executed="True" result="Failure" success="False" asserts="0">
+ <test-suite type="TestFixture" name="Sql2008DateTime2Test" executed="False" result="Ignored">
+ <reason>
+ <message><![CDATA[NHibernate.Test.DriverTest.Sql2008DateTime2Test does not apply to NHibernate.Dialect.FirebirdDialect]]></message>
+ </reason>
<results>
<test-case name="NHibernate.Test.DriverTest.Sql2008DateTime2Test.Crud" executed="False" result="Ignored">
<reason>
@@ -1649,7 +1531,7 @@
</test-suite>
</results>
</test-suite>
- <test-suite type="Namespace" name="DynamicEntity" executed="True" result="Failure" success="False" asserts="0">
+ <test-suite type="Namespace" name="DynamicEntity" executed="True" result="Success" success="True" asserts="0">
<results>
<test-suite type="Namespace" name="Interceptor" executed="True" result="Success" success="True" asserts="0">
<results>
@@ -1660,26 +1542,44 @@
</test-suite>
</results>
</test-suite>
- <test-suite type="Namespace" name="Tuplizer" executed="True" result="Failure" success="False" asserts="0">
+ <test-suite type="Namespace" name="Tuplizer" executed="True" result="Success" success="True" asserts="0">
<results>
- <test-suite type="TestFixture" name="TuplizerDynamicEntity" executed="True" result="Failure" success="False" asserts="0">
+ <test-suite type="TestFixture" name="TuplizerDynamicEntity" executed="True" result="Success" success="True" asserts="0">
<results>
- <test-case name="NHibernate.Test.DynamicEntity.Tuplizer.TuplizerDynamicEntity.It" executed="True" result="Error" success="False" asserts="0">
- <failure>
- <message><![CDATA[NHibernate.Exceptions.GenericADOException : could not insert: [NHibernate.Test.DynamicEntity.Person#5][SQL: INSERT INTO t_person (Name, addr_id, class, Id) VALUES (?, ?, 'person', ?)]
- ----> FirebirdSql.Data.FirebirdClient.FbException : arithmetic exception, numeric overflow, or string truncation
-string right truncation
- ----> FirebirdSql.Data.Common.IscException : arithmetic exception, numeric overflow, or string truncation
-string right truncation
-TearDown : NUnit.Framework.AssertionException : Test didn't clean up after itself. session closed: False database cleaned: True connection closed: True]]></message>
- </failure>
- </test-case>
+ <test-case name="NHibernate.Test.DynamicEntity.Tuplizer.TuplizerDynamicEntity.It" executed="True" result="Success" success="True" asserts="12" />
</results>
</test-suite>
</results>
</test-suite>
</results>
</test-suite>
+ <test-suite type="Namespace" name="DynamicProxyTests" executed="True" result="Success" success="True" asserts="0">
+ ...
[truncated message content] |
|
From: <fab...@us...> - 2011-04-02 23:00:49
|
Revision: 5586
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5586&view=rev
Author: fabiomaulo
Date: 2011-04-02 23:00:42 +0000 (Sat, 02 Apr 2011)
Log Message:
-----------
- Domain to play with the API (note incomplete mapping)
- some API simplifications
- ported extensions to create the XML mapping to ask for support in forums.
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/ICollectionElementRelation.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/IComponentElementMapper.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/IComponentMapKeyMapper.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/IMapKeyRelation.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/IPlainPropertyContainerMapper.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/CollectionElementRelationCustomizer.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ComponentElementCustomizer.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/MapKeyComponentCustomizer.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/MapKeyRelationCustomizer.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/PropertyContainerCustomizer.cs
trunk/nhibernate/src/NHibernate/NHibernate.csproj
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Generators.cs
trunk/nhibernate/src/NHibernate/Mapping/ByCode/MappingsExtensions.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/
trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/
trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Address.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Animal.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Classification.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/DomesticAnimal.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Human.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Mammal.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Name.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Reptile.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/StateProvince.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/User.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Zoo.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/ShowXmlDemo.cs
Removed Paths:
-------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/Generators.cs
Copied: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Generators.cs (from rev 5574, trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/Generators.cs)
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Generators.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Generators.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -0,0 +1,185 @@
+using System;
+using System.Linq.Expressions;
+using System.Reflection;
+
+namespace NHibernate.Mapping.ByCode
+{
+ public static class Generators
+ {
+ static Generators()
+ {
+ Native = new NativeGeneratorDef();
+ HighLow = new HighLowGeneratorDef();
+ Guid = new GuidGeneratorDef();
+ GuidComb = new GuidCombGeneratorDef();
+ Sequence = new SequenceGeneratorDef();
+ Identity = new IdentityGeneratorDef();
+ Assigned = new AssignedGeneratorDef();
+ }
+
+ public static IGeneratorDef Assigned { get; private set; }
+ public static IGeneratorDef Native { get; private set; }
+ public static IGeneratorDef HighLow { get; private set; }
+ public static IGeneratorDef Guid { get; private set; }
+ public static IGeneratorDef GuidComb { get; private set; }
+ public static IGeneratorDef Sequence { get; private set; }
+ public static IGeneratorDef Identity { get; private set; }
+
+ public static IGeneratorDef Foreign<TEntity>(Expression<Func<TEntity, object>> property)
+ {
+ return new ForeignGeneratorDef(TypeExtensions.DecodeMemberAccessExpression(property));
+ }
+
+ public static IGeneratorDef Foreign(MemberInfo property)
+ {
+ return new ForeignGeneratorDef(property);
+ }
+ }
+
+ public class AssignedGeneratorDef : IGeneratorDef
+ {
+ #region Implementation of IGeneratorDef
+
+ public string Class
+ {
+ get { return "assigned"; }
+ }
+
+ public object Params
+ {
+ get { return null; }
+ }
+
+ #endregion
+ }
+
+ public class ForeignGeneratorDef : IGeneratorDef
+ {
+ private readonly object param;
+
+ public ForeignGeneratorDef(MemberInfo foreignProperty)
+ {
+ if (foreignProperty == null)
+ {
+ throw new ArgumentNullException("foreignProperty");
+ }
+ param = new {property = foreignProperty.Name};
+ }
+
+ #region Implementation of IGeneratorDef
+
+ public string Class
+ {
+ get { return "foreign"; }
+ }
+
+ public object Params
+ {
+ get { return param; }
+ }
+
+ #endregion
+ }
+
+ public class NativeGeneratorDef : IGeneratorDef
+ {
+ #region Implementation of IGeneratorDef
+
+ public string Class
+ {
+ get { return "native"; }
+ }
+
+ public object Params
+ {
+ get { return null; }
+ }
+
+ #endregion
+ }
+
+ public class HighLowGeneratorDef : IGeneratorDef
+ {
+ #region Implementation of IGeneratorDef
+
+ public string Class
+ {
+ get { return "hilo"; }
+ }
+
+ public object Params
+ {
+ get { return null; }
+ }
+
+ #endregion
+ }
+
+ public class GuidGeneratorDef : IGeneratorDef
+ {
+ #region Implementation of IGeneratorDef
+
+ public string Class
+ {
+ get { return "guid"; }
+ }
+
+ public object Params
+ {
+ get { return null; }
+ }
+
+ #endregion
+ }
+
+ public class GuidCombGeneratorDef : IGeneratorDef
+ {
+ #region Implementation of IGeneratorDef
+
+ public string Class
+ {
+ get { return "guid.comb"; }
+ }
+
+ public object Params
+ {
+ get { return null; }
+ }
+
+ #endregion
+ }
+
+ public class SequenceGeneratorDef : IGeneratorDef
+ {
+ #region Implementation of IGeneratorDef
+
+ public string Class
+ {
+ get { return "sequence"; }
+ }
+
+ public object Params
+ {
+ get { return null; }
+ }
+
+ #endregion
+ }
+
+ public class IdentityGeneratorDef : IGeneratorDef
+ {
+ #region Implementation of IGeneratorDef
+
+ public string Class
+ {
+ get { return "identity"; }
+ }
+
+ public object Params
+ {
+ get { return null; }
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/ICollectionElementRelation.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/ICollectionElementRelation.cs 2011-04-02 21:26:20 UTC (rev 5585)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/ICollectionElementRelation.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -12,8 +12,11 @@
public interface ICollectionElementRelation<TElement>
{
+ void Element();
void Element(Action<IElementMapper> mapping);
+ void OneToMany();
void OneToMany(Action<IOneToManyMapper> mapping);
+ void ManyToMany();
void ManyToMany(Action<IManyToManyMapper> mapping);
void Component(Action<IComponentElementMapper<TElement>> mapping);
}
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/IComponentElementMapper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/IComponentElementMapper.cs 2011-04-02 21:26:20 UTC (rev 5585)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/IComponentElementMapper.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -16,11 +16,13 @@
public interface IComponentElementMapper<TComponent> : IComponentAttributesMapper<TComponent>
{
void Property<TProperty>(Expression<Func<TComponent, TProperty>> property, Action<IPropertyMapper> mapping);
+ void Property<TProperty>(Expression<Func<TComponent, TProperty>> property);
void Component<TNestedComponent>(Expression<Func<TComponent, TNestedComponent>> property,
Action<IComponentElementMapper<TNestedComponent>> mapping)
where TNestedComponent : class;
void ManyToOne<TProperty>(Expression<Func<TComponent, TProperty>> property, Action<IManyToOneMapper> mapping) where TProperty : class;
+ void ManyToOne<TProperty>(Expression<Func<TComponent, TProperty>> property) where TProperty : class;
}
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/IComponentMapKeyMapper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/IComponentMapKeyMapper.cs 2011-04-02 21:26:20 UTC (rev 5585)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/IComponentMapKeyMapper.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -14,6 +14,7 @@
public interface IComponentMapKeyMapper<TComponent>
{
void Property<TProperty>(Expression<Func<TComponent, TProperty>> property, Action<IPropertyMapper> mapping);
+ void Property<TProperty>(Expression<Func<TComponent, TProperty>> property);
void ManyToOne<TProperty>(Expression<Func<TComponent, TProperty>> property, Action<IManyToOneMapper> mapping) where TProperty : class;
}
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/IMapKeyRelation.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/IMapKeyRelation.cs 2011-04-02 21:26:20 UTC (rev 5585)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/IMapKeyRelation.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -11,7 +11,9 @@
public interface IMapKeyRelation<TKey>
{
+ void Element();
void Element(Action<IMapKeyMapper> mapping);
+ void ManyToMany();
void ManyToMany(Action<IMapKeyManyToManyMapper> mapping);
void Component(Action<IComponentMapKeyMapper<TKey>> mapping);
}
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/IPlainPropertyContainerMapper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/IPlainPropertyContainerMapper.cs 2011-04-02 21:26:20 UTC (rev 5585)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/IPlainPropertyContainerMapper.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -29,6 +29,8 @@
Action<IComponentMapper<TComponent>> mapping) where TComponent : class;
void ManyToOne<TProperty>(Expression<Func<TContainer, TProperty>> property, Action<IManyToOneMapper> mapping) where TProperty : class;
+ void ManyToOne<TProperty>(Expression<Func<TContainer, TProperty>> property) where TProperty : class;
+
void OneToOne<TProperty>(Expression<Func<TContainer, TProperty>> property, Action<IOneToOneMapper> mapping) where TProperty : class;
void Any<TProperty>(Expression<Func<TContainer, TProperty>> property, System.Type idTypeOfMetaType, Action<IAnyMapper> mapping) where TProperty : class;
}
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/CollectionElementRelationCustomizer.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/CollectionElementRelationCustomizer.cs 2011-04-02 21:26:20 UTC (rev 5585)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/CollectionElementRelationCustomizer.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -21,18 +21,33 @@
#region ICollectionElementRelation<TElement> Members
+ public void Element()
+ {
+ Element(x => { });
+ }
+
public void Element(Action<IElementMapper> mapping)
{
var collectionElementCustomizer = new CollectionElementCustomizer(propertyPath, customizersHolder);
mapping(collectionElementCustomizer);
}
+ public void OneToMany()
+ {
+ OneToMany(x => { });
+ }
+
public void OneToMany(Action<IOneToManyMapper> mapping)
{
var oneToManyCustomizer = new OneToManyCustomizer(explicitDeclarationsHolder, propertyPath, customizersHolder);
mapping(oneToManyCustomizer);
}
+ public void ManyToMany()
+ {
+ ManyToMany(x => { });
+ }
+
public void ManyToMany(Action<IManyToManyMapper> mapping)
{
var manyToManyCustomizer = new ManyToManyCustomizer(explicitDeclarationsHolder, propertyPath, customizersHolder);
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ComponentElementCustomizer.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ComponentElementCustomizer.cs 2011-04-02 21:26:20 UTC (rev 5585)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/ComponentElementCustomizer.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -63,6 +63,11 @@
customizersHolder.AddCustomizer(new PropertyPath(propertyPath, memberOf), mapping);
}
+ public void Property<TProperty>(Expression<Func<TComponent, TProperty>> property)
+ {
+ Property(property, x => { });
+ }
+
public void Component<TNestedComponent>(Expression<Func<TComponent, TNestedComponent>> property, Action<IComponentElementMapper<TNestedComponent>> mapping)
where TNestedComponent : class
{
@@ -80,6 +85,11 @@
customizersHolder.AddCustomizer(new PropertyPath(propertyPath, memberOf), mapping);
}
+ public void ManyToOne<TProperty>(Expression<Func<TComponent, TProperty>> property) where TProperty : class
+ {
+ ManyToOne(property, x => { });
+ }
+
public void Access(Accessor accessor)
{
customizersHolder.AddCustomizer(typeof (TComponent), (IComponentAttributesMapper x) => x.Access(accessor));
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/MapKeyComponentCustomizer.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/MapKeyComponentCustomizer.cs 2011-04-02 21:26:20 UTC (rev 5585)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/MapKeyComponentCustomizer.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -23,6 +23,11 @@
customizersHolder.AddCustomizer(new PropertyPath(propertyPath, member), mapping);
}
+ public void Property<TProperty>(Expression<Func<TKey, TProperty>> property)
+ {
+ Property(property, x => { });
+ }
+
public void ManyToOne<TProperty>(Expression<Func<TKey, TProperty>> property, Action<IManyToOneMapper> mapping) where TProperty : class
{
MemberInfo member = TypeExtensions.DecodeMemberAccessExpression(property);
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/MapKeyRelationCustomizer.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/MapKeyRelationCustomizer.cs 2011-04-02 21:26:20 UTC (rev 5585)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/MapKeyRelationCustomizer.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -21,12 +21,22 @@
#region IMapKeyRelation<TKey> Members
+ public void Element()
+ {
+ Element(x => { });
+ }
+
public void Element(Action<IMapKeyMapper> mapping)
{
var mapKeyCustomizer = new MapKeyCustomizer(propertyPath, customizersHolder);
mapping(mapKeyCustomizer);
}
+ public void ManyToMany()
+ {
+ ManyToMany(x => { });
+ }
+
public void ManyToMany(Action<IMapKeyManyToManyMapper> mapping)
{
var manyToManyCustomizer = new MapKeyManyToManyCustomizer(explicitDeclarationsHolder, propertyPath, customizersHolder);
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/PropertyContainerCustomizer.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/PropertyContainerCustomizer.cs 2011-04-02 21:26:20 UTC (rev 5585)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/CustomizersImpl/PropertyContainerCustomizer.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -64,6 +64,11 @@
explicitDeclarationsHolder.AddAsManyToOneRelation(memberOf);
}
+ public void ManyToOne<TProperty>(Expression<Func<TEntity, TProperty>> property) where TProperty : class
+ {
+ ManyToOne(property, x => { });
+ }
+
public void OneToOne<TProperty>(Expression<Func<TEntity, TProperty>> property, Action<IOneToOneMapper> mapping)
where TProperty : class
{
Deleted: trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/Generators.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/Generators.cs 2011-04-02 21:26:20 UTC (rev 5585)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/Impl/Generators.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -1,185 +0,0 @@
-using System;
-using System.Linq.Expressions;
-using System.Reflection;
-
-namespace NHibernate.Mapping.ByCode.Impl
-{
- public static class Generators
- {
- static Generators()
- {
- Native = new NativeGeneratorDef();
- HighLow = new HighLowGeneratorDef();
- Guid = new GuidGeneratorDef();
- GuidComb = new GuidCombGeneratorDef();
- Sequence = new SequenceGeneratorDef();
- Identity = new IdentityGeneratorDef();
- Assigned = new AssignedGeneratorDef();
- }
-
- public static IGeneratorDef Assigned { get; private set; }
- public static IGeneratorDef Native { get; private set; }
- public static IGeneratorDef HighLow { get; private set; }
- public static IGeneratorDef Guid { get; private set; }
- public static IGeneratorDef GuidComb { get; private set; }
- public static IGeneratorDef Sequence { get; private set; }
- public static IGeneratorDef Identity { get; private set; }
-
- public static IGeneratorDef Foreign<TEntity>(Expression<Func<TEntity, object>> property)
- {
- return new ForeignGeneratorDef(TypeExtensions.DecodeMemberAccessExpression(property));
- }
-
- public static IGeneratorDef Foreign(MemberInfo property)
- {
- return new ForeignGeneratorDef(property);
- }
- }
-
- public class AssignedGeneratorDef : IGeneratorDef
- {
- #region Implementation of IGeneratorDef
-
- public string Class
- {
- get { return "assigned"; }
- }
-
- public object Params
- {
- get { return null; }
- }
-
- #endregion
- }
-
- public class ForeignGeneratorDef : IGeneratorDef
- {
- private readonly object param;
-
- public ForeignGeneratorDef(MemberInfo foreignProperty)
- {
- if (foreignProperty == null)
- {
- throw new ArgumentNullException("foreignProperty");
- }
- param = new {property = foreignProperty.Name};
- }
-
- #region Implementation of IGeneratorDef
-
- public string Class
- {
- get { return "foreign"; }
- }
-
- public object Params
- {
- get { return param; }
- }
-
- #endregion
- }
-
- public class NativeGeneratorDef : IGeneratorDef
- {
- #region Implementation of IGeneratorDef
-
- public string Class
- {
- get { return "native"; }
- }
-
- public object Params
- {
- get { return null; }
- }
-
- #endregion
- }
-
- public class HighLowGeneratorDef : IGeneratorDef
- {
- #region Implementation of IGeneratorDef
-
- public string Class
- {
- get { return "hilo"; }
- }
-
- public object Params
- {
- get { return null; }
- }
-
- #endregion
- }
-
- public class GuidGeneratorDef : IGeneratorDef
- {
- #region Implementation of IGeneratorDef
-
- public string Class
- {
- get { return "guid"; }
- }
-
- public object Params
- {
- get { return null; }
- }
-
- #endregion
- }
-
- public class GuidCombGeneratorDef : IGeneratorDef
- {
- #region Implementation of IGeneratorDef
-
- public string Class
- {
- get { return "guid.comb"; }
- }
-
- public object Params
- {
- get { return null; }
- }
-
- #endregion
- }
-
- public class SequenceGeneratorDef : IGeneratorDef
- {
- #region Implementation of IGeneratorDef
-
- public string Class
- {
- get { return "sequence"; }
- }
-
- public object Params
- {
- get { return null; }
- }
-
- #endregion
- }
-
- public class IdentityGeneratorDef : IGeneratorDef
- {
- #region Implementation of IGeneratorDef
-
- public string Class
- {
- get { return "identity"; }
- }
-
- public object Params
- {
- get { return null; }
- }
-
- #endregion
- }
-}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate/Mapping/ByCode/MappingsExtensions.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/MappingsExtensions.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/MappingsExtensions.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -0,0 +1,104 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Xml;
+using System.Xml.Serialization;
+using NHibernate.Cfg.MappingSchema;
+
+namespace NHibernate.Mapping.ByCode
+{
+ /// <summary>
+ /// Util extensions to use in your test or where you need to see the XML mappings
+ /// </summary>
+ public static class MappingsExtensions
+ {
+ public static void WriteAllXmlMapping(this IEnumerable<HbmMapping> mappings)
+ {
+ if (mappings == null)
+ {
+ throw new ArgumentNullException("mappings");
+ }
+ string mappingsFolderPath = ArrangeMappingsFolderPath();
+ foreach (HbmMapping hbmMapping in mappings)
+ {
+ string fileName = GetFileName(hbmMapping);
+ string document = Serialize(hbmMapping);
+ File.WriteAllText(Path.Combine(mappingsFolderPath, fileName), document);
+ }
+ }
+
+ public static string AsString(this HbmMapping mappings)
+ {
+ if (mappings == null)
+ {
+ throw new ArgumentNullException("mappings");
+ }
+ return Serialize(mappings);
+ }
+
+ private static string ArrangeMappingsFolderPath()
+ {
+ string baseDir = AppDomain.CurrentDomain.BaseDirectory;
+ string relativeSearchPath = AppDomain.CurrentDomain.RelativeSearchPath;
+ string binPath = relativeSearchPath != null ? Path.Combine(baseDir, relativeSearchPath): baseDir;
+ string mappingsFolderPath = Path.Combine(binPath, "Mappings");
+
+ if (!Directory.Exists(mappingsFolderPath))
+ {
+ Directory.CreateDirectory(mappingsFolderPath);
+ }
+ else
+ {
+ System.Array.ForEach(Directory.GetFiles(mappingsFolderPath), File.Delete);
+ }
+ return mappingsFolderPath;
+ }
+
+ private static string GetFileName(HbmMapping hbmMapping)
+ {
+ string name = "MyMapping";
+ HbmClass rc = hbmMapping.RootClasses.FirstOrDefault();
+ if (rc != null)
+ {
+ name = rc.Name;
+ }
+ HbmSubclass sc = hbmMapping.SubClasses.FirstOrDefault();
+ if (sc != null)
+ {
+ name = sc.Name;
+ }
+ HbmJoinedSubclass jc = hbmMapping.JoinedSubclasses.FirstOrDefault();
+ if (jc != null)
+ {
+ name = jc.Name;
+ }
+ HbmUnionSubclass uc = hbmMapping.UnionSubclasses.FirstOrDefault();
+ if (uc != null)
+ {
+ name = uc.Name;
+ }
+ return name + ".hbm.xml";
+ }
+
+ private static string Serialize(HbmMapping hbmElement)
+ {
+ string result;
+ var setting = new XmlWriterSettings { Indent = true };
+ var serializer = new XmlSerializer(typeof(HbmMapping));
+ using (var memStream = new MemoryStream(2048))
+ {
+ using (XmlWriter xmlWriter = XmlWriter.Create(memStream, setting))
+ {
+ serializer.Serialize(xmlWriter, hbmElement);
+ }
+ memStream.Position = 0;
+ using (var sr = new StreamReader(memStream))
+ {
+ result = sr.ReadToEnd();
+ }
+ }
+ return result;
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-04-02 21:26:20 UTC (rev 5585)
+++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-04-02 23:00:42 UTC (rev 5586)
@@ -363,7 +363,7 @@
<Compile Include="Mapping\ByCode\Impl\ElementMapper.cs" />
<Compile Include="Mapping\ByCode\Impl\FilterMapper.cs" />
<Compile Include="Mapping\ByCode\Impl\GeneratorMapper.cs" />
- <Compile Include="Mapping\ByCode\Impl\Generators.cs" />
+ <Compile Include="Mapping\ByCode\Generators.cs" />
<Compile Include="Mapping\ByCode\Impl\ICandidatePersistentMembersProvider.cs" />
<Compile Include="Mapping\ByCode\Impl\ICustomizersHolder.cs" />
<Compile Include="Mapping\ByCode\Impl\IdMapper.cs" />
@@ -404,6 +404,7 @@
<Compile Include="Mapping\ByCode\IVersionMapper.cs" />
<Compile Include="Mapping\ByCode\Lazy.cs" />
<Compile Include="Mapping\ByCode\ModelMapper.cs" />
+ <Compile Include="Mapping\ByCode\MappingsExtensions.cs" />
<Compile Include="Mapping\ByCode\NotFoundMode.cs" />
<Compile Include="Mapping\ByCode\SchemaAction.cs" />
<Compile Include="Mapping\ByCode\TypeExtensions.cs" />
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Address.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Address.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Address.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -0,0 +1,15 @@
+namespace NHibernate.Test.MappingByCode.NatureDemo.Naturalness
+{
+ public class Address
+ {
+ public string Street { get; set; }
+
+ public string City { get; set; }
+
+ public string PostalCode { get; set; }
+
+ public string Country { get; set; }
+
+ public StateProvince StateProvince { get; set; }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Animal.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Animal.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Animal.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -0,0 +1,33 @@
+using Iesi.Collections.Generic;
+
+namespace NHibernate.Test.MappingByCode.NatureDemo.Naturalness
+{
+ public class Animal
+ {
+ public virtual long Id { get; set; }
+
+ public virtual float BodyWeight { get; set; }
+
+ public virtual ISet<Animal> Offspring { get; set; }
+
+ public virtual Animal Mother { get; set; }
+
+ public virtual Animal Father { get; set; }
+
+ public virtual string Description { get; set; }
+
+ public virtual Zoo Zoo { get; set; }
+
+ public virtual string SerialNumber { get; set; }
+
+ public virtual void AddOffspring(Animal offSpring)
+ {
+ if (Offspring == null)
+ {
+ Offspring = new HashedSet<Animal>();
+ }
+
+ Offspring.Add(offSpring);
+ }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Classification.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Classification.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Classification.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -0,0 +1,8 @@
+namespace NHibernate.Test.MappingByCode.NatureDemo.Naturalness
+{
+ public enum Classification
+ {
+ Cool = 0,
+ Lame = 1
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/DomesticAnimal.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/DomesticAnimal.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/DomesticAnimal.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -0,0 +1,10 @@
+namespace NHibernate.Test.MappingByCode.NatureDemo.Naturalness
+{
+ public class DomesticAnimal: Mammal
+ {
+ public virtual Human Owner { get; set; }
+ }
+
+ public class Cat : DomesticAnimal { }
+ public class Dog : DomesticAnimal { }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Human.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Human.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Human.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -0,0 +1,32 @@
+using System.Collections.Generic;
+using Iesi.Collections.Generic;
+
+namespace NHibernate.Test.MappingByCode.NatureDemo.Naturalness
+{
+ public class Human : Mammal
+ {
+ public virtual Name Name { get; set; }
+
+ public virtual string NickName { get; set; }
+
+ public virtual ICollection<Human> Friends { get; set; }
+
+ public virtual ICollection<DomesticAnimal> Pets { get; set; }
+
+ public virtual IDictionary<string, Human> Family { get; set; }
+
+ public virtual double Height { get; set; }
+
+ public virtual long BigIntegerValue { get; set; }
+
+ public virtual decimal BigDecimalValue { get; set; }
+
+ public virtual int IntValue { get; set; }
+
+ public virtual float FloatValue { get; set; }
+
+ public virtual ISet<string> NickNames { get; set; }
+
+ public virtual IDictionary<string, Address> Addresses { get; set; }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Mammal.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Mammal.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Mammal.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -0,0 +1,16 @@
+using System;
+
+namespace NHibernate.Test.MappingByCode.NatureDemo.Naturalness
+{
+ public class Mammal : Animal
+ {
+ public Mammal()
+ {
+ Birthdate = DateTime.Today;
+ }
+
+ public virtual bool Pregnant { get; set; }
+
+ public virtual DateTime Birthdate { get; set; }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Name.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Name.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Name.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -0,0 +1,11 @@
+namespace NHibernate.Test.MappingByCode.NatureDemo.Naturalness
+{
+ public class Name
+ {
+ public string First { get; set; }
+
+ public char Initial { get; set; }
+
+ public string Last { get; set; }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Reptile.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Reptile.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Reptile.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -0,0 +1,9 @@
+namespace NHibernate.Test.MappingByCode.NatureDemo.Naturalness
+{
+ public class Reptile : Animal
+ {
+ public virtual float BodyTemperature { get; set; }
+ }
+
+ public class Lizard : Reptile {}
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/StateProvince.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/StateProvince.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/StateProvince.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -0,0 +1,11 @@
+namespace NHibernate.Test.MappingByCode.NatureDemo.Naturalness
+{
+ public class StateProvince
+ {
+ public virtual long Id { get; set; }
+
+ public virtual string Name { get; set; }
+
+ public virtual string IsoCode { get; set; }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/User.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/User.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/User.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -0,0 +1,15 @@
+using System.Collections.Generic;
+
+namespace NHibernate.Test.MappingByCode.NatureDemo.Naturalness
+{
+ public class User
+ {
+ public virtual long Id { get; set; }
+
+ public virtual string UserName { get; set; }
+
+ public virtual Human Human { get; set; }
+
+ public virtual IList<string> Permissions { get; set; }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Zoo.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Zoo.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/Naturalness/Zoo.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -0,0 +1,21 @@
+using System.Collections.Generic;
+
+namespace NHibernate.Test.MappingByCode.NatureDemo.Naturalness
+{
+ public class Zoo
+ {
+ public virtual long Id { get; set; }
+
+ public virtual string Name { get; set; }
+
+ public virtual Classification Classification { get; set; }
+
+ public virtual IDictionary<string, Animal> Animals { get; set; }
+
+ public virtual IDictionary<string, Mammal> Mammals { get; set; }
+
+ public virtual Address Address { get; set; }
+ }
+
+ public class PettingZoo : Zoo {}
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/ShowXmlDemo.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/ShowXmlDemo.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/NatureDemo/ShowXmlDemo.cs 2011-04-02 23:00:42 UTC (rev 5586)
@@ -0,0 +1,124 @@
+using System;
+using System.Linq;
+using NHibernate.Cfg.MappingSchema;
+using NHibernate.Mapping.ByCode;
+using NHibernate.Test.MappingByCode.NatureDemo.Naturalness;
+using NUnit.Framework;
+
+namespace NHibernate.Test.MappingByCode.NatureDemo
+{
+ public class ShowXmlDemo
+ {
+ [Test, Explicit]
+ public void MappingAndShowXmlInConsole()
+ {
+ Console.Write(GetMapping().AsString());
+ }
+
+ public static HbmMapping GetMapping()
+ {
+ var mapper = new ModelMapper();
+
+ mapper.Class<Animal>(rc=>
+ {
+ rc.Id(x => x.Id, map => map.Generator(Generators.Native));
+
+ rc.Property(animal => animal.Description);
+ rc.Property(animal => animal.BodyWeight);
+ rc.ManyToOne(animal => animal.Mother);
+ rc.ManyToOne(animal => animal.Father);
+ rc.ManyToOne(animal => animal.Zoo);
+ rc.Property(animal => animal.SerialNumber);
+ rc.Set(animal => animal.Offspring, cm => cm.OrderBy(an => an.Father), rel => rel.OneToMany());
+ });
+
+ mapper.JoinedSubclass<Reptile>(jsc => { jsc.Property(reptile => reptile.BodyTemperature); });
+
+ mapper.JoinedSubclass<Lizard>(jsc => { });
+
+ mapper.JoinedSubclass<Mammal>(jsc =>
+ {
+ jsc.Property(mammal => mammal.Pregnant);
+ jsc.Property(mammal => mammal.Birthdate);
+ });
+
+ mapper.JoinedSubclass<DomesticAnimal>(jsc =>
+ {
+ jsc.ManyToOne(domesticAnimal => domesticAnimal.Owner);
+ });
+
+ mapper.JoinedSubclass<Cat>(jsc => { });
+
+ mapper.JoinedSubclass<Dog>(jsc => { });
+
+ mapper.JoinedSubclass<Human>(jsc =>
+ {
+ jsc.Component(human => human.Name, comp =>
+ {
+ comp.Property(name => name.First);
+ comp.Property(name => name.Initial);
+ comp.Property(name => name.Last);
+ });
+ jsc.Property(human => human.NickName);
+ jsc.Property(human => human.Height);
+ jsc.Property(human => human.IntValue);
+ jsc.Property(human => human.FloatValue);
+ jsc.Property(human => human.BigDecimalValue);
+ jsc.Property(human => human.BigIntegerValue);
+ jsc.Bag(human => human.Friends, cm => { }, rel => rel.ManyToMany());
+ jsc.Map(human => human.Family, cm => { }, km=> { }, rel => rel.ManyToMany());
+ jsc.Bag(human => human.Pets, cm => { cm.Inverse(true); }, rel => rel.OneToMany());
+ jsc.Set(human => human.NickNames, cm =>
+ {
+ cm.Lazy(CollectionLazy.NoLazy);
+ cm.Sort();
+ }, cer => { });
+ jsc.Map(human => human.Addresses, cm => { }, mk => { }, rel => rel.Component(comp =>
+ {
+ comp.Property(address => address.Street);
+ comp.Property(address => address.City);
+ comp.Property(address => address.PostalCode);
+ comp.Property(address => address.Country);
+ comp.ManyToOne(address => address.StateProvince);
+ }));
+ });
+
+ mapper.Class<User>(rc =>
+ {
+ rc.Id(u => u.Id, im => im.Generator(Generators.Foreign<User>(u => u.Human)));
+
+ rc.Property(user => user.UserName);
+ rc.OneToOne(user => user.Human, rm => rm.Constrained(true));
+ rc.List(user => user.Permissions, cm => { }, cer => { });
+ });
+
+ mapper.Class<Zoo>(rc =>
+ {
+ rc.Id(x => x.Id, map => map.Generator(Generators.Native));
+ rc.Property(zoo => zoo.Name);
+ rc.Property(zoo => zoo.Classification);
+ rc.Map(zoo => zoo.Mammals, cm => { }, km => { km.Element(); }, rel => rel.OneToMany());
+ rc.Map(zoo => zoo.Animals, cm => { cm.Inverse(true); }, km => { km.Element(); }, rel => rel.OneToMany());
+ rc.Component(zoo => zoo.Address, comp =>
+ {
+ comp.Property(address => address.Street);
+ comp.Property(address => address.City);
+ comp.Property(address => address.PostalCode);
+ comp.Property(address => address.Country);
+ comp.ManyToOne(address => address.StateProvince);
+ });
+ });
+
+ mapper.Subclass<PettingZoo>(sc => { });
+
+ mapper.Class<StateProvince>(rc =>
+ {
+ rc.Id(x => x.Id, map => map.Generator(Generators.Native));
+ rc.Property(sp => sp.Name);
+ rc.Property(sp => sp.IsoCode);
+ });
+ return mapper.CompileMappingFor(typeof (Animal).Assembly.GetTypes().Where(t => t.Namespace == typeof (Animal).Namespace));
+ }
+
+ }
+}
\ 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-02 21:26:20 UTC (rev 5585)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-02 23:00:42 UTC (rev 5586)
@@ -519,6 +519,18 @@
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\UnionSubclassMappingStrategyTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\UnionSubclassSequenceRegistrationTests.cs" />
<Compile Include="MappingByCode\MappingOfPrivateMembersOnRootEntity.cs" />
+ <Compile Include="MappingByCode\NatureDemo\Naturalness\Address.cs" />
+ <Compile Include="MappingByCode\NatureDemo\Naturalness\Animal.cs" />
+ <Compile Include="MappingByCode\NatureDemo\Naturalness\Classification.cs" />
+ <Compile Include="MappingByCode\NatureDemo\Naturalness\DomesticAnimal.cs" />
+ <Compile Include="MappingByCode\NatureDemo\Naturalness\Human.cs" />
+ <Compile Include="MappingByCode\NatureDemo\Naturalness\Mammal.cs" />
+ <Compile Include="MappingByCode\NatureDemo\Naturalness\Name.cs" />
+ <Compile Include="MappingByCode\NatureDemo\Naturalness\Reptile.cs" />
+ <Compile Include="MappingByCode\NatureDemo\ShowXmlDemo.cs" />
+ <Compile Include="MappingByCode\NatureDemo\Naturalness\StateProvince.cs" />
+ <Compile Include="MappingByCode\NatureDemo\Naturalness\User.cs" />
+ <Compile Include="MappingByCode\NatureDemo\Naturalness\Zoo.cs" />
<Compile Include="NHSpecificTest\AccessAndCorrectPropertyName\Fixture.cs" />
<Compile Include="NHSpecificTest\AccessAndCorrectPropertyName\Model.cs" />
<Compile Include="NHSpecificTest\BagWithLazyExtraAndFilter\Domain.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-02 21:26:26
|
Revision: 5585
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5585&view=rev
Author: fabiomaulo
Date: 2011-04-02 21:26:20 +0000 (Sat, 02 Apr 2011)
Log Message:
-----------
IsEntity should use enlisted registrations
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/JoinedSubclassSequenceRegistrationTests.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-02 21:18:48 UTC (rev 5584)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-02 21:26:20 UTC (rev 5585)
@@ -404,7 +404,9 @@
tablePerClassEntities.Contains(type) ||
tablePerClassHierarchyEntities.Contains(type) ||
tablePerClassHierarchyJoinEntities.Contains(type) ||
- tablePerConcreteClassEntities.Contains(type);
+ tablePerConcreteClassEntities.Contains(type) ||
+ HasDelayedEntityRegistration(type)
+ ;
}
public bool IsTablePerClass(System.Type type)
@@ -556,5 +558,10 @@
registration(type);
}
}
+
+ private bool HasDelayedEntityRegistration(System.Type type)
+ {
+ return delayedEntityRegistrations.ContainsKey(type);
+ }
}
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/JoinedSubclassSequenceRegistrationTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/JoinedSubclassSequenceRegistrationTests.cs 2011-04-02 21:18:48 UTC (rev 5584)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/JoinedSubclassSequenceRegistrationTests.cs 2011-04-02 21:26:20 UTC (rev 5585)
@@ -33,5 +33,14 @@
inspector.Executing(x => x.IsTablePerClass(typeof(Inherited1))).Throws<MappingException>();
}
+
+ [Test]
+ public void WhenRegisterJoinedSubclassWithNoRootThenCanAskForIsEntity()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsTablePerClassEntity(typeof(Inherited1));
+
+ inspector.IsEntity(typeof(Inherited1)).Should().Be.True();
+ }
}
}
\ 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-02 21:18:54
|
Revision: 5584
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5584&view=rev
Author: fabiomaulo
Date: 2011-04-02 21:18:48 +0000 (Sat, 02 Apr 2011)
Log Message:
-----------
Minor
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-02 20:54:38 UTC (rev 5583)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-02 21:18:48 UTC (rev 5584)
@@ -29,7 +29,7 @@
private readonly HashSet<System.Type> tablePerClassHierarchyJoinEntities = new HashSet<System.Type>();
private readonly HashSet<System.Type> tablePerConcreteClassEntities = new HashSet<System.Type>();
private readonly HashSet<MemberInfo> versionProperties = new HashSet<MemberInfo>();
- private Dictionary<System.Type, Action<System.Type>> delayedTypeRegistration = new Dictionary<System.Type, Action<System.Type>>();
+ private readonly Dictionary<System.Type, Action<System.Type>> delayedEntityRegistrations = new Dictionary<System.Type, Action<System.Type>>();
#region IModelExplicitDeclarationsHolder Members
@@ -544,14 +544,15 @@
private void EnlistTypeRegistration(System.Type type, Action<System.Type> registration)
{
- delayedTypeRegistration.Add(type, registration);
+ delayedEntityRegistrations.Add(type, registration);
}
private void ExecuteDelayedTypeRegistration(System.Type type)
{
Action<System.Type> registration;
- if(delayedTypeRegistration.TryGetValue(type, out registration))
+ if(delayedEntityRegistrations.TryGetValue(type, out registration))
{
+ delayedEntityRegistrations.Remove(type);
registration(type);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-02 20:54:44
|
Revision: 5583
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5583&view=rev
Author: fabiomaulo
Date: 2011-04-02 20:54:38 +0000 (Sat, 02 Apr 2011)
Log Message:
-----------
union-Subclass Sequence registration fix
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/UnionSubclassSequenceRegistrationTests.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-02 20:48:13 UTC (rev 5582)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-02 20:54:38 UTC (rev 5583)
@@ -262,6 +262,11 @@
public void AddAsTablePerConcreteClassEntity(System.Type type)
{
+ AddAsTablePerConcreteClassEntity(type, false);
+ }
+
+ public void AddAsTablePerConcreteClassEntity(System.Type type, bool rootEntityMustExists)
+ {
if (IsComponent(type))
{
throw new MappingException(string.Format("Abiguous mapping of {0}. It was registered as entity and as component", type.FullName));
@@ -279,6 +284,14 @@
}
tablePerConcreteClassEntities.Add(rootEntity);
}
+ else
+ {
+ if (rootEntityMustExists)
+ {
+ throw new MappingException(string.Format("The root entity for {0} was never registered", type.FullName));
+ }
+ EnlistTypeRegistration(type, t => AddAsTablePerConcreteClassEntity(t, true));
+ }
}
public void AddAsOneToOneRelation(MemberInfo member)
@@ -414,6 +427,7 @@
public bool IsTablePerConcreteClass(System.Type type)
{
+ ExecuteDelayedTypeRegistration(type);
return IsMappedFor(tablePerConcreteClassEntities, type);
}
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/UnionSubclassSequenceRegistrationTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/UnionSubclassSequenceRegistrationTests.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/UnionSubclassSequenceRegistrationTests.cs 2011-04-02 20:54:38 UTC (rev 5583)
@@ -0,0 +1,37 @@
+using NHibernate.Mapping.ByCode;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.MappingByCode.ExplicitlyDeclaredModelTests
+{
+ public class UnionSubclassSequenceRegistrationTests
+ {
+ private class MyClass
+ {
+
+ }
+ private class Inherited1 : MyClass
+ {
+
+ }
+
+ [Test]
+ public void WhenRegisterUnionSubclassBeforeRootThenIsRegistered()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsTablePerConcreteClassEntity(typeof(Inherited1));
+
+ inspector.AddAsRootEntity(typeof(MyClass));
+ inspector.IsTablePerConcreteClass(typeof(Inherited1)).Should().Be.True();
+ }
+
+ [Test]
+ public void WhenRegisterUnionSubclassWithNoRootThenThrows()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsTablePerConcreteClassEntity(typeof(Inherited1));
+
+ inspector.Executing(x => x.IsTablePerConcreteClass(typeof(Inherited1))).Throws<MappingException>();
+ }
+ }
+}
\ 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-02 20:48:13 UTC (rev 5582)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-02 20:54:38 UTC (rev 5583)
@@ -517,6 +517,7 @@
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\SubclassMappingStrategyTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\SubclassSequenceRegistrationTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\UnionSubclassMappingStrategyTests.cs" />
+ <Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\UnionSubclassSequenceRegistrationTests.cs" />
<Compile Include="MappingByCode\MappingOfPrivateMembersOnRootEntity.cs" />
<Compile Include="NHSpecificTest\AccessAndCorrectPropertyName\Fixture.cs" />
<Compile Include="NHSpecificTest\AccessAndCorrectPropertyName\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-02 20:48:19
|
Revision: 5582
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5582&view=rev
Author: fabiomaulo
Date: 2011-04-02 20:48:13 +0000 (Sat, 02 Apr 2011)
Log Message:
-----------
Subclass-Join Sequence registration fix
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassSequenceRegistrationTests.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassJoinSequenceRegistrationTests.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-02 20:40:33 UTC (rev 5581)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-02 20:48:13 UTC (rev 5582)
@@ -227,6 +227,11 @@
public void AddAsTablePerClassHierarchyJoinEntity(System.Type type)
{
+ AddAsTablePerClassHierarchyJoinEntity(type, false);
+ }
+
+ public void AddAsTablePerClassHierarchyJoinEntity(System.Type type, bool rootEntityMustExists)
+ {
if (IsComponent(type))
{
throw new MappingException(string.Format("Abiguous mapping of {0}. It was registered as entity and as component", type.FullName));
@@ -243,8 +248,16 @@
throw new MappingException(string.Format("Abiguous mapping of {0}. It was registered with more than one class-hierarchy strategy", type.FullName));
}
tablePerClassHierarchyEntities.Add(rootEntity);
+ tablePerClassHierarchyJoinEntities.Add(type);
}
- tablePerClassHierarchyJoinEntities.Add(type);
+ else
+ {
+ if (rootEntityMustExists)
+ {
+ throw new MappingException(string.Format("The root entity for {0} was never registered", type.FullName));
+ }
+ EnlistTypeRegistration(type, t => AddAsTablePerClassHierarchyJoinEntity(t, true));
+ }
}
public void AddAsTablePerConcreteClassEntity(System.Type type)
@@ -395,6 +408,7 @@
public bool IsTablePerClassHierarchyJoin(System.Type type)
{
+ ExecuteDelayedTypeRegistration(type);
return tablePerClassHierarchyJoinEntities.Contains(type);
}
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassJoinSequenceRegistrationTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassJoinSequenceRegistrationTests.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassJoinSequenceRegistrationTests.cs 2011-04-02 20:48:13 UTC (rev 5582)
@@ -0,0 +1,37 @@
+using NHibernate.Mapping.ByCode;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.MappingByCode.ExplicitlyDeclaredModelTests
+{
+ public class SubclassJoinSequenceRegistrationTests
+ {
+ private class MyClass
+ {
+
+ }
+ private class Inherited1 : MyClass
+ {
+
+ }
+
+ [Test]
+ public void WhenRegisterSubclassJoinBeforeRootThenIsRegistered()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsTablePerClassHierarchyJoinEntity(typeof(Inherited1));
+
+ inspector.AddAsRootEntity(typeof(MyClass));
+ inspector.IsTablePerClassHierarchyJoin(typeof(Inherited1)).Should().Be.True();
+ }
+
+ [Test]
+ public void WhenRegisterSubclassWithNoRootThenThrows()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsTablePerClassHierarchyJoinEntity(typeof(Inherited1));
+
+ inspector.Executing(x => x.IsTablePerClassHierarchyJoin(typeof(Inherited1))).Throws<MappingException>();
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassSequenceRegistrationTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassSequenceRegistrationTests.cs 2011-04-02 20:40:33 UTC (rev 5581)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassSequenceRegistrationTests.cs 2011-04-02 20:48:13 UTC (rev 5582)
@@ -31,7 +31,7 @@
var inspector = new ExplicitlyDeclaredModel();
inspector.AddAsTablePerClassHierarchyEntity(typeof(Inherited1));
- inspector.Executing(x => x.IsTablePerClass(typeof(Inherited1))).Throws<MappingException>();
+ inspector.Executing(x => x.IsTablePerClassHierarchy(typeof(Inherited1))).Throws<MappingException>();
}
}
}
\ 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-02 20:40:33 UTC (rev 5581)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-02 20:48:13 UTC (rev 5582)
@@ -513,6 +513,7 @@
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\JoinedSubclassSequenceRegistrationTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\RootClassMappingStrategyTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\SubclassJoinMappingStrategyTests.cs" />
+ <Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\SubclassJoinSequenceRegistrationTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\SubclassMappingStrategyTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\SubclassSequenceRegistrationTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\UnionSubclassMappingStrategyTests.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-02 20:40:41
|
Revision: 5581
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5581&view=rev
Author: fabiomaulo
Date: 2011-04-02 20:40:33 +0000 (Sat, 02 Apr 2011)
Log Message:
-----------
Subclass Sequence registration fix
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassSequenceRegistrationTests.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-02 20:32:31 UTC (rev 5580)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-02 20:40:33 UTC (rev 5581)
@@ -193,6 +193,11 @@
public void AddAsTablePerClassHierarchyEntity(System.Type type)
{
+ AddAsTablePerClassHierarchyEntity(type, false);
+ }
+
+ public void AddAsTablePerClassHierarchyEntity(System.Type type, bool rootEntityMustExists)
+ {
if (IsComponent(type))
{
throw new MappingException(string.Format("Abiguous mapping of {0}. It was registered as entity and as component", type.FullName));
@@ -210,6 +215,14 @@
}
tablePerClassHierarchyEntities.Add(rootEntity);
}
+ else
+ {
+ if (rootEntityMustExists)
+ {
+ throw new MappingException(string.Format("The root entity for {0} was never registered", type.FullName));
+ }
+ EnlistTypeRegistration(type, t => AddAsTablePerClassHierarchyEntity(t, true));
+ }
}
public void AddAsTablePerClassHierarchyJoinEntity(System.Type type)
@@ -376,6 +389,7 @@
public bool IsTablePerClassHierarchy(System.Type type)
{
+ ExecuteDelayedTypeRegistration(type);
return IsMappedFor(tablePerClassHierarchyEntities, type);
}
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassSequenceRegistrationTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassSequenceRegistrationTests.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassSequenceRegistrationTests.cs 2011-04-02 20:40:33 UTC (rev 5581)
@@ -0,0 +1,37 @@
+using NHibernate.Mapping.ByCode;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.MappingByCode.ExplicitlyDeclaredModelTests
+{
+ public class SubclassSequenceRegistrationTests
+ {
+ private class MyClass
+ {
+
+ }
+ private class Inherited1 : MyClass
+ {
+
+ }
+
+ [Test]
+ public void WhenRegisterSubclassBeforeRootThenIsRegistered()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsTablePerClassHierarchyEntity(typeof(Inherited1));
+
+ inspector.AddAsRootEntity(typeof(MyClass));
+ inspector.IsTablePerClassHierarchy(typeof(Inherited1)).Should().Be.True();
+ }
+
+ [Test]
+ public void WhenRegisterSubclassWithNoRootThenThrows()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsTablePerClassHierarchyEntity(typeof(Inherited1));
+
+ inspector.Executing(x => x.IsTablePerClass(typeof(Inherited1))).Throws<MappingException>();
+ }
+ }
+}
\ 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-02 20:32:31 UTC (rev 5580)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-02 20:40:33 UTC (rev 5581)
@@ -514,6 +514,7 @@
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\RootClassMappingStrategyTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\SubclassJoinMappingStrategyTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\SubclassMappingStrategyTests.cs" />
+ <Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\SubclassSequenceRegistrationTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\UnionSubclassMappingStrategyTests.cs" />
<Compile Include="MappingByCode\MappingOfPrivateMembersOnRootEntity.cs" />
<Compile Include="NHSpecificTest\AccessAndCorrectPropertyName\Fixture.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-02 20:32:37
|
Revision: 5580
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5580&view=rev
Author: fabiomaulo
Date: 2011-04-02 20:32:31 +0000 (Sat, 02 Apr 2011)
Log Message:
-----------
JoinedSubclass Sequence registration fix
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/JoinedSubclassSequenceRegistrationTests.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-02 19:38:43 UTC (rev 5579)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-02 20:32:31 UTC (rev 5580)
@@ -1,3 +1,4 @@
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
@@ -28,6 +29,7 @@
private readonly HashSet<System.Type> tablePerClassHierarchyJoinEntities = new HashSet<System.Type>();
private readonly HashSet<System.Type> tablePerConcreteClassEntities = new HashSet<System.Type>();
private readonly HashSet<MemberInfo> versionProperties = new HashSet<MemberInfo>();
+ private Dictionary<System.Type, Action<System.Type>> delayedTypeRegistration = new Dictionary<System.Type, Action<System.Type>>();
#region IModelExplicitDeclarationsHolder Members
@@ -157,14 +159,19 @@
public void AddAsTablePerClassEntity(System.Type type)
{
+ AddAsTablePerClassEntity(type, false);
+ }
+
+ public void AddAsTablePerClassEntity(System.Type type, bool rootEntityMustExists)
+ {
if (IsComponent(type))
{
throw new MappingException(string.Format("Abiguous mapping of {0}. It was registered as entity and as component", type.FullName));
}
var rootEntity = GetRootEntityOrNull(type);
- if(rootEntity != null)
+ if (rootEntity != null)
{
- if(rootEntity.Equals(type))
+ if (rootEntity.Equals(type))
{
throw new MappingException(string.Format("Abiguous mapping of {0}. It was registered as root-entity and as subclass for table-per-class strategy", type.FullName));
}
@@ -174,6 +181,14 @@
}
tablePerClassEntities.Add(rootEntity);
}
+ else
+ {
+ if(rootEntityMustExists)
+ {
+ throw new MappingException(string.Format("The root entity for {0} was never registered", type.FullName));
+ }
+ EnlistTypeRegistration(type, t => AddAsTablePerClassEntity(t, true));
+ }
}
public void AddAsTablePerClassHierarchyEntity(System.Type type)
@@ -355,6 +370,7 @@
public bool IsTablePerClass(System.Type type)
{
+ ExecuteDelayedTypeRegistration(type);
return IsMappedFor(tablePerClassEntities, type);
}
@@ -483,5 +499,19 @@
}
return isExplicitMapped || isDerived;
}
+
+ private void EnlistTypeRegistration(System.Type type, Action<System.Type> registration)
+ {
+ delayedTypeRegistration.Add(type, registration);
+ }
+
+ private void ExecuteDelayedTypeRegistration(System.Type type)
+ {
+ Action<System.Type> registration;
+ if(delayedTypeRegistration.TryGetValue(type, out registration))
+ {
+ registration(type);
+ }
+ }
}
}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/JoinedSubclassSequenceRegistrationTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/JoinedSubclassSequenceRegistrationTests.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/JoinedSubclassSequenceRegistrationTests.cs 2011-04-02 20:32:31 UTC (rev 5580)
@@ -0,0 +1,37 @@
+using NHibernate.Mapping.ByCode;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.MappingByCode.ExplicitlyDeclaredModelTests
+{
+ public class JoinedSubclassSequenceRegistrationTests
+ {
+ private class MyClass
+ {
+
+ }
+ private class Inherited1 : MyClass
+ {
+
+ }
+
+ [Test]
+ public void WhenRegisterJoinedSubclassBeforeRootThenIsRegistered()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsTablePerClassEntity(typeof(Inherited1));
+
+ inspector.AddAsRootEntity(typeof(MyClass));
+ inspector.IsTablePerClass(typeof(Inherited1)).Should().Be.True();
+ }
+
+ [Test]
+ public void WhenRegisterJoinedSubclassWithNoRootThenThrows()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsTablePerClassEntity(typeof(Inherited1));
+
+ inspector.Executing(x => x.IsTablePerClass(typeof(Inherited1))).Throws<MappingException>();
+ }
+ }
+}
\ 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-02 19:38:43 UTC (rev 5579)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-02 20:32:31 UTC (rev 5580)
@@ -510,6 +510,7 @@
<Compile Include="MappingByCode\ColumnsNamingConvetions.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\ComponentMappingRegistrationTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\JoinedSubclassMappingStrategyTests.cs" />
+ <Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\JoinedSubclassSequenceRegistrationTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\RootClassMappingStrategyTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\SubclassJoinMappingStrategyTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\SubclassMappingStrategyTests.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2011-04-02 19:38:50
|
Revision: 5579
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5579&view=rev
Author: fabiomaulo
Date: 2011-04-02 19:38:43 +0000 (Sat, 02 Apr 2011)
Log Message:
-----------
components registration
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/ComponentMappingRegistrationTests.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-02 19:14:08 UTC (rev 5578)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-02 19:38:43 UTC (rev 5579)
@@ -138,16 +138,29 @@
public void AddAsRootEntity(System.Type type)
{
+ if (IsComponent(type))
+ {
+ throw new MappingException(string.Format("Abiguous mapping of {0}. It was registered as entity and as component", type.FullName));
+ }
rootEntities.Add(type);
}
public void AddAsComponent(System.Type type)
{
+ var rootEntity = GetRootEntityOrNull(type);
+ if (rootEntity != null)
+ {
+ throw new MappingException(string.Format("Abiguous mapping of {0}. It was registered as entity and as component", type.FullName));
+ }
components.Add(type);
}
public void AddAsTablePerClassEntity(System.Type type)
{
+ if (IsComponent(type))
+ {
+ throw new MappingException(string.Format("Abiguous mapping of {0}. It was registered as entity and as component", type.FullName));
+ }
var rootEntity = GetRootEntityOrNull(type);
if(rootEntity != null)
{
@@ -165,6 +178,10 @@
public void AddAsTablePerClassHierarchyEntity(System.Type type)
{
+ if (IsComponent(type))
+ {
+ throw new MappingException(string.Format("Abiguous mapping of {0}. It was registered as entity and as component", type.FullName));
+ }
var rootEntity = GetRootEntityOrNull(type);
if (rootEntity != null)
{
@@ -182,6 +199,10 @@
public void AddAsTablePerClassHierarchyJoinEntity(System.Type type)
{
+ if (IsComponent(type))
+ {
+ throw new MappingException(string.Format("Abiguous mapping of {0}. It was registered as entity and as component", type.FullName));
+ }
var rootEntity = GetRootEntityOrNull(type);
if (rootEntity != null)
{
@@ -200,6 +221,10 @@
public void AddAsTablePerConcreteClassEntity(System.Type type)
{
+ if (IsComponent(type))
+ {
+ throw new MappingException(string.Format("Abiguous mapping of {0}. It was registered as entity and as component", type.FullName));
+ }
var rootEntity = GetRootEntityOrNull(type);
if (rootEntity != null)
{
Added: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/ComponentMappingRegistrationTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/ComponentMappingRegistrationTests.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/ComponentMappingRegistrationTests.cs 2011-04-02 19:38:43 UTC (rev 5579)
@@ -0,0 +1,77 @@
+using NHibernate.Mapping.ByCode;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.MappingByCode.ExplicitlyDeclaredModelTests
+{
+ public class ComponentMappingRegistrationTests
+ {
+ private class MyComponent
+ {
+
+ }
+
+ [Test]
+ public void WhenRegisteredAsComponentThenIsRegistered()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsComponent(typeof(MyComponent));
+
+ inspector.IsComponent(typeof(MyComponent)).Should().Be.True();
+ }
+
+ [Test]
+ public void WhenRegisteredAsEntityThenCantRegisterAsComponent()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsRootEntity(typeof(MyComponent));
+
+ inspector.Executing(x => x.AddAsComponent(typeof(MyComponent))).Throws<MappingException>();
+ }
+
+ [Test]
+ public void WhenRegisteredAsComponetThenCantRegisterAsRootEntity()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsComponent(typeof(MyComponent));
+
+ inspector.Executing(x => x.AddAsRootEntity(typeof(MyComponent))).Throws<MappingException>();
+ }
+
+ [Test]
+ public void WhenRegisteredAsComponetThenCantRegisterAsJoinedSubclass()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsComponent(typeof(MyComponent));
+
+ inspector.Executing(x => x.AddAsTablePerClassEntity(typeof(MyComponent))).Throws<MappingException>();
+ }
+
+ [Test]
+ public void WhenRegisteredAsComponetThenCantRegisterAsSubclass()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsComponent(typeof(MyComponent));
+
+ inspector.Executing(x => x.AddAsTablePerClassHierarchyEntity(typeof(MyComponent))).Throws<MappingException>();
+ }
+
+ [Test]
+ public void WhenRegisteredAsComponetThenCantRegisterAsSubclassJoin()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsComponent(typeof(MyComponent));
+
+ inspector.Executing(x => x.AddAsTablePerClassHierarchyJoinEntity(typeof(MyComponent))).Throws<MappingException>();
+ }
+
+ [Test]
+ public void WhenRegisteredAsComponetThenCantRegisterAsUnionSubclass()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsComponent(typeof(MyComponent));
+
+ inspector.Executing(x => x.AddAsTablePerConcreteClassEntity(typeof(MyComponent))).Throws<MappingException>();
+ }
+ }
+}
\ 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-02 19:14:08 UTC (rev 5578)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-02 19:38:43 UTC (rev 5579)
@@ -508,6 +508,7 @@
<Compile Include="Logging\LoggerProviderTest.cs" />
<Compile Include="MappingByCode\BasicMappingOfSimpleClass.cs" />
<Compile Include="MappingByCode\ColumnsNamingConvetions.cs" />
+ <Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\ComponentMappingRegistrationTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\JoinedSubclassMappingStrategyTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\RootClassMappingStrategyTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\SubclassJoinMappingStrategyTests.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|