TdsParserStateObject - 是否处于释放状态?Entity Framework

7
我正在使用EF,遇到了与有关的问题。
我多次调用此方法:
 public void SaveDataFromERP(string synchronizationType, string xml,int errorsHandlingPercentagePartition)
    {
        var param1 = new SqlParameter("XML", SqlDbType.Xml);
        param1.Value = xml;
        var param2 = new SqlParameter("PartitionedPackagePercentage", SqlDbType.Int);
        param2.Value = errorsHandlingPercentagePartition;
        ((IObjectContextAdapter)this).ObjectContext.ExecuteStoreQuery<dynamic>(
            $"exec [Synchronization].[Import{synchronizationType}] @XML,  @PartitionedPackagePercentage", param1 , param2 );
}

我的代码库包括

SynchronizationRepository : ISynchronizationRepository
{
  private readonly POSDBContext _context = new POSDBContext();
  public void SaveData(string typeName, string xmlFile, int errorsHandlingPartitionPercentage)
    {
        _context.SaveData(typeName, xmlFile,errorsHandlingPartitionPercentage);
    }
 }

当我调用ExecuteStoreQuery时,我可以在内存中看到新的对象TdsParserStateObject
不幸的是,我必须连续多次调用此方法(大量数据)。结果大约有60个TdsParserStateObject,需要大量的内存。
此外,这些对象在一段时间后并不会消失。
是否可能对它们进行处理?

enter image description here


有没有解决这个问题的办法?我们遇到了相同的问题:http://stackoverflow.com/questions/42761087/system-outofmemoryexception-during-nunit-tests-with-localdb - tobypls
这里也一样 - 没有答案? - Shovers_
遇到了同样的问题,唯一的答案并没有帮上太多忙。 - HARINDA VITHANA
1个回答

1

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接