小编Cam*_*uce的帖子

在Azure函数中使用Ninject确定实体框架

我在Azure函数中使用Ninject确定实体框架的一些问题.

我一直在处理随机对象和内部EF错误,例如以下内容,这让我相信DbContext在线程之间共享:

我不确定这是否是错误的,或者我只需要_kernal.Load()每个应用程序域调用一次.任何见解将不胜感激.

An item with the same key has already been added.


System.Data.Entgument.EhgumentAception(ExceptionResource资源)处于System.Data.Entity.Core.Objects.ObjectStateManager.AddStateManagerTypeMetadata(EntitySet entitySet,System.Collections.Generic.Dictionary'2.Insert(TKey key,TValue value,Boolean add)的System.ThrowHelper.ThrowArgumentException(ExceptionResource资源)ObjectTypeMapping映射)
在System.Data.Entity.Core.Objects.ObjectStateManager.GetOrAddStateManagerTypeMetadata(类型的EntityType,EntitySet的EntitySet的)
在System.Data.Entity.Core.Objects.ObjectStateManager.AddEntry(IEntityWrapper wrappedObject,的EntityKey passedKey,EntitySet的EntitySet的,字符串argumentName ,
在System.Data.Entity.Cnt.Comn.Internal.Materialization.Shaper.HandleEntityAppendOnly [TEntity](Func'2 constructEntityDelegate,EntityKey entityKey,EntitySet entitySet
)
处于System.Data.Entity的lambda_method(Closure,Shaper)处,
System.Data.Entity.Core.Common.Internal.Materialization.Shaper'1.RowNestedResultEnumerator.Materi中的.Core.Common.Internal.Materialization.Coordinator'1.ReadNextElement(Shaper shaper)System.Data.Entity.Core.Common.Internal.Materialization.Shaper'1.ObjectQueryNestedEnumerator.TryReadToNextElement中System.Data.Entity.Core.Common.Internal.Materialization.Shaper'1.RowNestedResultEnumerator.MoveNext()的alizeRow() )System.Data.Entity.Core.Inter.Materialization.Shaper'1.ObjectQueryNestedEnumerator.MoveNext()
在System.Linq.Enumerable.FirstOrDefault的System.Data.Entity.Internal.LazyEnumerator'1.MoveNext()处.
在System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.ExecuteSingle的System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.b__1 [TResult](IEnumerable'1序列)的TSource](IEnumerable'1 source)
[
在System.Data.Entity.Internal.Linq的System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute [TResult](表达式表达式)
中的TResult](IEnumerable'1查询,表达式queryRoot).DbQueryProvider.Execute [TResult](表达式表达式)
在System.Linq.Queryable.FirstOrDefault [TSource](IQueryable'1 source,Expression` 1个谓词)
在MyApp.DAO.Implementations.LoanRepository.Get(Int32 loanId)的d:\ a\1\s\MyApp\MyApp.DAO\Implementations\LoanRepository.cs:第50行,
位于MyApp.DAO.Implementations.LoanRepository.获取(String loanGuid)在d:\ a\1\s\MyApp\MyApp\Implementations\LoanRepository.cs:
MyApp.BL.Los.MyManager.d__22.MoveNext()中的第0行

The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.

在System.Data.Entity.Core.Con.Con.Comn.Inter.Mon中的System.Data.Entity.Cor.Common.Inter.Materialization.Shaper'1.Finally()处的System.Data.Entity.Core.Objects.ObjectContext.ReleaseConnection()处. .Materialization.Shaper'1.SimpleEnumerator.Dispose()在D:\ a\1 …

c# entity-framework ninject azure azure-functions

6
推荐指数
1
解决办法
539
查看次数

标签 统计

azure ×1

azure-functions ×1

c# ×1

entity-framework ×1

ninject ×1