すでに存在するユーザー名が指定されている場合、ProfileBase.Createは既存のユーザーに関連付けられているProfileBaseを返しますか(ユーザー名が存在しない場合は、新しいユーザーを作成して新しいユーザーを返します)?
些細な質問でお詫びしますが、MSDNのドキュメントはほとんど役に立ちません。
すでに存在するユーザー名が指定されている場合、ProfileBase.Createは既存のユーザーに関連付けられているProfileBaseを返しますか(ユーザー名が存在しない場合は、新しいユーザーを作成して新しいユーザーを返します)?
些細な質問でお詫びしますが、MSDNのドキュメントはほとんど役に立ちません。
のコードは次のProfileBase.Create()
とおりです。
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;
}
常にProfileBaseの新しいインスタンスを返すように見えます。
私が思ったように、Createメソッドは実際にプロファイルを取得します。これらのAPIを設計するのは誰ですか?!
こちらもご覧ください。