Message from discussion
BsonClassMap support for DLR
Received: by 10.14.186.9 with SMTP id v9mr1598153eem.5.1332000590274;
Sat, 17 Mar 2012 09:09:50 -0700 (PDT)
X-BeenThere: nosql-databases@googlegroups.com
Received: by 10.14.127.5 with SMTP id c5ls1701525eei.7.gmail; Sat, 17 Mar 2012
09:09:49 -0700 (PDT)
Received: by 10.14.95.199 with SMTP id p47mr28426eef.3.1332000589842;
Sat, 17 Mar 2012 09:09:49 -0700 (PDT)
Received: by 10.14.95.199 with SMTP id p47mr28424eef.3.1332000589781;
Sat, 17 Mar 2012 09:09:49 -0700 (PDT)
Return-Path: <the.mindstorm.mailinglist+caf_=nosql-databases=googlegroups....@gmail.com>
Received: from mail-ee0-f47.google.com (mail-ee0-f47.google.com [74.125.83.47])
by gmr-mx.google.com with ESMTPS id f5si6072919eeo.2.2012.03.17.09.09.49
(version=TLSv1/SSLv3 cipher=OTHER);
Sat, 17 Mar 2012 09:09:49 -0700 (PDT)
Received-SPF: pass (google.com: domain of the.mindstorm.mailinglist+caf_=nosql-databases=googlegroups....@gmail.com designates 74.125.83.47 as permitted sender) client-ip=74.125.83.47;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of the.mindstorm.mailinglist+caf_=nosql-databases=googlegroups....@gmail.com designates 74.125.83.47 as permitted sender) smtp.mail=the.mindstorm.mailinglist+caf_=nosql-databases=googlegroups....@gmail.com; dkim=pass header.i=@googlegroups.com
Received: by mail-ee0-f47.google.com with SMTP id c1so2255706eek.6
for <nosql-databases@googlegroups.com>; Sat, 17 Mar 2012 09:09:49 -0700 (PDT)
Received: by 10.213.105.147 with SMTP id t19mr393138ebo.170.1332000589655;
Sat, 17 Mar 2012 09:09:49 -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 f13csp12965ebd;
Sat, 17 Mar 2012 09:09:48 -0700 (PDT)
Return-Path: <mongodb-user+bncCMPakILqGRDD7pL7BBoEl7mVsg@googlegroups.com>
Received-SPF: pass (google.com: domain of mongodb-user+bncCMPakILqGRDD7pL7BBoEl7mVsg@googlegroups.com designates 10.236.182.4 as permitted sender) client-ip=10.236.182.4;
Received: from mr.google.com ([10.236.182.4])
by 10.236.182.4 with SMTP id n4mr4423367yhm.6.1332000588169 (num_hops = 1);
Sat, 17 Mar 2012 09:09:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=googlegroups.com; s=beta;
h=x-beenthere:date:from:to:message-id:in-reply-to:references:subject
:mime-version: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=Ql8jhBfuIp/Ix97/csgrL5qmn0vg8aQ4seubZmHaiJE=;
b=5JpVDttjvETOTKK4uyB+uBLV8ZdSb5Q3KY0MbZp5OzBDZhVG8tbQ9uAlokYWhe5e0D
LL7DOy7WhV92lXZs2Fij6Mq1rnJBD3a6OQkPfd9NqUXnW3JBHAxEwJ7ETg9lGky824cM
GqkAZlpopXm2NdP1pOuz6MufglrJWyvxIeDpo=
Received: by 10.236.182.4 with SMTP id n4mr1196843yhm.6.1332000579967;
Sat, 17 Mar 2012 09:09:39 -0700 (PDT)
X-BeenThere: mongodb-user@googlegroups.com
Received: by 10.236.91.5 with SMTP id g5ls9851774yhf.7.gmail; Sat, 17 Mar 2012
09:09:39 -0700 (PDT)
Received: by 10.236.184.134 with SMTP id s6mr1167054yhm.17.1332000579361;
Sat, 17 Mar 2012 09:09:39 -0700 (PDT)
Date: Sat, 17 Mar 2012 09:09:38 -0700 (PDT)
From: DaveC <dacur...@gmail.com>
To: mongodb-user@googlegroups.com
Message-ID: <20754839.434.1332000578497.JavaMail.geo-discussion-forums@ynlp3>
In-Reply-To: <CAJCJWG0nqy0B76+yeMKqNYxZw=5Fk_EdEA5CCdSee+4-wZL...@mail.gmail.com>
References: <24713259.1093.1331589705946.JavaMail.geo-discussion-forums@vbtf26>
<CAJCJWG0nqy0B76+yeMKqNYxZw=5Fk_EdEA5CCdSee+4-wZL...@mail.gmail.com>
Subject: Re: [mongodb-user] BsonClassMap support for DLR
MIME-Version: 1.0
X-Original-Sender: dacur...@gmail.com
X-Original-Authentication-Results: ls.google.com; spf=pass (google.com: domain of
dacur...@gmail.com designates internal as permitted sender)
smtp.mail=dacur...@gmail.com; dkim=pass
header...@gmail.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="----=_Part_433_1324885.1332000578495"
------=_Part_433_1324885.1332000578495
Content-Type: text/plain; charset=ISO-8859-1
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.
>> 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 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.
------=_Part_433_1324885.1332000578495
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
I wouldn't want to require a minimum of .NET 4, but a way to hook into my D=
LR property backing collection would be great. Something like:<div><br></di=
v><div>BsonClassMap.RegisterClassMap<T>(cm=3D>cm.GetExtraPropertie=
s(someMethod))</div><div><br></div><div>where someMethod() will be called w=
hen serializing in order to retrieve any extra properties that aren't in th=
e object.</div><div><br></div><div>And for extra properties in the BSON doc=
ument that don't have a class map, instead of having to put a BsonDocument =
with the BsonExtraElements attribute, have another method for those:</div><=
div><br></div><div>BsonClassMap.RegisterClassMap<T>(cm=3D>cm.SetEx=
traProperties(someMethod))</div><div><br></div><div>where someMethod(BsonVa=
lue) is called, and we can do the work of converting to the appropriate typ=
e. A BsonExtraElements member sort of works for this, but that means =
you need to put a BsonDocument into your class, which means anything that u=
ses your class will need a reference to MongoDB BSON code.</div><div><br></=
div><div>Would that be possible in the C# driver? Is this the right w=
ay to request this type of feature?</div><div><br>On Thursday, March 15, 20=
12 1:30:18 PM UTC-4, Robert Stam wrote:<blockquote class=3D"gmail_quote" st=
yle=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-lef=
t: 1ex;">The current version of the C# driver only requires .NET Framework =
3.5.<div><br></div><div>We have not yet determined at what point we will ra=
ise the minimum requirement to .NET Framework 4, so .NET Framework 4 only f=
eatures are on hold until then.</div>
<div><br><div class=3D"gmail_quote">On Mon, Mar 12, 2012 at 6:01 PM, DaveC&=
nbsp;wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex=
;border-left:1px #ccc solid;padding-left:1ex">
I've got several classes that implement the DLR's System.Dynamic.<wbr>IDyna=
micMetaObject interface in order to allow additional fields added to C# typ=
es at runtime. To serialize these dynamically added fields to the BSON docu=
ment, 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 t=
hat 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 p=
roperty names. Is there anything on BsonClassMap that could get additional =
class members by calling my own custom logic (which would get items from th=
is hashed dictionary)? BsonClassMap.<wbr>SetExtraElementsMember seems like =
the right idea, but doesn't quite do it since it's just looking for a compi=
le time class member. If not, are there any plans 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 "=
mongodb-user" 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/<wbr>msg/mongodb-user/-/<wbr>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@<wbr>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/<wbr>=
group/mongodb-user?hl=3Den</a>.<br>
</font></span></blockquote></div><br></div>
</blockquote></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups "=
mongodb-user" group.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/d/msg/mongodb-user/-/oz3oV20qD0wJ">https://groups.google.com/d/msg/mongo=
db-user/-/oz3oV20qD0wJ</a>.<br />=20
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 />
------=_Part_433_1324885.1332000578495--