Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

began working on reworking the serialization to accomodate inheritanc…

…e needs.
  • Loading branch information...
commit 98e7d4b90d0c7432f3bbea51f9040b1a4a248b4d 1 parent 23b6289
@craiggwilson craiggwilson authored
View
21 source/MongoDB/MongoCollection_1.cs
@@ -7,6 +7,7 @@
using MongoDB.Protocol;
using MongoDB.Results;
using MongoDB.Util;
+using MongoDB.Configuration.Mapping.Model;
namespace MongoDB
{
@@ -602,5 +603,25 @@ private object EnsureUpdateDocument(object document)
return document;
}
+
+ private Document ConvertObjectToDocument(object document)
+ {
+ Document doc = document as Document;
+ if (doc != null)
+ return doc;
+
+ if (document is T)
+ {
+ var classMap = _configuration.MappingStore.GetClassMap(typeof(T));
+ foreach (PersistentMemberMap memberMap in classMap)
+ {
+ doc[memberMap.MemberName] = memberMap.GetValue(document);
+ }
+ }
+ else //anonymous type...
+ {
+
+ }
+ }
}
}
View
2  source/MongoDB/Protocol/QueryMessage.cs
@@ -17,7 +17,7 @@ namespace MongoDB.Protocol
/// [ BSON returnFieldSelector; ] // OPTIONAL : selector indicating the fields to return. See below for details.
/// }
/// </remarks>
- internal class QueryMessage : RequestMessageBase
+ internal class QueryMessage<T> : RequestMessageBase
{
/// <summary>
/// Initializes a new instance of the <see cref="QueryMessage"/> class.
View
2  source/MongoDB/Serialization/ClassMapObjectDescriptorAdapter.cs
@@ -35,7 +35,7 @@ public IEnumerable<string> GetMongoPropertyNames(object instance)
if (_classMap.HasId)
yield return _classMap.IdMap.Alias;
- if (_classMap.IsPolymorphic && _classMap.HasDiscriminator)
+ if (_classMap.IsSubClass)
yield return _classMap.DiscriminatorAlias;
foreach (var memberMap in _classMap.MemberMaps)
Please sign in to comment.
Something went wrong with that request. Please try again.