How come properties with only a getter are serialized to RavenDB?
330 views
Skip to first unread message
Dos
unread,
Jun 2, 2012, 6:57:21 PM6/2/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ravendb
I have a couple of properties that are calculated based on the values
of other properties. These are getter-only properties. How come
they're being persisted to Raven? I can see the values of these
properties in Raven Studio. This seems strange, since there's no way
Raven could deserialize those values back in to the object?
Kijana Woodard
unread,
Jun 2, 2012, 7:15:05 PM6/2/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ravendb
Well, there's a private set on HashedPassword. The property I'm
talking about literally had no setter, and is calculated from other
values on the object, so even if Raven could somehow magically set the
computed getter-only property, I wouldn't want it to. So what gives??
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rav...@googlegroups.com
They will be persisted, but will not deserialize. If you don't want it serialized put a JsonIgnore attribute on it.
Oren Eini (Ayende Rahien)
unread,
Jun 3, 2012, 3:18:26 AM6/3/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rav...@googlegroups.com
Dos,
It is a useful way to expose calculated properties for indexing / projection.
Dos
unread,
Jun 3, 2012, 3:59:55 PM6/3/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rav...@googlegroups.com
That makes perfect sense! Thanks very much to all of you for your replies. I'll use the [JsonIgnore] attribute for now on those properties I don't want serialized, and keep that in my back pocket for any projections/indexing.
Thanks!
On Sunday, June 3, 2012 2:18:26 AM UTC-5, Oren Eini wrote:
Dos,
It is a useful way to expose calculated properties for indexing / projection.