This project has moved and is read-only. For the latest updates, please go here.


Mar 17, 2012 at 1:57 PM

Please include in class "Entity" the atribute [DataContract]

Mar 17, 2012 at 10:45 PM
Edited Mar 17, 2012 at 11:12 PM

I probably will; I do need to think a little about the implications. Would it be possible this (somehow) breaks stuff? I am not sure about this.; I am not very familiar with [DataContract] (I know it's used in WCF context for (de)serializing etc.)

I will, however, hold off the release for a new version for a little while since I'm expecting (and hoping for) a new version of the MongoDB driver which will support the BsonIgnoreExtraElementsAttribute. It will also support LINQ natively and that's what I was planning for a new release to be...uh... released.

Meanwhile, you can ofcourse download the sourcecode and add the attribute manually.

Mar 17, 2012 at 11:17 PM
Edited Mar 17, 2012 at 11:21 PM

After some more thought: Wouldn't that require all derived classes to be serializable? I have to admit I do not know how MongoDB's driver handles this and if it also requires objects to be serializable; if it does it wouldn't harm (I guess) to add this attribute to the Entity class but I have my doubts at the moment.  Is it not better to just implement IEntity and add the [DataContract] to your "own" class?

I may be way off and mumbling incoherent stuff. This request is just some corner of C# that I rarely touch so I am just a little confused.

Jun 1, 2012 at 9:56 AM


Jun 28, 2012 at 11:16 PM

Hi Rob, 

Its been long since I checked MongoRep today just saw this thread and wanted to add my two cents. 

I just compiled MongoRepository on my Mac and Ubuntu machine and everything went fine except the tests. I might move all of our tests to nUnit or something more applicable to both .NET and Mono. 

Regarding the [DataContract] I'm not willing to put that for our Entity because WCF doesn't have any implementation for Mono and also MongoRepository is very much related to Mongo and [DataContract]  is very specific to WCF so my vote is never to include anything that will break all the code on Mono.

Right now MongoDriver for C# and MongoRepository shines on my Mac.