简体   繁体   English

是否可以将单个Windows Workflow实例配置为使用多个数据库?

[英]Can a single Windows Workflow instance be configured to use multiple databases?

We are using Windows Workflow engine for our .NET 4.5 based ASP.Net application. 我们将Windows Workflow引擎用于基于.NET 4.5的ASP.Net应用程序。 The Windows Workflow application is deployed as an IIS application and is configured for SQL persistence with the connection information specified in the web.config file. Windows Workflow应用程序被部署为IIS应用程序,并使用web.config文件中指定的连接信息进行了SQL持久性配置。 We now want to move this application (along with the Workflow engine) to the cloud. 现在,我们希望将此应用程序(以及工作流引擎)移至云中。

Regarding this cloud migration, we are somewhat confident about the following decisions that we made for our ASP.Net (non Windows Workflow) application: 关于此云迁移,我们对为ASP.Net(非Windows Workflow)应用程序做出的以下决定有些信心:

  • Every customer will have a separate database 每个客户都有一个单独的数据库
  • A single web application will serve multiple customers 单个Web应用程序将为多个客户提供服务

However, we are not very sure on how to migrate the Windows Workflow application to the cloud. 但是,我们不确定如何将Windows Workflow应用程序迁移到云中。 As I understand, we have the following choices: 据我了解,我们有以下选择:

  1. Use a single instance/single database approach. 使用单个实例/单个数据库方法。 In this approach, we will have a single workflow instance and a single workflow database schema serve multiple customers. 通过这种方法,我们将有一个工作流实例和一个工作流数据库架构服务于多个客户。
  2. Use a multiple instance/multiple database approach. 使用多实例/多数据库方法。 In this approach, we will have a separate IIS application along with a separate database schema for each customer. 通过这种方法,我们将为每个客户提供一个单独的IIS应用程序以及一个单独的数据库架构。
  3. Use a single instance/multiple database approach. 使用单实例/多数据库方法。 In this approach, we will have a single workflow instance that will be capable of talking to multiple workflow persistence databases (one per customer). 在这种方法中,我们将拥有一个工作流实例,该实例将能够与多个工作流持久性数据库进行对话(每个客户一个)。

With #1, we are primarily concerned about the performance as the load increases on this single database. 在#1中,我们主要关注性能,因为此单个数据库上的负载增加。 With #2, the concern is web application scalability since it does not seem right to have 1000 web applications for 1000 customers. 对于#2,关注的是Web应用程序的可伸缩性,因为为1000个客户提供1000个Web应用程序似乎并不正确。

That leaves us with option #3, which we think is the right way to go. 这给我们留下了选择#3,我们认为这是正确的选择。 However, we are not sure if this can be done in Windows Workflow or not. 但是,我们不确定是否可以在Windows Workflow中完成此操作。

So the question is, can a single instance of Windows Workflow web application be somehow configured or programmed to talk to multiple SQL persistence databases? 因此,问题是,是否可以以某种方式对Windows Workflow Web应用程序的单个实例进行配置或编程,使其与多个SQL持久性数据库对话? If yes, how can we achieve that? 如果是,我们如何实现?

Thanks! 谢谢!

I never do it myself, but I think that you can do this by implementing your own PersistenceService . 我从来没有自己做过,但是我认为您可以通过实现自己的PersistenceService来实现。 To do this, derive from WorkflowPersistenceService abstract class, which has a methods like SaveWorkflowInstanceState / LoadWorkflowInstanceState . 为此,请从WorkflowPersistenceService抽象类派生,该抽象类具有诸如SaveWorkflowInstanceState / LoadWorkflowInstanceState类的方法。

In this methods you can access WorkflowInstanceId property of workflow. 在这种方法中,您可以访问WorkflowInstanceId属性。 I think that you can use this property to decide where to store this specific workflow instance. 我认为您可以使用此属性来确定将特定工作流实例存储在何处。 To be able to load (restore) workflow from proper database you will need to implement some mapping like this: WorkflowInstanceId : DatabaseId . 为了能够从适当的数据库加载(还原)工作流,您将需要实现一些映射,如下所示: WorkflowInstanceIdDatabaseId

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将数据获取到Windows Workflow实例中 - Getting data into a Windows Workflow instance 我可以将Windows工作流4用于asp.net 3.5应用程序吗? - can i use windows workflow 4 for an asp.net 3.5 app? 我如何调整此代码以使用单个实例而不是创建服务的多个实例? - How can I adapt this code to use a single instance instead of creating multiple instances of a service? Azure WebJobs-单个WebJob和Ef错误中的多个后台任务尝试在配置上下文时使用上下文 - Azure WebJobs - multiple background task in single WebJob and Ef error An attempt was made to use the context while it is being configured Windows 工作流程序集 '' 无法解析 - Windows Workflow Assembly '' can not be resolved 如何使用类的单个对象实例来设置多个成员值? - How to use single object instance for class to set the multiple member value? 需要为多个客户端配置 IIS。 它们都将使用单一的代码库,但使用不同的应用程序池和数据库 - Need to configure IIS for multiple clients. All of them will use a single code base but different application pools and databases 我可以在一个Windows服务中托管多个不同的Windows服务吗? - Can I host multiple different windows services in a single windows service? .net 具有单个 dbcontext 和存储库的多个数据库 - .net multiple databases with single dbcontext and repository 除了Visual Studio,我们可以使用哪些设计师来创建Windows工作流活动? - Other than Visual Studio, which designers can we use to create windows workflow activities?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM