Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
AccountLogin.cs
1using System;
3using Waher.Events;
6
8{
9 [CollectionName("BrokerAccountLogins")]
10 [TypeName(TypeNameSerialization.None)]
11 [ObsoleteMethod(nameof(ObsoleteProperties))]
12 [Index("UserName")]
13 public class AccountLogin
14 {
15 private string objectId = null;
17 private string remoteEndPoint = string.Empty;
18 private DateTime lastLogin = DateTime.MinValue;
19
20 public AccountLogin()
21 {
22 }
23
24 [ObjectId]
25 public string ObjectId
26 {
27 get => this.objectId;
28 set => this.objectId = value;
29 }
30
31 public CaseInsensitiveString UserName
32 {
33 get => this.userName;
34 set => this.userName = value;
35 }
36
37 [DefaultValueStringEmpty]
38 public string RemoteEndPoint
39 {
40 get => this.remoteEndPoint;
41 set => this.remoteEndPoint = value;
42 }
43
44 [DefaultValueDateTimeMinValue]
45 public DateTime LastLogin
46 {
47 get => this.lastLogin;
48 set => this.lastLogin = value;
49 }
50
55 public async void ObsoleteProperties(Dictionary<string, object> Properties)
56 {
57 try
58 {
59 bool Updated = false;
60
61 if (Properties.TryGetValue("RemoteEndpoint", out object Obj) &&
62 Obj is string s)
63 {
64 this.remoteEndPoint = s;
65 Updated = true;
66 }
67
68 if (Updated)
69 await Database.Update(this);
70 }
71 catch (Exception ex)
72 {
73 Log.Exception(ex);
74 }
75 }
76 }
77}
Static class managing the application event log. Applications and services log events on this static ...
Definition: Log.cs:14
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
Definition: Log.cs:1657
Represents a case-insensitive string.
static readonly CaseInsensitiveString Empty
Empty case-insensitive string
Static interface for database persistence. In order to work, a database provider has to be assigned t...
Definition: Database.cs:21
static async Task Update(object Object)
Updates an object in the database.
Definition: Database.cs:1211
async void ObsoleteProperties(Dictionary< string, object > Properties)
Method called when loading the object and properties were found that are no longer recognized.
Definition: AccountLogin.cs:55
TypeNameSerialization
How the type name should be serialized.