NDatabase NonPersistent attribute


The attribute was created for reasons like:
  • confidential data
  • temporary values not needed to be persistent
  • any other custom requirement

To apply it, you just need to mark field or property by attribute:

public class User
{
    private readonly string _name;

    [NonPersistent]
    private readonly string _password;

    public User(string name, string password)
    {
        _name = name;
        _password = password;
    }

    public string Name
    { 
        get { return _name; }
    }

    public string Password
    { 
        get { return _password; }
    }
}

After storing User class instance, password field will be omitted from this process (will have default value which is in this case null).

Last edited Aug 24, 2012 at 1:57 PM by jacek, version 1

Comments

No comments yet.