I have a document model to store in RavenDB but I don’t want to store a calculated property. How do I tell RavenDB to ignore this property?
In the below example I don’t want to store Duration.
public class Build
{
public string Id { get; set; }
public string Name { get; set; }
public DateTime StartedAt { get; set; }
public DateTime FinishedAt { get; set; }
public TimeSpan Duration { get { return StartedAt.Subtract(FinishedAt); }}
}
Just decorate the
Durationproperty with[JsonIgnore]like this:See more here: http://ravendb.net/docs/client-api/advanced/custom-serialization