简体   繁体   English

如何传递清单 <int> 从一项工作转移到另一项工作?

[英]How do I pass a List<int> from one job to another?

I'd like to create a workflow so that the first job gets some ids from a database and passes them to the subsequent jobs. 我想创建一个工作流,以便第一个作业从数据库中获取一些ID,并将其传递给后续作业。 It's expensive to get the ids so I'd prefer to do it only once in the master job. 获取ID的成本很高,所以我宁愿在主工作中只做一次。 The other jobs should just modify the data in their own way. 其他作业应仅以自己的方式修改数据。

I've found a similar question about how this can be achieved: Quartz.Net and passing data between chaining jobs however I'm not sure whether this is a good idea because the documentation suggests otherwise: 我发现了一个有关如何实现此目标的类似问题: Quartz.Net以及在链接作业之间传递数据,但是我不确定这是否是一个好主意,因为文档中另有说明:

Only store primitive data types (including strings) in JobDataMap to avoid data serialization issues short and long-term. 仅在JobDataMap中存储原始数据类型(包括字符串),以避免短期和长期的数据序列化问题。

Quartz.NET - Best Practices Quartz.NET-最佳实践

What can happen if I put a List<id> on to the JobDataMap ? 如果将List<id>放在JobDataMap上会发生什么? Is there another way for doing this? 还有另一种方法吗?

You are right in stating that List<int> is not primitive. 您正确地指出List<int>不是原始的。 Rather, it is a finite set of primitive values. 相反,它是一组有限的原始值。 However, since string s are considered to be primitive, you can encode your list into a JSON string , so it will be primitive. 但是,由于string被认为是原始的,因此您可以将列表编码为JSON string ,因此它将是原始的。

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

相关问题 如何将对象从一个类传递到另一个类的列表中? - How do I pass an object from one class into a list of another class? 如何将变量从一个 class 传递到另一个? - How do I pass variables from one class to another? 我怎么知道一个列表中的元素是否出现在另一个列表中? - How do I know if elements from one list appear in another? 如何传递清单 <int> 通过FormUrlEncodedContent - How do I pass a List<int> via FormUrlEncodedContent 如何替换一个List的内容 <int> 与另一个人? - How can I replace the contents of one List<int> with those from another? 如何选择列表中的所有元素 <Int32> 进入另一个列表 <Int32> 与LINQ? - How do I select all elements in List<Int32> into another List<Int32> with LINQ? 如何将值从一种形式传递给另一种形式的变量,而该变量实际上改变了变量的默认值? - How do I pass a value from one form to a variable in another that actually changes the default value of the variable? 如何在ASP.NET MVC中将所选项目从一页传递到另一页 - How do I Pass Selected items from one page to another page in asp.net mvc 如何将变量从一个脚本传递到另一个C#Unity 2D? - How do I pass variable from one script to another C# Unity 2D? 如何使用按钮在此C#应用程序中将字符串从一页传递到另一页? - How do i pass strings from one page to another in this C# app using a button?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM