Skip to content

Commit 6932f76

Browse files
committed
NH-3722 - Remove IsEmbedded
* Ported from HHH-10073 hibernate/hibernate-orm@47b8ed5
1 parent 06720ff commit 6932f76

32 files changed

+78
-355
lines changed

src/NHibernate/Bytecode/ICollectionTypeFactory.cs

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ public interface ICollectionTypeFactory
1717
/// owner object containing the collection ID, or <see langword="null" /> if it is
1818
/// the primary key.</param>
1919
/// <param name="elementClass">The <see cref="System.Type"/> to use to create the array.</param>
20-
/// <param name="embedded">Is embedded in XML (not supported yet)</param>
2120
/// <returns>
2221
/// An <see cref="ArrayType"/> for the specified role.
2322
/// </returns>
24-
CollectionType Array(string role, string propertyRef, bool embedded, System.Type elementClass);
23+
CollectionType Array(string role, string propertyRef, System.Type elementClass);
2524

2625
/// <summary>
2726
/// Creates a new <see cref="CollectionType"/> for an
@@ -33,11 +32,10 @@ public interface ICollectionTypeFactory
3332
/// The name of the property in the owner object containing the collection ID,
3433
/// or <see langword="null" /> if it is the primary key.
3534
/// </param>
36-
/// <param name="embedded">Is embedded in XML (not supported yet)</param>
3735
/// <returns>
3836
/// A <see cref="GenericBagType{T}"/> for the specified role.
3937
/// </returns>
40-
CollectionType Bag<T>(string role, string propertyRef, bool embedded);
38+
CollectionType Bag<T>(string role, string propertyRef);
4139

4240
/// <summary>
4341
/// Creates a new <see cref="CollectionType"/> for an
@@ -51,11 +49,10 @@ public interface ICollectionTypeFactory
5149
/// owner object containing the collection ID, or <see langword="null" /> if it is
5250
/// the primary key.
5351
/// </param>
54-
/// <param name="embedded">Is embedded in XML (not supported yet)</param>
5552
/// <returns>
5653
/// A <see cref="GenericListType&lt;T&gt;"/> for the specified role.
5754
/// </returns>
58-
CollectionType List<T>(string role, string propertyRef, bool embedded);
55+
CollectionType List<T>(string role, string propertyRef);
5956

6057
/// <summary>
6158
/// Creates a new <see cref="CollectionType"/> for an
@@ -68,11 +65,10 @@ public interface ICollectionTypeFactory
6865
/// owner object containing the collection ID, or <see langword="null" /> if it is
6966
/// the primary key.
7067
/// </param>
71-
/// <param name="embedded">Is embedded in XML (not supported yet)</param>
7268
/// <returns>
7369
/// A <see cref="GenericIdentifierBagType{T}"/> for the specified role.
7470
/// </returns>
75-
CollectionType IdBag<T>(string role, string propertyRef, bool embedded);
71+
CollectionType IdBag<T>(string role, string propertyRef);
7672

7773
/// <summary>
7874
/// Creates a new <see cref="CollectionType"/> for an <see cref="ISet{T}" />.
@@ -82,9 +78,8 @@ public interface ICollectionTypeFactory
8278
/// <param name="propertyRef">The name of the property in the
8379
/// owner object containing the collection ID, or <see langword="null" /> if it is
8480
/// the primary key.</param>
85-
/// <param name="embedded">Is embedded in XML (not supported yet)</param>
8681
/// <returns>A <see cref="GenericSetType{T}" /> for the specified role.</returns>
87-
CollectionType Set<T>(string role, string propertyRef, bool embedded);
82+
CollectionType Set<T>(string role, string propertyRef);
8883

8984
/// <summary>
9085
/// Creates a new <see cref="CollectionType"/> for a sorted <see cref="ISet{T}" />.
@@ -94,10 +89,9 @@ public interface ICollectionTypeFactory
9489
/// <param name="propertyRef">The name of the property in the
9590
/// owner object containing the collection ID, or <see langword="null" /> if it is
9691
/// the primary key.</param>
97-
/// <param name="embedded">Is embedded in XML (not supported yet)</param>
9892
/// <param name="comparer">The <see cref="System.Collections.Generic.IComparer{T}" /> to use for the set.</param>
9993
/// <returns>A <see cref="GenericSetType{T}" /> for the specified role.</returns>
100-
CollectionType SortedSet<T>(string role, string propertyRef, bool embedded, IComparer<T> comparer);
94+
CollectionType SortedSet<T>(string role, string propertyRef, IComparer<T> comparer);
10195

10296
/// <summary>
10397
/// Creates a new <see cref="CollectionType"/> for an ordered <see cref="ISet{T}" />.
@@ -108,9 +102,8 @@ public interface ICollectionTypeFactory
108102
/// The name of the property in the owner object containing the collection ID,
109103
/// or <see langword="null" /> if it is the primary key.
110104
/// </param>
111-
/// <param name="embedded">Is embedded in XML (not supported yet)</param>
112105
/// <returns>A <see cref="GenericSetType{T}" /> for the specified role.</returns>
113-
CollectionType OrderedSet<T>(string role, string propertyRef, bool embedded);
106+
CollectionType OrderedSet<T>(string role, string propertyRef);
114107

115108
/// <summary>
116109
/// Creates a new <see cref="CollectionType"/> for an
@@ -123,14 +116,13 @@ public interface ICollectionTypeFactory
123116
/// owner object containing the collection ID, or <see langword="null" /> if it is
124117
/// the primary key.
125118
/// </param>
126-
/// <param name="embedded">Is embedded in XML (not supported yet)</param>
127119
/// <returns>
128120
/// A <see cref="GenericMapType{TKey, TValue}"/> for the specified role.
129121
/// </returns>
130-
CollectionType Map<TKey, TValue>(string role, string propertyRef, bool embedded);
122+
CollectionType Map<TKey, TValue>(string role, string propertyRef);
131123

124+
CollectionType SortedDictionary<TKey, TValue>(string role, string propertyRef, IComparer<TKey> comparer);
132125

133-
CollectionType SortedDictionary<TKey, TValue>(string role, string propertyRef, bool embedded, IComparer<TKey> comparer);
134-
CollectionType SortedList<TKey, TValue>(string role, string propertyRef, bool embedded, IComparer<TKey> comparer);
126+
CollectionType SortedList<TKey, TValue>(string role, string propertyRef, IComparer<TKey> comparer);
135127
}
136128
}

src/NHibernate/Mapping/Array.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public System.Type ElementClass
4646

4747
public override CollectionType DefaultCollectionType
4848
{
49-
get { return TypeFactory.Array(Role, ReferencedPropertyName, Embedded, ElementClass); }
49+
get { return TypeFactory.Array(Role, ReferencedPropertyName, ElementClass); }
5050
}
5151

5252
public override bool IsArray

src/NHibernate/Mapping/Collection.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ public abstract class Collection : IFetchable, IValue, IFilterable
4545
private System.Type collectionPersisterClass;
4646
private string referencedPropertyName;
4747
private string typeName;
48-
private bool embedded = true;
4948

5049
private string loaderName;
5150

@@ -210,7 +209,7 @@ public virtual CollectionType CollectionType
210209
}
211210
else
212211
{
213-
return TypeFactory.CustomCollection(typeName, typeParameters, role, referencedPropertyName, Embedded);
212+
return TypeFactory.CustomCollection(typeName, typeParameters, role, referencedPropertyName);
214213
}
215214
}
216215
}
@@ -551,12 +550,6 @@ public bool IsOptimisticLocked
551550
set { optimisticLocked = value; }
552551
}
553552

554-
public bool Embedded
555-
{
556-
get { return embedded; }
557-
set { embedded = value; }
558-
}
559-
560553
public bool ExtraLazy
561554
{
562555
get { return extraLazy; }

src/NHibernate/Mapping/ManyToOne.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public override IType Type
5050
if (type == null)
5151
{
5252
type =
53-
TypeFactory.ManyToOne(ReferencedEntityName, ReferencedPropertyName, IsLazy, UnwrapProxy, Embedded, IsIgnoreNotFound, isLogicalOneToOne);
53+
TypeFactory.ManyToOne(ReferencedEntityName, ReferencedPropertyName, IsLazy, UnwrapProxy, IsIgnoreNotFound, isLogicalOneToOne);
5454
}
5555
return type;
5656
}

src/NHibernate/Mapping/OneToMany.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ public class OneToMany : IValue
1515
private readonly Table referencingTable;
1616
private PersistentClass associatedClass;
1717
private bool ignoreNotFound;
18-
private bool embedded;
1918

2019
public OneToMany(PersistentClass owner)
2120
{
@@ -24,7 +23,7 @@ public OneToMany(PersistentClass owner)
2423

2524
private EntityType EntityType
2625
{
27-
get { return TypeFactory.ManyToOne(ReferencedEntityName, null, false, false, IsEmbedded, IsIgnoreNotFound, false); }
26+
get { return TypeFactory.ManyToOne(ReferencedEntityName, null, false, false, IsIgnoreNotFound, false); }
2827
}
2928

3029
public bool IsIgnoreNotFound
@@ -154,11 +153,5 @@ public bool[] ColumnUpdateability
154153
{
155154
get { throw new InvalidOperationException(); }
156155
}
157-
158-
public bool IsEmbedded
159-
{
160-
get { return embedded; }
161-
set { embedded = value; }
162-
}
163156
}
164157
}

src/NHibernate/Mapping/OneToOne.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public override IType Type
9797
else
9898
{
9999
return
100-
TypeFactory.OneToOne(ReferencedEntityName, foreignKeyType, referencedPropertyName, IsLazy, UnwrapProxy, Embedded,
100+
TypeFactory.OneToOne(ReferencedEntityName, foreignKeyType, referencedPropertyName, IsLazy, UnwrapProxy,
101101
entityName, propertyName);
102102
}
103103
}

src/NHibernate/Mapping/ToOne.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public abstract class ToOne : SimpleValue, IFetchable
1414
private bool lazy = true;
1515
internal string referencedPropertyName;
1616
private string referencedEntityName;
17-
private bool embedded;
1817
private bool unwrapProxy;
1918

2019
/// <summary>
@@ -50,12 +49,6 @@ public bool IsLazy
5049
set { lazy = value; }
5150
}
5251

53-
public bool Embedded
54-
{
55-
get { return embedded; }
56-
set { embedded = value; }
57-
}
58-
5952
/// <summary>
6053
///
6154
/// </summary>

src/NHibernate/Param/DynamicFilterParameterSpecification.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Collections.Generic;
44
using System.Data.Common;
55
using System.Linq;
6-
using System.Xml;
76
using NHibernate.Engine;
87
using NHibernate.SqlCommand;
98
using NHibernate.SqlTypes;
@@ -139,11 +138,6 @@ public bool IsAssociationType
139138
get { return false; }
140139
}
141140

142-
public bool IsXMLElement
143-
{
144-
get { return false; }
145-
}
146-
147141
public bool IsCollectionType
148142
{
149143
get { return false; }
@@ -293,16 +287,6 @@ public IType GetSemiResolvedType(ISessionFactoryImplementor factory)
293287
throw new InvalidOperationException();
294288
}
295289

296-
public void SetToXMLNode(XmlNode node, object value, ISessionFactoryImplementor factory)
297-
{
298-
throw new InvalidOperationException();
299-
}
300-
301-
public object FromXMLNode(XmlNode xml, IMapping factory)
302-
{
303-
throw new InvalidOperationException();
304-
}
305-
306290
public bool[] ToColumnNullness(object value, IMapping mapping)
307291
{
308292
throw new InvalidOperationException();

src/NHibernate/Type/AbstractType.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections;
33
using System.Data.Common;
4-
using System.Xml;
54
using NHibernate.Engine;
65
using NHibernate.SqlTypes;
76
using NHibernate.Util;
@@ -24,11 +23,6 @@ public virtual bool IsAssociationType
2423
get { return false; }
2524
}
2625

27-
public virtual bool IsXMLElement
28-
{
29-
get { return false; }
30-
}
31-
3226
/// <summary>
3327
/// Gets a value indicating if the <see cref="AbstractType"/> is a <see cref="CollectionType"/>.
3428
/// </summary>
@@ -256,21 +250,9 @@ public virtual IType GetSemiResolvedType(ISessionFactoryImplementor factory)
256250
return this;
257251
}
258252

259-
protected internal static void ReplaceNode(XmlNode container, XmlNode value)
260-
{
261-
if (container != value)
262-
{
263-
//not really necessary, I guess...
264-
XmlNode parent = container.ParentNode;
265-
parent.ReplaceChild(value, container);
266-
}
267-
}
268-
269253
public abstract object Replace(object original, object current, ISessionImplementor session, object owner,
270254
IDictionary copiedAlready);
271255

272-
public abstract void SetToXMLNode(XmlNode node, object value, ISessionFactoryImplementor factory);
273-
public abstract object FromXMLNode(XmlNode xml, IMapping factory);
274256
public abstract bool[] ToColumnNullness(object value, IMapping mapping);
275257

276258
/// <include file='IType.cs.xmldoc'

src/NHibernate/Type/AnyType.cs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Collections;
33
using System.Data.Common;
44
using System.Reflection;
5-
using System.Xml;
65
using NHibernate.Engine;
76
using NHibernate.Persister.Entity;
87
using NHibernate.Proxy;
@@ -165,12 +164,6 @@ public override string ToLoggableString(object value, ISessionFactoryImplementor
165164
NHibernateUtil.Entity(NHibernateProxyHelper.GetClassWithoutInitializingProxy(value)).ToLoggableString(value, factory);
166165
}
167166

168-
public override object FromXMLNode(XmlNode xml, IMapping factory)
169-
{
170-
// TODO NH: We can implement this method if the XML is the result of a serialization in XML
171-
throw new NotSupportedException(); //TODO: is this right??
172-
}
173-
174167
[Serializable]
175168
public sealed class ObjectTypeCacheEntry
176169
{
@@ -231,11 +224,6 @@ public bool IsEmbedded
231224
get { return false; }
232225
}
233226

234-
public virtual bool IsEmbeddedInXML
235-
{
236-
get { return false; }
237-
}
238-
239227
private static readonly string[] PROPERTY_NAMES = new string[] { "class", "id" };
240228

241229
public string[] PropertyNames
@@ -396,11 +384,6 @@ private object ResolveAny(string entityName, object id, ISessionImplementor sess
396384
return entityName == null || id == null ? null : session.InternalLoad(entityName, id, false, false);
397385
}
398386

399-
public override void SetToXMLNode(XmlNode xml, object value, ISessionFactoryImplementor factory)
400-
{
401-
throw new NotSupportedException("any types cannot be stringified");
402-
}
403-
404387
public override bool[] ToColumnNullness(object value, IMapping mapping)
405388
{
406389
bool[] result = new bool[GetColumnSpan(mapping)];

src/NHibernate/Type/ArrayType.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@ public class ArrayType : CollectionType
2828
/// owner object containing the collection ID, or <see langword="null" /> if it is
2929
/// the primary key.</param>
3030
/// <param name="elementClass">The <see cref="System.Type"/> of the element contained in the array.</param>
31-
/// <param name="isEmbeddedInXML"></param>
3231
/// <remarks>
3332
/// This creates a bag that is non-generic.
3433
/// </remarks>
35-
public ArrayType(string role, string propertyRef, System.Type elementClass, bool isEmbeddedInXML)
36-
: base(role, propertyRef, isEmbeddedInXML)
34+
public ArrayType(string role, string propertyRef, System.Type elementClass)
35+
: base(role, propertyRef)
3736
{
3837
this.elementClass = elementClass;
3938
arrayClass = Array.CreateInstance(elementClass, 0).GetType();

src/NHibernate/Type/ClassMetaType.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Data.Common;
3-
using System.Xml;
43
using NHibernate.Engine;
54
using NHibernate.SqlTypes;
65

@@ -92,11 +91,6 @@ public override bool IsDirty(object old, object current, bool[] checkable, ISess
9291
return checkable[0] && IsDirty(old, current, session);
9392
}
9493

95-
public override object FromXMLNode(XmlNode xml, IMapping factory)
96-
{
97-
return FromXMLString(xml.Value, factory);
98-
}
99-
10094
public object FromXMLString(string xml, IMapping factory)
10195
{
10296
return xml; //xml is the entity name
@@ -107,11 +101,6 @@ public override object Replace(object original, object current, ISessionImplemen
107101
return original;
108102
}
109103

110-
public override void SetToXMLNode(XmlNode node, object value, ISessionFactoryImplementor factory)
111-
{
112-
node.Value = ToXMLString(value, factory);
113-
}
114-
115104
public override bool[] ToColumnNullness(object value, IMapping mapping)
116105
{
117106
throw new NotSupportedException();

0 commit comments

Comments
 (0)