Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RavenDB storing property with JsonIgnore attribute

Tags:

json

c#

ravendb

Fairly new to raven. But just reading some of the documention ignorning a property seems pretty straight forward. But for some reason my property that I do not want save is being saved. Not sure why. Thanks for any help or guidance.

This is property is created in a Entity project(part of the solution of the web project)

I have no attributes on class btw

[JsonIgnore]
    public bool AllowedToEdit
     {
         get { return _allowedToEdit; }
         set { _allowedToEdit = value; }
     }

Not sure what else to post, but this property is being saved.

like image 509
user516883 Avatar asked Dec 27 '12 22:12

user516883


1 Answers

If you are using RavenDB 1.0, this should work as-is.

If you are using RavenDB 2.0, you need to be sure to import from Raven.Imports.Newtonsoft.Json instead of Newtonsoft.Json

like image 104
Matt Johnson-Pint Avatar answered Sep 21 '22 15:09

Matt Johnson-Pint