1 回答

TA貢獻(xiàn)1946條經(jīng)驗(yàn) 獲得超4個贊
我想我找到了解決問題的方法。內(nèi)部類似乎是由 PageModel 約定初始化的,可以在 IdentityPageModelConvention 源文件中找到:
public void Apply(PageApplicationModel model)
{
var defaultUIAttribute = model.ModelType.GetCustomAttribute<IdentityDefaultUIAttribute>();
if (defaultUIAttribute == null)
{
return;
}
ValidateTemplate(defaultUIAttribute.Template);
var templateInstance = defaultUIAttribute.Template.MakeGenericType(typeof(TUser));
model.ModelType = templateInstance.GetTypeInfo();
}
此方法似乎通過在抽象 LoginModel 類中定義的 IdentityDefaultUI 屬性來確定具有 TUser 通用屬性的內(nèi)部類:
[IdentityDefaultUI(typeof(LoginModel<>))]
public abstract class LoginModel : PageModel
- 1 回答
- 0 關(guān)注
- 156 瀏覽
添加回答
舉報