Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion BsonClassMap support for DLR

Received: by 10.14.100.207 with SMTP id z55mr1610728eef.4.1332001847958;
        Sat, 17 Mar 2012 09:30:47 -0700 (PDT)
X-BeenThere: nosql-databases@googlegroups.com
Received: by 10.213.102.145 with SMTP id g17ls1708357ebo.2.gmail; Sat, 17 Mar
 2012 09:30:47 -0700 (PDT)
Received: by 10.14.120.132 with SMTP id p4mr1613327eeh.0.1332001847649;
        Sat, 17 Mar 2012 09:30:47 -0700 (PDT)
Received: by 10.14.120.132 with SMTP id p4mr1613325eeh.0.1332001847619;
        Sat, 17 Mar 2012 09:30:47 -0700 (PDT)
Return-Path: <the.mindstorm.mailinglist+caf_=nosql-databases=googlegroups....@gmail.com>
Received: from mail-ey0-f169.google.com (mail-ey0-f169.google.com [209.85.215.169])
        by gmr-mx.google.com with ESMTPS id s9si6103301eei.3.2012.03.17.09.30.47
        (version=TLSv1/SSLv3 cipher=OTHER);
        Sat, 17 Mar 2012 09:30:47 -0700 (PDT)
Received-SPF: pass (google.com: domain of the.mindstorm.mailinglist+caf_=nosql-databases=googlegroups....@gmail.com designates 209.85.215.169 as permitted sender) client-ip=209.85.215.169;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of the.mindstorm.mailinglist+caf_=nosql-databases=googlegroups....@gmail.com designates 209.85.215.169 as permitted sender) smtp.mail=the.mindstorm.mailinglist+caf_=nosql-databases=googlegroups....@gmail.com; dkim=pass header.i=@googlegroups.com
Received: by eaal1 with SMTP id l1so3135578eaa.14
        for <nosql-databases@googlegroups.com>; Sat, 17 Mar 2012 09:30:47 -0700 (PDT)
Received: by 10.213.14.74 with SMTP id f10mr391608eba.274.1332001847449;
        Sat, 17 Mar 2012 09:30:47 -0700 (PDT)
X-Forwarded-To: nosql-databases@googlegroups.com
X-Forwarded-For: the.mindstorm.mailingl...@gmail.com nosql-databases@googlegroups.com
Delivered-To: the.mindstorm.mailingl...@gmail.com
Received: by 10.213.33.13 with SMTP id f13csp13262ebd;
        Sat, 17 Mar 2012 09:30:46 -0700 (PDT)
        d=google.com; s=20120113;
        h=received-spf:dkim-signature:x-beenthere:received-spf:mime-version
         :in-reply-to:references:date:message-id:subject:from:to
         :x-gm-message-state:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-google-group-id:list-post:list-help:list-archive:sender
         :list-subscribe:list-unsubscribe:content-type;
        bh=ngGObuDqPMSEzF7L53TiA0meNafy/3pVAWR/yFw0BQI=;
        b=QCaj1UOk7PmBN8dtpWz1J89ri1I5yZ2dgNwl4zP8vqBLiydYonTVUGyJVXL+a7+Cyt
         Oy1gc0lAplsO/ZDpydhqlxOtUaz821oHT8pKDKF82BDzZW+7e/H5AjozKo2gHKvkUSFF
         J/YxH1JLYbbrmEOq4t2v0cXFX4O6RjNOyo0nKwRgbix2KGSQWF1uhC4lmC6rBLnK9n9z
         8svefKT1bkviufFomd3LEj/4jDN8vZlBWOxlxCZiTQlVUGP8SUV6SMxWE6B3V+mXvwJF
         GClSLLhtiZNnq6LI3Esr2IvofZ2gH16id9YByQksFYJlyidkpE5DjvykgQU5gM7urKUw
         JBEQ==
Return-Path: <mongodb-user+bncCP23-LDyDxCs-JL7BBoEjCrEJw@googlegroups.com>
Received-SPF: pass (google.com: domain of mongodb-user+bncCP23-LDyDxCs-JL7BBoEjCrEJw@googlegroups.com designates 10.216.208.150 as permitted sender) client-ip=10.216.208.150;
Received: from mr.google.com ([10.216.208.150])
        by 10.216.208.150 with SMTP id q22mr1160290weo.26.1332001846338 (num_hops = 1);
        Sat, 17 Mar 2012 09:30:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=googlegroups.com; s=beta;
        h=x-beenthere:received-spf:mime-version:in-reply-to:references:date
         :message-id:subject:from:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-google-group-id:list-post:list-help:list-archive:sender
         :list-subscribe:list-unsubscribe:content-type;
        bh=ngGObuDqPMSEzF7L53TiA0meNafy/3pVAWR/yFw0BQI=;
        b=LuCuhsnG8U9jMxsBqTEetcvIhNmJFe2mdQS+jy6gFVs8OXKfCE8NHZaho+nhGs8Rxg
         tPmAvS4yO2Q9iipwMHaSbjUNAHf4EB/svJiK7/f7JWOuY6bzbbfGsP6NMoks5P8OoRUO
         l3LkILkXBRJgNiVPjwC2zVgoi49h9IObRDewU=
Received: by 10.216.208.150 with SMTP id q22mr266861weo.26.1332001837000;
        Sat, 17 Mar 2012 09:30:37 -0700 (PDT)
X-BeenThere: mongodb-user@googlegroups.com
Received: by 10.180.38.113 with SMTP id f17ls2807122wik.1.gmail; Sat, 17 Mar
 2012 09:30:35 -0700 (PDT)
Received: by 10.180.90.198 with SMTP id by6mr541987wib.4.1332001835405;
        Sat, 17 Mar 2012 09:30:35 -0700 (PDT)
Received: by 10.180.90.198 with SMTP id by6mr541986wib.4.1332001835386;
        Sat, 17 Mar 2012 09:30:35 -0700 (PDT)
Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180])
        by gmr-mx.google.com with ESMTPS id ek10si2878350wid.0.2012.03.17.09.30.35
        (version=TLSv1/SSLv3 cipher=OTHER);
        Sat, 17 Mar 2012 09:30:35 -0700 (PDT)
Received-SPF: pass (google.com: domain of rob...@10gen.com designates 209.85.212.180 as permitted sender) client-ip=209.85.212.180;
Received: by wibhm17 with SMTP id hm17so1914591wib.9
        for <mongodb-user@googlegroups.com>; Sat, 17 Mar 2012 09:30:35 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.216.131.24 with SMTP id l24mr3800474wei.76.1332001835165; Sat,
 17 Mar 2012 09:30:35 -0700 (PDT)
Received: by 10.180.98.166 with HTTP; Sat, 17 Mar 2012 09:30:35 -0700 (PDT)
In-Reply-To: <20754839.434.1332000578497.JavaMail.geo-discussion-forums@ynlp3>
References: <24713259.1093.1331589705946.JavaMail.geo-discussion-forums@vbtf26>
	<CAJCJWG0nqy0B76+yeMKqNYxZw=5Fk_EdEA5CCdSee+4-wZL...@mail.gmail.com>
	<20754839.434.1332000578497.JavaMail.geo-discussion-forums@ynlp3>
Date: Sat, 17 Mar 2012 12:30:35 -0400
Message-ID: <CAJCJWG05cyxM4tVcSuWdKvWc-Li7DN6CwTFaDB7pFiqN3VS...@mail.gmail.com>
Subject: Re: [mongodb-user] BsonClassMap support for DLR
From: Robert Stam <rob...@10gen.com>
To: mongodb-user@googlegroups.com
X-Gm-Message-State: ALoCoQleOyJdlR3gTZ3OBi6HUgchVIWEQAovr0LZBXggwvv6iC3aRFCxhgJvJm9tYW1UIbpoDtM8
X-Original-Sender: rob...@10gen.com
X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com:
 domain of rob...@10gen.com designates 209.85.212.180 as permitted sender) smtp.mail=rob...@10gen.com
Reply-To: mongodb-user@googlegroups.com
Precedence: list
Mailing-list: list mongodb-user@googlegroups.com; contact mongodb-user+owners@googlegroups.com
List-ID: <mongodb-user.googlegroups.com>
List-Post: <http://groups.google.com/group/mongodb-user/post?hl=en_US>, <mailto:mongodb-user@googlegroups.com>
List-Help: <http://groups.google.com/support/?hl=en_US>, <mailto:mongodb-user+help@googlegroups.com>
List-Archive: <http://groups.google.com/group/mongodb-user?hl=en_US>
Sender: mongodb-user@googlegroups.com
List-Subscribe: <http://groups.google.com/group/mongodb-user/subscribe?hl=en_US>,
 <mailto:mongodb-user+subscribe@googlegroups.com>
List-Unsubscribe: <http://groups.google.com/group/mongodb-user/subscribe?hl=en_US>,
 <mailto:googlegroups-manage+1044811755470+unsubscribe@googlegroups.com>
Content-Type: multipart/alternative; boundary=0016e6d7ef5039a68204bb72d8d9

--0016e6d7ef5039a68204bb72d8d9
Content-Type: text/plain; charset=ISO-8859-1

There are no immediate plans to extend how BsonClassMaps work. Perhaps for
a future version.

As far as not wanting to create a dependency on the C# driver in your data
model classes, the feature to store extra elements in a field of your class
has been extended so that the field that holds the extra elements no longer
has to be a BsonDocument. You can now also choose for the extra elements
field to be of type IDictionary<string, object> which doesn't require a
dependency on the C# driver. See:

https://jira.mongodb.org/browse/CSHARP-395

If you wrote your DLR accessor methods to save and retrieve your extra
values from this IDictionary<string, object> that might work for you. It
would require that you use strings as keys and that they be valid when used
as BSON element names.

On Sat, Mar 17, 2012 at 12:09 PM, DaveC <dacur...@gmail.com> wrote:

> I wouldn't want to require a minimum of .NET 4, but a way to hook into my
> DLR property backing collection would be great. Something like:
>
> BsonClassMap.RegisterClassMap<T>(cm=>cm.GetExtraProperties(someMethod))
>
> where someMethod() will be called when serializing in order to retrieve
> any extra properties that aren't in the object.
>
> And for extra properties in the BSON document that don't have a class map,
> instead of having to put a BsonDocument with the BsonExtraElements
> attribute, have another method for those:
>
> BsonClassMap.RegisterClassMap<T>(cm=>cm.SetExtraProperties(someMethod))
>
> where someMethod(BsonValue) is called, and we can do the work of
> converting to the appropriate type.  A BsonExtraElements member sort of
> works for this, but that means you need to put a BsonDocument into your
> class, which means anything that uses your class will need a reference to
> MongoDB BSON code.
>
> Would that be possible in the C# driver?  Is this the right way to request
> this type of feature?
>
> On Thursday, March 15, 2012 1:30:18 PM UTC-4, Robert Stam wrote:
>
>> The current version of the C# driver only requires .NET Framework 3.5.
>>
>> We have not yet determined at what point we will raise the minimum
>> requirement to .NET Framework 4, so .NET Framework 4 only features are on
>> hold until then.
>>
>> On Mon, Mar 12, 2012 at 6:01 PM, DaveC wrote:
>>
>> I've got several classes that implement the DLR's System.Dynamic.**IDynamicMetaObject
>>> interface in order to allow additional fields added to C# types at runtime.
>>> To serialize these dynamically added fields to the BSON document, I'm
>>> forced to use a custom serializer (lots of work to implement). It would be
>>> much simpler if BsonClassMap provided a way to get these fields that are
>>> added at runtime. For example, all my dynamic fields are stored in a
>>> dictionary keyed by hashed names. I can't just serialize the object with
>>> the dictionary because the keys are meaningless hashes rather than useful
>>> property names. Is there anything on BsonClassMap that could get additional
>>> class members by calling my own custom logic (which would get items from
>>> this hashed dictionary)? BsonClassMap.**SetExtraElementsMember seems
>>> like the right idea, but doesn't quite do it since it's just looking for a
>>> compile time class member. If not, are there any plans for supporting DLR
>>> types directly?
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "mongodb-user" group.
>>> To view this discussion on the web visit https://groups.google.com/d/**
>>> msg/mongodb-user/-/**7Hkyz4EfbHQJ<https://groups.google.com/d/msg/mongodb-user/-/7Hkyz4EfbHQJ>
>>> .
>>> To post to this group, send email to mongodb-user@googlegroups.com.
>>> To unsubscribe from this group, send email to mongodb-user+unsubscribe@*
>>> *googlegroups.com <mongodb-user%2Bunsubscribe@googlegroups.com>.
>>> For more options, visit this group at http://groups.google.com/**
>>> group/mongodb-user?hl=en<http://groups.google.com/group/mongodb-user?hl=en>
>>> .
>>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "mongodb-user" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/mongodb-user/-/oz3oV20qD0wJ.
>
> To post to this group, send email to mongodb-user@googlegroups.com.
> To unsubscribe from this group, send email to
> mongodb-user+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/mongodb-user?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongodb-user@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.


--0016e6d7ef5039a68204bb72d8d9
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

There are no immediate plans to extend how BsonClassMaps work. Perhaps for =
a future version.<div><br></div><div>As far as not wanting to create a depe=
ndency on the C# driver in your data model classes, the feature to store ex=
tra elements in a field of your class has been extended so that the field t=
hat holds the extra elements no longer has to be a BsonDocument. You can no=
w also choose for the extra elements field to be of type IDictionary&lt;str=
ing, object&gt; which doesn&#39;t require a dependency on the C# driver. Se=
e:</div>
<div><br></div><div><a href=3D"https://jira.mongodb.org/browse/CSHARP-395">=
https://jira.mongodb.org/browse/CSHARP-395</a>=A0<br></div><div><br></div><=
div>If you wrote your DLR accessor methods to save and retrieve your extra =
values from this IDictionary&lt;string, object&gt; that might work for you.=
 It would require that you use strings as keys and that they be valid when =
used as BSON element names.<br>
<br><div class=3D"gmail_quote">On Sat, Mar 17, 2012 at 12:09 PM, DaveC <spa=
n dir=3D"ltr">&lt;<a href=3D"mailto:dacur...@gmail.com">dacur...@gmail.com<=
/a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:=
0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I wouldn&#39;t want to require a minimum of .NET 4, but a way to hook into =
my DLR property backing collection would be great. Something like:<div><br>=
</div><div>BsonClassMap.RegisterClassMap&lt;T&gt;(cm=3D&gt;cm.GetExtraPrope=
rties(someMethod))</div>
<div><br></div><div>where someMethod() will be called when serializing in o=
rder to retrieve any extra properties that aren&#39;t in the object.</div><=
div><br></div><div>And for extra properties in the BSON document that don&#=
39;t have a class map, instead of having to put a BsonDocument with the Bso=
nExtraElements attribute, have another method for those:</div>
<div><br></div><div>BsonClassMap.RegisterClassMap&lt;T&gt;(cm=3D&gt;cm.SetE=
xtraProperties(someMethod))</div><div><br></div><div>where someMethod(BsonV=
alue) is called, and we can do the work of converting to the appropriate ty=
pe. =A0A BsonExtraElements member sort of works for this, but that means yo=
u need to put a BsonDocument into your class, which means anything that use=
s your class will need a reference to MongoDB BSON code.</div>
<div><br></div><div>Would that be possible in the C# driver? =A0Is this the=
 right way to request this type of feature?</div><div><div class=3D"im"><br=
>On Thursday, March 15, 2012 1:30:18 PM UTC-4, Robert Stam wrote:</div><blo=
ckquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-le=
ft:1px #ccc solid;padding-left:1ex">
<div class=3D"im">The current version of the C# driver only requires .NET F=
ramework 3.5.<div><br></div><div>We have not yet determined at what point w=
e will raise the minimum requirement to .NET Framework 4, so .NET Framework=
 4 only features are on hold until then.</div>

</div><div><br><div class=3D"gmail_quote">On Mon, Mar 12, 2012 at 6:01 PM, =
DaveC=A0wrote:<div class=3D"im"><br><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I&#39;ve got several classes that implement the DLR&#39;s System.Dynamic.<u=
></u>IDynamicMetaObject interface in order to allow additional fields added=
 to C# types at runtime. To serialize these dynamically added fields to the=
 BSON document, I&#39;m forced to use a custom serializer (lots of work to =
implement). It would be much simpler if BsonClassMap provided a way to get =
these fields that are added at runtime. For example, all my dynamic fields =
are stored in a dictionary keyed by hashed names. I can&#39;t just serializ=
e the object with the dictionary because the keys are meaningless hashes ra=
ther than useful property names. Is there anything on BsonClassMap that cou=
ld get additional class members by calling my own custom logic (which would=
 get items from this hashed dictionary)? BsonClassMap.<u></u>SetExtraElemen=
tsMember seems like the right idea, but doesn&#39;t quite do it since it&#3=
9;s just looking for a compile time class member. If not, are there any pla=
ns for supporting DLR types directly?

<span><font color=3D"#888888"><p></p>

-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;mongodb-user&quot; group.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/d/msg/mongodb-user/-/7Hkyz4EfbHQJ" target=3D"_blank">https://groups.goog=
le.com/d/<u></u>msg/mongodb-user/-/<u></u>7Hkyz4EfbHQJ</a>.<br>=20
To post to this group, send email to <a href=3D"mailto:mongodb-user@googleg=
roups.com" target=3D"_blank">mongodb-user@googlegroups.com</a>.<br>
To unsubscribe from this group, send email to <a href=3D"mailto:mongodb-use=
r%2Bunsubscribe@googlegroups.com" target=3D"_blank">mongodb-user+unsubscrib=
e@<u></u>googlegroups.com</a>.<br>

For more options, visit this group at <a href=3D"http://groups.google.com/g=
roup/mongodb-user?hl=3Den" target=3D"_blank">http://groups.google.com/<u></=
u>group/mongodb-user?hl=3Den</a>.<br>


</font></span></blockquote></div></div><br></div>
</blockquote></div><div class=3D"im">

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;mongodb-user&quot; group.<br></div>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/d/msg/mongodb-user/-/oz3oV20qD0wJ" target=3D"_blank">https://groups.goog=
le.com/d/msg/mongodb-user/-/oz3oV20qD0wJ</a>.<div class=3D"HOEnZb"><div cla=
ss=3D"h5">
<br>=20
To post to this group, send email to <a href=3D"mailto:mongodb-user@googleg=
roups.com" target=3D"_blank">mongodb-user@googlegroups.com</a>.<br>
To unsubscribe from this group, send email to <a href=3D"mailto:mongodb-use=
r%2Bunsubscribe@googlegroups.com" target=3D"_blank">mongodb-user+unsubscrib=
e@googlegroups.com</a>.<br>

For more options, visit this group at <a href=3D"http://groups.google.com/g=
roup/mongodb-user?hl=3Den" target=3D"_blank">http://groups.google.com/group=
/mongodb-user?hl=3Den</a>.<br>


</div></div></blockquote></div><br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups "=
mongodb-user" group.<br />
To post to this group, send email to mongodb-user@googlegroups.com.<br />
To unsubscribe from this group, send email to mongodb-user+unsubscribe@goog=
legroups.com.<br />

For more options, visit this group at http://groups.google.com/group/mongod=
b-user?hl=3Den.<br />



--0016e6d7ef5039a68204bb72d8d9--