public AuthIdentityService(string username, DataStoreFactory storeFactory) { this.storeFactory = storeFactory; using (var ctx = storeFactory.Create(username)) { this.currentUser = ctx.Users.IncludePaths("Member").SingleOrDefault(f => f.Username == username); } this.IsUser = this.currentUser != null; this.UserLogin = username; this.UserName = (this.currentUser == null) ? username : (this.currentUser.Member == null) ? this.currentUser.Name : this.currentUser.Member.FullName; this.IsAuthenticated = !string.IsNullOrWhiteSpace(username); Init(); }