How to read the .NET reflector --- for MemberShipProvider
I am implementing the MembershipProvider. So I want to refer to the implementation of sqlMemberShipProvider by Microsoft in .NET reflector and find an interesting thing:
for RequiresQuestionAndAnswer, it retrieve value of _RequiresQuestionAndAnswer directly.
public override bool RequiresQuestionAndAnswer
{
get
{
return this._RequiresQuestionAndAnswer;
}
}
But where the _RequiresQuestionAndAnswer get the value? I think there must be some logic retrieve value from web.config, right? But I can't find. Why? Where is the 开发者_StackOverflow中文版code?
As of Version 6.6:
- Click on the backing
_RequiresQuestionAndAnswer
field in the getter-body. This will take you to the field-declaration and highlight the field on the browser-panel. - Right-Click on the field on the browser-panel and choose Analyze on the context-menu.
- Open up the Assigned By node from the analyzer-tree. Notice that the only method assigning to the field is the public
Initialize
method. - Right-click on the method and choose Go to Member on the context-menu. You will see that this method assigns the field to the value of a call to
SecUtility.GetBooleanValue
with appropriate arguments. - For further information, investigate the implementation of this method by clicking on the method-call.
Look at the Initialize
method. Here's how the field is initialized:
this._RequiresUniqueEmail = SecUtility.GetBooleanValue(config, "requiresUniqueEmail", true);
So yes it is read from the config file.
It is read from the web.config when the membership provider is initialized. It defaults to TRUE
In reflector, choose disassemble the class it self. Then scroll to the bottom and click on Expend Methods.
Now you can search for this member and check who it's used.
精彩评论