是IDbCommandInterceptor中的EntityFramework 6线程安全 [英] Is IDbCommandInterceptor in EntityFramework 6 thread safe

查看:433
本文介绍了是IDbCommandInterceptor中的EntityFramework 6线程安全的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

时当用DbInterception add方法注册被认为是线程安全的一个IDbCommandInterceptor实例?我已经实现了符合IDbCommandInterceptor接口的类并且当执行方法之一被调用时相比相应的执行方法被调用的停止时间很跟踪一个命令的开始时间。我存储在一个私人伊娃列表此信息,并需要知道我在做什么是安全的。

Is a IDbCommandInterceptor instance considered thread-safe when registered with the DbInterception add method? I have implemented a class that conforms to the IDbCommandInterceptor interface and am tracking the start time of a command when one of the executing methods are invoked compared to the stop time when the corresponding executed method is called. I'm storing this information in a private ivar list and need to know if what I'm doing is safe.

推荐答案

事实证明了IDbCommandInterceptor不是线程安全的,因为它是唯一实例化一次。

As it turns out the IDbCommandInterceptor is not thread safe as it is only instantiated once.

这篇关于是IDbCommandInterceptor中的EntityFramework 6线程安全的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆