|
From: <fab...@us...> - 2010-07-21 17:51:21
|
Revision: 5032
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5032&view=rev
Author: fabiomaulo
Date: 2010-07-21 17:51:11 +0000 (Wed, 21 Jul 2010)
Log Message:
-----------
Fix NH-2227 (fixed also for others IPropertyAccessor, ISetter, IGetter)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Properties/BackrefPropertyAccessor.cs
trunk/nhibernate/src/NHibernate/Properties/EmbeddedPropertyAccessor.cs
trunk/nhibernate/src/NHibernate/Properties/IndexPropertyAccessor.cs
trunk/nhibernate/src/NHibernate/Properties/MapAccessor.cs
trunk/nhibernate/src/NHibernate/Properties/NoSetterAccessor.cs
trunk/nhibernate/src/NHibernate/Properties/NoopAccessor.cs
trunk/nhibernate/src/NHibernate/Properties/ReadonlyAccessor.cs
trunk/nhibernate/src/NHibernate/Properties/XmlAccessor.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/CfgTest/AccessorsSerializableTest.cs
Modified: trunk/nhibernate/src/NHibernate/Properties/BackrefPropertyAccessor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Properties/BackrefPropertyAccessor.cs 2010-07-21 17:19:49 UTC (rev 5031)
+++ trunk/nhibernate/src/NHibernate/Properties/BackrefPropertyAccessor.cs 2010-07-21 17:51:11 UTC (rev 5032)
@@ -6,6 +6,7 @@
namespace NHibernate.Properties
{
/// <summary> Represents a "back-reference" to the id of a collection owner. </summary>
+ [Serializable]
public class BackrefPropertyAccessor : IPropertyAccessor
{
public static readonly object Unknown = new object();
Modified: trunk/nhibernate/src/NHibernate/Properties/EmbeddedPropertyAccessor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Properties/EmbeddedPropertyAccessor.cs 2010-07-21 17:19:49 UTC (rev 5031)
+++ trunk/nhibernate/src/NHibernate/Properties/EmbeddedPropertyAccessor.cs 2010-07-21 17:51:11 UTC (rev 5032)
@@ -5,6 +5,7 @@
namespace NHibernate.Properties
{
+ [Serializable]
public class EmbeddedPropertyAccessor : IPropertyAccessor
{
#region IPropertyAccessor Members
Modified: trunk/nhibernate/src/NHibernate/Properties/IndexPropertyAccessor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Properties/IndexPropertyAccessor.cs 2010-07-21 17:19:49 UTC (rev 5031)
+++ trunk/nhibernate/src/NHibernate/Properties/IndexPropertyAccessor.cs 2010-07-21 17:51:11 UTC (rev 5032)
@@ -6,6 +6,7 @@
namespace NHibernate.Properties
{
/// <summary> Represents a "back-reference" to the index of a collection. </summary>
+ [Serializable]
public class IndexPropertyAccessor : IPropertyAccessor
{
private readonly string propertyName;
@@ -40,6 +41,7 @@
#endregion
/// <summary> The Setter implementation for index backrefs.</summary>
+ [Serializable]
public sealed class IndexSetter : ISetter
{
#region ISetter Members
@@ -62,6 +64,7 @@
}
/// <summary> The Getter implementation for index backrefs.</summary>
+ [Serializable]
public class IndexGetter : IGetter
{
private readonly IndexPropertyAccessor encloser;
Modified: trunk/nhibernate/src/NHibernate/Properties/MapAccessor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Properties/MapAccessor.cs 2010-07-21 17:19:49 UTC (rev 5031)
+++ trunk/nhibernate/src/NHibernate/Properties/MapAccessor.cs 2010-07-21 17:51:11 UTC (rev 5032)
@@ -4,6 +4,7 @@
using System;
namespace NHibernate.Properties
{
+ [Serializable]
public class MapAccessor : IPropertyAccessor
{
#region IPropertyAccessor Members
Modified: trunk/nhibernate/src/NHibernate/Properties/NoSetterAccessor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Properties/NoSetterAccessor.cs 2010-07-21 17:19:49 UTC (rev 5031)
+++ trunk/nhibernate/src/NHibernate/Properties/NoSetterAccessor.cs 2010-07-21 17:51:11 UTC (rev 5032)
@@ -1,3 +1,5 @@
+using System;
+
namespace NHibernate.Properties
{
/// <summary>
@@ -9,6 +11,7 @@
/// that is the <c><id></c> but tell NHibernate there is no setter for the Property
/// so the value should be written directly to the field.
/// </remarks>
+ [Serializable]
public class NoSetterAccessor : IPropertyAccessor
{
private readonly IFieldNamingStrategy namingStrategy;
Modified: trunk/nhibernate/src/NHibernate/Properties/NoopAccessor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Properties/NoopAccessor.cs 2010-07-21 17:19:49 UTC (rev 5031)
+++ trunk/nhibernate/src/NHibernate/Properties/NoopAccessor.cs 2010-07-21 17:51:11 UTC (rev 5032)
@@ -1,3 +1,4 @@
+using System;
using System.Collections;
using System.Reflection;
using NHibernate.Engine;
@@ -5,6 +6,7 @@
namespace NHibernate.Properties
{
/// <summary> Used to declare properties not represented at the pojo level </summary>
+ [Serializable]
public class NoopAccessor : IPropertyAccessor
{
#region IPropertyAccessor Members
@@ -27,6 +29,7 @@
#endregion
/// <summary> A Getter which will always return null. It should not be called anyway.</summary>
+ [Serializable]
private class NoopGetter : IGetter
{
#region IGetter Members
@@ -60,6 +63,7 @@
}
/// <summary> A Setter which will just do nothing.</summary>
+ [Serializable]
private class NoopSetter : ISetter
{
#region ISetter Members
Modified: trunk/nhibernate/src/NHibernate/Properties/ReadonlyAccessor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Properties/ReadonlyAccessor.cs 2010-07-21 17:19:49 UTC (rev 5031)
+++ trunk/nhibernate/src/NHibernate/Properties/ReadonlyAccessor.cs 2010-07-21 17:51:11 UTC (rev 5032)
@@ -1,3 +1,4 @@
+using System;
using System.Reflection;
namespace NHibernate.Properties
@@ -10,6 +11,7 @@
/// This is useful to allow calculated properties in the domain that will never
/// be recovered from the DB but can be used for querying.
/// </remarks>
+ [Serializable]
public class ReadOnlyAccessor : IPropertyAccessor
{
/// <summary>
@@ -64,6 +66,7 @@
#endregion
+ [Serializable]
private class NoopSetter : ISetter
{
public void Set(object target, object value) {}
Modified: trunk/nhibernate/src/NHibernate/Properties/XmlAccessor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Properties/XmlAccessor.cs 2010-07-21 17:19:49 UTC (rev 5031)
+++ trunk/nhibernate/src/NHibernate/Properties/XmlAccessor.cs 2010-07-21 17:51:11 UTC (rev 5032)
@@ -11,6 +11,7 @@
/// Responsible for accessing property values represented as a XmlElement
/// or XmlAttribute.
/// </summary>
+ [Serializable]
public class XmlAccessor : IPropertyAccessor
{
private readonly ISessionFactoryImplementor factory;
Added: trunk/nhibernate/src/NHibernate.Test/CfgTest/AccessorsSerializableTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/CfgTest/AccessorsSerializableTest.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/CfgTest/AccessorsSerializableTest.cs 2010-07-21 17:51:11 UTC (rev 5032)
@@ -0,0 +1,35 @@
+using System;
+using System.Linq;
+using NHibernate.Properties;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.CfgTest
+{
+ public class AccessorsSerializableTest
+ {
+ private static System.Type[] accessors = typeof (IPropertyAccessor).Assembly.GetTypes().Where(t => t.Namespace == typeof (IPropertyAccessor).Namespace && t.GetInterfaces().Contains(typeof (IPropertyAccessor))).ToArray();
+
+ [Test, TestCaseSource("accessors")]
+ public void AllAccessorsAreMarkedAsSerializable(System.Type concreteAccessor)
+ {
+ concreteAccessor.Should().Have.Attribute<SerializableAttribute>();
+ }
+
+ private static System.Type[] setters = typeof(ISetter).Assembly.GetTypes().Where(t => t.Namespace == typeof(ISetter).Namespace && t.GetInterfaces().Contains(typeof(ISetter))).ToArray();
+
+ [Test, TestCaseSource("setters")]
+ public void AllSettersAreMarkedAsSerializable(System.Type concreteAccessor)
+ {
+ concreteAccessor.Should().Have.Attribute<SerializableAttribute>();
+ }
+
+ private static System.Type[] getters = typeof(IGetter).Assembly.GetTypes().Where(t => t.Namespace == typeof(IGetter).Namespace && t.GetInterfaces().Contains(typeof(IGetter))).ToArray();
+
+ [Test, TestCaseSource("getters")]
+ public void AllGettersAreMarkedAsSerializable(System.Type concreteAccessor)
+ {
+ concreteAccessor.Should().Have.Attribute<SerializableAttribute>();
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-07-21 17:19:49 UTC (rev 5031)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-07-21 17:51:11 UTC (rev 5032)
@@ -108,6 +108,7 @@
<Compile Include="Cascade\Job.cs" />
<Compile Include="Cascade\JobBatch.cs" />
<Compile Include="Cascade\RefreshFixture.cs" />
+ <Compile Include="CfgTest\AccessorsSerializableTest.cs" />
<Compile Include="CfgTest\ConfigurationFixture.cs" />
<Compile Include="CfgTest\ConfigurationSchemaFixture.cs" />
<Compile Include="CfgTest\ConfigurationSerializationTests.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|