Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface IUserContext {
- User CurrentUser { get; }
- }
- container.Register<IUserContext>(() => {
- User user = null;
- try {
- user = HttpContext.Current?.Session[USER_CONTEXT] as IUser;
- }
- catch { }
- return new UserContext(user);
- });
- public static Func<User> UserContext { get; set; }
- using (container.BeginLifetimeScope()) {
- .....
- var user = GetUserContext(message);
- UserContextInitializer.UserContext = () => new UserContext(user);
- .....
- }
- container.Register<IUserContext>(() => UserContextInitializer.UserContext);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement