晦涩的编译错误 - “不实现”和“不能override- - 不具有可重写的访问。”

现在我正在写我的第一个MVC应用程序,并正在创建一个新的MembershipProvider,但我遇到了一些只是在这个过程中完全错误的编译错误。 这里是我的代码:

public class ProfileProvider : MembershipProvider { protected NameValueCollection Config = null; protected new String Name = null; protected String _PasswordStrengthRegularExpression = ""; protected int _MinRequiredNonAlphanumericCharacters = 0; protected int _MinRequiredPasswordLength = 0; protected String _PasswordFormat = ""; protected Boolean _RequiresUniqueEmail = false; protected int _PasswordAttemptWindow = 0; protected int _MaxInvalidPasswordAttempts = 0; protected String _ApplicationName = ""; protected Boolean _RequiresQuestionAndAnswer = false; protected Boolean _EnabledPasswordReset = false; protected Boolean _EnablePasswordRetrieval = false; protected override String PasswordStrengthRegularExpression { get { return this._PasswordStrengthRegularExpression; } set { this._PasswordStrengthRegularExpression = value; } } public override int MinRequiredNonAlphanumericCharacters { get { return this._MinRequiredNonAlphanumericCharacters; } set { this._MinRequiredNonAlphanumericCharacters = value; } } public override int MinRequiredPasswordLength { get { return _MinRequiredPasswordLength; } set { this._MinRequiredPasswordLength = value; } } public override String PasswordFormat { get { return this._PasswordFormat; } set { this._PasswordFormat = value; } } public override Boolean RequiresUniqueEmail { get { return _RequiresUniqueEmail; } set { this._RequiresUniqueEmail = value; } } public override int PasswordAttemptWindow { get { return this._PasswordAttemptWindow; } set { this._PasswordAttemptWindow = value; } } public override int MaxInvalidPasswordAttempts { get { return this._MaxInvalidPasswordAttempts; } set { this._MaxInvalidPasswordAttempts = value; } } public override String ApplicationName { get { return this._ApplicationName; } set { this._ApplicationName = value; } } public override Boolean RequiresQuestionAndAnswer { get { return this._RequiresQuestionAndAnswer; } set { this._RequiresQuestionAndAnswer = value; } } public override Boolean EnablePasswordReset { get { return this._EnabledPasswordReset; } set { this._EnabledPasswordReset = value; } } public override Boolean EnablePasswordRetrieval { get { return this._EnablePasswordRetrieval; } set { this._EnablePasswordRetrieval = value; } }

这里是我的编译错误:

Error 7 'EmptyMVC.Controllers.ProfileProvider.RequiresUniqueEmail.set': cannot override because 'System.Web.Security.MembershipProvider.RequiresUniqueEmail' does not have an overridable set accessor C:\Users\DigitalJedi\documents\visual studio 2010\Projects\EmptyMVC\EmptyMVC\Controllers\ProfileController.cs 78 13 EmptyMVC Error 10 'EmptyMVC.Controllers.ProfileProvider.RequiresQuestionAndAnswer.set': cannot override because 'System.Web.Security.MembershipProvider.RequiresQuestionAndAnswer' does not have an overridable set accessor C:\Users\DigitalJedi\documents\visual studio 2010\Projects\EmptyMVC\EmptyMVC\Controllers\ProfileController.cs 122 13 EmptyMVC Error 3 'EmptyMVC.Controllers.ProfileProvider.PasswordStrengthRegularExpression': cannot change access modifiers when overriding 'public' inherited member 'System.Web.Security.MembershipProvider.PasswordStrengthRegularExpression' C:\Users\DigitalJedi\documents\visual studio 2010\Projects\EmptyMVC\EmptyMVC\Controllers\ProfileController.cs 28 35 EmptyMVC Error 6 'EmptyMVC.Controllers.ProfileProvider.PasswordFormat': type must be 'System.Web.Security.MembershipPasswordFormat' to match overridden member 'System.Web.Security.MembershipProvider.PasswordFormat' C:\Users\DigitalJedi\documents\visual studio 2010\Projects\EmptyMVC\EmptyMVC\Controllers\ProfileController.cs 61 32 EmptyMVC Error 8 'EmptyMVC.Controllers.ProfileProvider.PasswordAttemptWindow.set': cannot override because 'System.Web.Security.MembershipProvider.PasswordAttemptWindow' does not have an overridable set accessor C:\Users\DigitalJedi\documents\visual studio 2010\Projects\EmptyMVC\EmptyMVC\Controllers\ProfileController.cs 89 13 EmptyMVC Error 5 'EmptyMVC.Controllers.ProfileProvider.MinRequiredPasswordLength.set': cannot override because 'System.Web.Security.MembershipProvider.MinRequiredPasswordLength' does not have an overridable set accessor C:\Users\DigitalJedi\documents\visual studio 2010\Projects\EmptyMVC\EmptyMVC\Controllers\ProfileController.cs 56 13 EmptyMVC Error 4 'EmptyMVC.Controllers.ProfileProvider.MinRequiredNonAlphanumericCharacters.set': cannot override because 'System.Web.Security.MembershipProvider.MinRequiredNonAlphanumericCharacters' does not have an overridable set accessor C:\Users\DigitalJedi\documents\visual studio 2010\Projects\EmptyMVC\EmptyMVC\Controllers\ProfileController.cs 45 13 EmptyMVC Error 9 'EmptyMVC.Controllers.ProfileProvider.MaxInvalidPasswordAttempts.set': cannot override because 'System.Web.Security.MembershipProvider.MaxInvalidPasswordAttempts' does not have an overridable set accessor C:\Users\DigitalJedi\documents\visual studio 2010\Projects\EmptyMVC\EmptyMVC\Controllers\ProfileController.cs 100 13 EmptyMVC Error 12 'EmptyMVC.Controllers.ProfileProvider.EnablePasswordRetrieval.set': cannot override because 'System.Web.Security.MembershipProvider.EnablePasswordRetrieval' does not have an overridable set accessor C:\Users\DigitalJedi\documents\visual studio 2010\Projects\EmptyMVC\EmptyMVC\Controllers\ProfileController.cs 144 13 EmptyMVC Error 11 'EmptyMVC.Controllers.ProfileProvider.EnablePasswordReset.set': cannot override because 'System.Web.Security.MembershipProvider.EnablePasswordReset' does not have an overridable set accessor C:\Users\DigitalJedi\documents\visual studio 2010\Projects\EmptyMVC\EmptyMVC\Controllers\ProfileController.cs 133 13 EmptyMVC Error 1 'EmptyMVC.Controllers.ProfileProvider' does not implement inherited abstract member 'System.Web.Security.MembershipProvider.PasswordStrengthRegularExpression.get' C:\Users\DigitalJedi\documents\visual studio 2010\Projects\EmptyMVC\EmptyMVC\Controllers\ProfileController.cs 12 18 EmptyMVC Error 2 'EmptyMVC.Controllers.ProfileProvider' does not implement inherited abstract member 'System.Web.Security.MembershipProvider.PasswordFormat.get' C:\Users\DigitalJedi\documents\visual studio 2010\Projects\EmptyMVC\EmptyMVC\Controllers\ProfileController.cs 12 18 EmptyMVC

我已经采取了几个通行证在此,我一直在使用'新'的关键字,而不是覆盖审判,似乎没有任何工作。

--------------解决方案-------------

那你在抽象基类中重写的属性没有一个二传手。

从这个问题的答案,它看起来并不像你可以做你想做的。

分类:C# 时间:2015-03-15 人气:0
本文关键词: 模型视图控制器
分享到:

相关文章

Copyright (C) 55228885.com, All Rights Reserved.

55228885 版权所有 京ICP备15002868号

processed in 0.410 (s). 10 q(s)