Looking for some docs/tips on how to use Property Injection in an MVC solution using Castle Windsor.
Implementing a custom membership provider and don't have access to constructor injection. Currently using a service locator to pull the component, but curious about how to set the property with Windsor. Current code:
public class CustomRoleProvider : System.Web.Security.RoleProvider
{
public IRepository<User> UserRepository
{
get { return ServiceLocator.Current.GetInstance<IRepository<User>>(); }
}
public override string[] GetRolesForUser(string username)
{
var user = UserRepository
.Where(x => x.Username == username)
.FirstOrDefault();
return (user==null || user.UserUserRoles==null) ? new string[] { } : user.UserUserRoles.Select(x => x.UserRole.Name).ToArray();
}
...
}