ASP.NET ProfileBase。与现有用户名一起提供时创建行为
如果提供的用户名已经存在,ProfileBase.Create是否返回与现有用户关联的ProfileBase(如果用户名不存在,则创建新用户并返回新用户)ASP.NET ProfileBase。与现有用户名一起提供时创建行为,.net,asp.net,asp.net-profiles,.net,Asp.net,Asp.net Profiles,如果提供的用户名已经存在,ProfileBase.Create是否返回与现有用户关联的ProfileBase(如果用户名不存在,则创建新用户并返回新用户) 对于这个微不足道的问题,我深表歉意,但MSDN文档确实没有什么帮助。以下是ProfileBase.Create()的代码: 看起来它总是返回ProfileBase的新实例。以下是ProfileBase.Create()的代码: 看起来它总是返回ProfileBase的一个新实例。正如我所想,Create方法实际上检索概要文件。谁设计了这些AP
对于这个微不足道的问题,我深表歉意,但MSDN文档确实没有什么帮助。以下是
ProfileBase.Create()的代码:
看起来它总是返回ProfileBase的新实例。以下是ProfileBase.Create()的代码:
看起来它总是返回ProfileBase的一个新实例。正如我所想,Create方法实际上检索概要文件。谁设计了这些API
另请参见。正如我所想,Create方法实际上检索概要文件。谁设计了这些API
另请参见。谢谢-这非常有用。您通过哪些步骤获得此代码?谢谢-这非常有用。您通过哪些步骤获得此代码?我完全同意,虽然成员资格和角色提供程序很棒,但配置文件部分的设计很差。我完全同意,虽然成员资格和角色提供程序很棒,但配置文件部分的设计很差。
public static ProfileBase Create(string username, bool isAuthenticated)
{
if (!ProfileManager.Enabled)
{
throw new ProviderException(SR.GetString("Profile_not_enabled"));
}
InitializeStatic();
if (s_SingletonInstance != null)
{
return s_SingletonInstance;
}
if (s_Properties.Count == 0)
{
lock (s_InitializeLock)
{
if (s_SingletonInstance == null)
{
s_SingletonInstance = new DefaultProfile();
}
return s_SingletonInstance;
}
}
HttpRuntime.CheckAspNetHostingPermission(AspNetHostingPermissionLevel.Low, "Feature_not_supported_at_this_level");
return CreateMyInstance(username, isAuthenticated);
}
private static ProfileBase CreateMyInstance(string username, bool isAuthenticated)
{
Type profileType;
if (HostingEnvironment.IsHosted)
{
profileType = BuildManager.GetProfileType();
}
else
{
profileType = InheritsFromType;
}
ProfileBase base2 = (ProfileBase) Activator.CreateInstance(profileType);
base2.Initialize(username, isAuthenticated);
return base2;
}