public PassportScope(IPassport passport, string name, Guid id, PassportScope parent) { _passport = passport; Name = name; Timestamp = new DateTimeOffset(DateTime.UtcNow); Id = id; Parent = parent; }
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); }
protected PassportScope(PassportScope scope) { Name = scope.Name; Timestamp = scope.Timestamp; Id = scope.Id; }