Refactoring a csproj file compiler/build provider

* Removed unused "ServiceLocator" class

* Added "OrchardHostContainerRegistry" class to enable Shim/HostContainer
  registration for DI

* Refactored the BuildProvider for .csproj file to use the new
  OrchardHostContainerRegistry class and enable proper DI for implementations.

--HG--
branch : dev
This commit is contained in:
Renaud Paquay
2010-06-21 16:40:13 -07:00
parent 7e23f3a30b
commit 3725b84b20
22 changed files with 249 additions and 205 deletions

View File

@@ -270,46 +270,4 @@ namespace Orchard.Users.Controllers {
#endregion
}
public interface IMembershipServiceShim {
int MinPasswordLength { get; }
bool ValidateUser(string userName, string password);
MembershipCreateStatus CreateUser(string userName, string password, string email);
bool ChangePassword(string userName, string oldPassword, string newPassword);
}
public class AccountMembershipService : IMembershipServiceShim {
private readonly MembershipProvider _provider;
public AccountMembershipService()
: this(null) { }
public AccountMembershipService(MembershipProvider provider) {
_provider = provider ?? Membership.Provider;
}
#region IMembershipService Members
public int MinPasswordLength {
get { return _provider.MinRequiredPasswordLength; }
}
public bool ValidateUser(string userName, string password) {
return _provider.ValidateUser(userName, password);
}
public MembershipCreateStatus CreateUser(string userName, string password, string email) {
MembershipCreateStatus status;
_provider.CreateUser(userName, password, email, null, null, true, null, out status);
return status;
}
public bool ChangePassword(string userName, string oldPassword, string newPassword) {
var currentUser = _provider.GetUser(userName, true /* userIsOnline */);
return currentUser.ChangePassword(oldPassword, newPassword);
}
#endregion
}
}