はい、それはビューのモデルが対象である必要があり、可能であり、コントローラは、汎用コントローラーすることができますが、同様にあなたがあなた自身のControllerControllerFactoryを構築する必要があります:私はあなたの答えや他のものを使用
public class MyGenericControllerFactory : DefaultControllerFactory
{
public override IController CreateController(RequestContext reqContext, string controllerName)
{
if(is controlleName generic) //you should define how build controller name when is generic
//it should contain the controller name and the generic type name
{
string contRealName = "";//get the real controller name from controllerName var
string genTypeName = ""; //get the generic type name fomr controllerName var
Type contType = Type.GetType(contRealName);
Type genType = Type.GetType(genTypeName);
contType = contType.MakeGenericType(genType);
return an instance of contType from your IoC container
}
else
{
Type contType = Type.GetType(controllerName);
return an instance of contType from your IoC container
}
}
}
'.cshtml'ファイルを作成するか置き換えると、プロパティが'再帰的ループ 'につながる場合は 'プロパティ'をループします。 'IEnumerable'の実装であれば無視します。 '@Html.DropdownList(propName)'を作成し、AIを使って自動的に生成されたlinqクエリで 'ViewContext'に' ViewBag 'を追加します。' .cshtml'ファイルを生成して読み込むための大きな一般的な 'StringBuilder' –
Lucas