ObjectContext的管理在工作流基础4 [英] Managing ObjectContext in Workflow Foundation 4

查看:151
本文介绍了ObjectContext的管理在工作流基础4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正与工作流基础4和实体框架4.1。

I'm working with Workflow Foundation 4 and Entity Framework 4.1.

我建我的工作流程,套ReceiveAndSendReply活动。这对我来说很有意义使用单一的ObjectContext(或的DbContext,现在)每套接收和发送的回复活动。

I am building my workflow with sets of ReceiveAndSendReply activities. It makes sense to me to use a single ObjectContext (or DbContext, now) per set of receive and send reply activities.

我应该如何管理ObjectContext的?是否存在只是为了这个活动,或者我需要手动管理呢?

How should I manage the ObjectContext? Are there activities just for this or do I need to manually manage it?

推荐答案

它最好不要在你的worklfow使用的DbContext或ObjectContect directely。把这些工作流扩展,让那些负载POCO entoties为您服务。请确保您只使用POCO实体在worklfow,他们被标记为可序列化。这样一种说法肯定会导致问题与工作流程的持久性和长期运行的工作流程。而且,即使你并不需要持久性现在是更好地做到这一点对未来发展的正确途径。

Its better not to use a DbContext or an ObjectContect directely in your worklfow. Put these in a workflow extension and let those load POCO entoties for you. Make sure you only use POCO entities in your worklfow and that they are marked as serializable. Doing it another way will certainly cause problems with workflow persistence and long running workflows. And even if you don't need persistence now it is better to do it the right way for any future development.

这篇关于ObjectContext的管理在工作流基础4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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