https://github.com/arxone/persistence
Allows to mark properties with a simple attribute and persist them in registry.
https://github.com/arxone/persistence
attribute persistence
Last synced: 4 months ago
JSON representation
Allows to mark properties with a simple attribute and persist them in registry.
- Host: GitHub
- URL: https://github.com/arxone/persistence
- Owner: ArxOne
- License: mit
- Created: 2015-08-01T20:38:58.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-01-22T12:20:09.000Z (about 2 years ago)
- Last Synced: 2025-04-30T15:17:59.801Z (10 months ago)
- Topics: attribute, persistence
- Language: C#
- Homepage:
- Size: 1.43 MB
- Stars: 7
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Persistence
Allows to mark properties with a simple attribute and persist them in registry.
## How it works
Marking a property as persistent:
```csharp
[Persistent("MyPersistedProperty", DefaultValue=1)] // the DefaultValue is optional
public int MyProperty { get; set; }
```
Setting the application registry node:
```csharp
[assembly: RegistryPersistence(@"Software\MyApplication", CurrentUser = true)]
```
## Things to be considered
When two properties from different instances or different types use the same persistence name, their value always stays synchronized (changing a value in an instance changes it everywhere).