0

I have a calculated property in my object that I don't want to save to the DB, is there a way I can specify that?

Like this one as an exemple :

public virtual string FullInfos { get { var html = Contact1Info; html += Contact2Info; return html; } } 

Where Contact1Info and Contact2Info are automatic property already saved...

Thanks!

0

2 Answers 2

3

NoRM provides a series of attributes. In this case you're looking for the [MongoIgnore] attribute.

Should be as simple as

[MongoIgnore] public virtual string FullInfos { get { var html = Contact1Info; html += Contact2Info; return html; } } 
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, do you know if there is any documentation about NoRM? I was looking on the net but did'nt found anything.
NoRM code is here, but I'm sure you know that: github.com/atheken/NoRM The Google Group is here: groups.google.com/group/norm-mongodb NoRM is still a small-scale project, so I strongly suspect that you'll do best on the mailing list and taking a look at some of the code.
0

Convert it to a method, in which case NORM won't map it.

These kinds of "Properties" are better defined as methods anyways.. in the strict OO sense it shouldn't be viewed as a "Property" of the object if it is being calculated.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.