Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing AppController.CurrentUser from child controller constructor raises StructureMap.Building.StructureMapBuildException #2

Open
Mimisss opened this issue Jan 8, 2017 · 1 comment

Comments

@Mimisss
Copy link

Mimisss commented Jan 8, 2017

Based on your post:
http://benfoster.io/blog/aspnet-identity-stripped-bare-mvc-part-1

The following raises StructureMap.Building.StructureMapBuildException with inner exception Object reference not set to an instance of an object. Debugging reveals this.User in 'AppController' is null:

public class HomeController : AppController
{
        private IMyService service;

        public HomeController(IMyService service)
        {
            this.service.User = this.CurrentUser;
        }
}

Any idea why?

@faridskyman
Copy link

part-1 actually its ok. altho the blog summarizes alot of part, i got through getting it to work by also referring to
ce11643#diff-3e72cd4f925f1beaebdbac61f9b3dea3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants