Beispiel #1
0
 public PassportScope(IPassport passport, string name, Guid id, PassportScope parent)
 {
     _passport = passport;
     Name      = name;
     Timestamp = new DateTimeOffset(DateTime.UtcNow);
     Id        = id;
     Parent    = parent;
 }
Beispiel #2
0
        public string Serialize(DateTimeOffset?timestamp = null)
        {
            var result = string.Empty;

            lock (Lock)
            {
                if (!timestamp.HasValue)
                {
                    result = JsonConvert.SerializeObject(this);
                }
                else
                {
                    var scope = new PassportScope(this);
                    scope.History.AddRange(History.Where(x => x.Timestamp <= timestamp).ToList());
                    result = JsonConvert.SerializeObject(scope);
                }
            }
            return(result);
        }
Beispiel #3
0
 protected PassportScope(PassportScope scope)
 {
     Name      = scope.Name;
     Timestamp = scope.Timestamp;
     Id        = scope.Id;
 }