私はEF6で.Net 4.6で動作するコードを持っていますが、ef.coreでは動作しません。コンパイラは、 '設定' は基本的に、私は文字列名によってオブジェクトを取得しています1つの引数(CS1501)タイプによって設定されたエンティティを取得します
Type type = Type.GetType("ContextName.SomeModel");
if (type == null) return null;
var entity = db.Set(type).Find(id);
を取る方法は
過負荷を報告します。どのように.core(v 2.0)でこれを達成するには?
マイ輸入:
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Linq.Dynamic.Core; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; using Shared.Web.MvcExtensions;
あなたが「動作しません」とはどういう意味ですか?エラーメッセージがありますか?コンパイラは何を言いますか? – CodeNotFound
メソッドSetには1つの引数をとるオーバーロードはありません。 –
'db'変数の作成方法は? – CodeNotFound