posts - 48, comments - 16, trackbacks - 4

My Links

Archives

Post Categories

Web Dev

MVC Preview 4 Account Controller and StructureMap Registry

I decided to use the MVC Preview 4 Account Controller with my MVC application. The application has been following the StoreFront sample application which is using StructureMaps. The trick in getting the two to work together is the following in configure()

 

ForRequestedType<IFormsAuthentication>()

.TheDefaultIsConcreteType<FormsAuthenticationWrapper>();

 

ForRequestedType<MembershipProvider>()

.TheDefaultIs(Membership.Provider);

 

In this way the web.config values are used for the provider. Without passing Membership.Provider (say by passing a new SQL provider) the configurations will be defaulted.

Print | posted on Saturday, August 23, 2008 6:04 PM | Filed Under [ Web Programming ]

kick it on DotNetKicks.com

Feedback

Gravatar

# re: MVC Preview 4 Account Controller and StructureMap Registry

Thanks for posting this.
10/8/2008 8:54 AM | Joel
Gravatar

# re: MVC Preview 4 Account Controller and StructureMap Registry

For StructureMap 2.5 the last statement would have to be updated to:


ForRequestedType<MembershipProvider>()
.TheDefault.Is.Object(Membership.Provider);
11/13/2008 2:38 AM | Pontus
Gravatar

# re: MVC Preview 4 Account Controller and StructureMap Registry

Thank you for the update, and reminding me to update StructureMap :)
11/15/2008 10:07 AM | Charles

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 4 and 1 and type the answer here:

Powered by: