1 回答

TA貢獻1946條經驗 獲得超4個贊
我想我找到了解決問題的方法。內部類似乎是由 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 通用屬性的內部類:
[IdentityDefaultUI(typeof(LoginModel<>))]
public abstract class LoginModel : PageModel
- 1 回答
- 0 關注
- 158 瀏覽
添加回答
舉報