Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
PersistedHash.cs
1using System;
3
5{
9 [CollectionName("PersistedHashes")]
10 [TypeName(TypeNameSerialization.None)]
11 [Index("Realm", "Hash")]
12 [Index("ExpiresUtc")]
13 [ArchivingTime(nameof(ArchiveDays))]
14 public class PersistedHash
15 {
20 {
21 }
22
26 [ObjectId]
27 public string ObjectId { get; set; }
28
32 public DateTime ExpiresUtc { get; set; }
33
37 public string Realm { get; set; }
38
42 public byte[] Hash { get; set; }
43
47 [DefaultValueNull]
48 public object AssociatedObject { get; set; }
49
53 public int ArchiveDays
54 {
55 get
56 {
57 if (this.ExpiresUtc.Year >= 9999)
58 return int.MaxValue;
59
60 TimeSpan Span = this.ExpiresUtc - DateTime.UtcNow;
61 double Days = Math.Ceiling(Span.TotalDays);
62
63 if (Days < 0)
64 return 0;
65 else if (Days > int.MaxValue)
66 return int.MaxValue;
67 else
68 return (int)Days;
69 }
70 }
71 }
72}
Contains information about a persisted hash
PersistedHash()
Contains information about a persisted hash
int ArchiveDays
Number of days to archive hash.
DateTime ExpiresUtc
When hash expires and can be removed.
TypeNameSerialization
How the type name should be serialized.