我們也有這個問題。這是我們如何解決它的。
因此,這是在IContext接口:
T UpdateGraph<T>(T entity, Expression<Func<IUpdateConfiguration<T>, object>> mapping = null) where T : class, new();
DbEntityEntry<TEntity> Entry<TEntity>(TEntity entity) where TEntity : class;
DbEntityEntry Entry(object entity);
DbContextConfiguration Configuration { get; }
這是基本上下文:
public virtual T UpdateGraph<T>(T entity, Expression<Func<IUpdateConfiguration<T>, object>> mapping = null) where T : class, new()
{
return null;
}
和
private ObjectContext ObjectContext
{
get { return (this as IObjectContextAdapter).ObjectContext; }
}
而且這是在實際的具體語境:
public override T UpdateGraph<T>(T entity, Expression<Func<IUpdateConfiguration<T>, object>> mapping = null) // where T : class, new()
{
return DbContextExtensions.UpdateGraph<T>(this, entity, mapping);
}
和
private ObjectContext ObjectContext
{
get { return (this as IObjectContextAdapter).ObjectContext; }
}
您應該包括關於內部異常的詳細信息,或者使用GrpahDiff的SORCE代碼,而不是組裝的猜測,其中的誤差來自 – JotaBe
編輯答案與更多的信息關於GraphDif FAND UpdateGraph擴展方法 – vipasane
嘲諷實體框架是一種痛苦。你需要模擬ObjectContext以及DbContext。 GraphDiff使用ObjectContext。我嘗試過,但最終使用nuget Effort而不是https://effort.codeplex.com/ – mortb