public async Task <AppSession> Create(string sessionKey, IAppUser user, DateTimeOffset timeStarted, string requesterKey, string userAgent, string remoteAddress) { var record = new AppSessionRecord { SessionKey = sessionKey, UserID = user.ID.Value, TimeStarted = timeStarted, RequesterKey = requesterKey ?? "", TimeEnded = DateTimeOffset.MaxValue, UserAgent = userAgent ?? "", RemoteAddress = remoteAddress ?? "" }; await factory.DB.Sessions.Create(record); return(factory.Session(record)); }
internal AppSession Session(AppSessionRecord record) => new AppSession(this, record);
internal AppSession(AppFactory factory, AppSessionRecord record) { this.factory = factory; this.record = record ?? new AppSessionRecord(); ID = new EntityID(this.record.ID); }