Exclude attribute from class

Feb 16, 2011 at 4:42 PM

Hy,

Is it possible to excluse some attributs of a class that is going to be save in database.

I have some attributs of my class I don't want to be stored in the database.

Is that possible? :)

thx

Coordinator
Feb 16, 2011 at 5:01 PM

Yes. You can decorate a field or property (to suppress it on that class) or a class definition (to suppress it globally) with the SterlingIgnore attribute.

http://www.sterlingdatabase.com/sterling-user-guide/4-databases/c-saving-instances

 

Feb 17, 2011 at 8:41 AM

Cool :D

Thank you very much.

Feb 18, 2011 at 1:00 PM

hum, I have an issue...

[SterlingIgnore]
        private String _arrowString;
        public String ArrowString
        {
            get
            {
                //
            }
            set
            {
                //
            }
        }

Is this how to use SerlingIgnore? Because it says to me that 'SterlingIgnore"  name type or namespace doesn't exists...

And there is no resolve in visual studio.

Feb 18, 2011 at 10:40 PM
Edited Feb 18, 2011 at 10:42 PM

Ensure you have added

using Wintellect.Sterling.Serialization 

 

and you should be fine.

As well, put the [SterlingIgnore] before the property...

ie.

 

        
private String _arrowString;
[SterlingIgnore] 
public String ArrowString { get { // } set { // } }
 

 

using Wintellect.Sterling.Serialization;

Coordinator
Feb 19, 2011 at 12:47 PM

Thanks for helping him out, I appreciate that - beat me to it!