所以我一直在嘗試設置Effort並且沒有取得多大成功。查看他們的網站和人們的評論看起來非常簡單。
我開始很小,因為我只想測試它是否有效。我得到的錯誤是“序列不包含匹配元素”
我已經向dbcontext添加了這樣的構造函數。
public ApplicationDbContext(DbConnection connection)
: base(connection, true)
{
}
我的設置就像我的測試一樣
var connection = Effort.DbConnectionFactory.CreateTransient();
var context = new ApplicationDbContext(connection );
只是測試它是否有效
context.Set<MyType>().Add(new MyType() {Description = "test"});
MyType的類
public class MyType
{
[Key]
public byte Id { get; set; }
[Required, MaxLength(50)]
public string Description { get; set; }
}
我也嘗試過使用createpersistent。結果相同。
我首先使用的是ef6代碼,mvc 5,.net 462。