小编Ste*_*hel的帖子

Sql Server Service Broker - 外部激活的控制台应用程序的全面,正在使用的示例

我需要部署使用Sql Server Service Broker外部激活机制(通过Feature Pack中的Service Broker外部激活器)的现实生产应用程序的任何人的一些指导.

目前的心态:

我的规格相当简单(或者至少我是这么认为的),所以我想到了以下基本流程:

  1. 类似订单的实体被插入到状态为"已确认" 的Table_Orders中

  2. SP_BeginOrder被执行并执行以下操作:

    • 开始交易
    • Service_HandleOrderState启动DIALOG 到Service_PreprocessOrder
    • 将对话句柄(从现在开始在PreprocessingHandle中)存储在Orders表 的特定列中
    • 使用PreprocessingHandle发送包含订单ID的Message_PreprocessOrder类型的MESSAGE
    • 结束TRANSACTION

    请注意,我不是在结束谈话,我不想要"永远不要忘记"

  3. Queue_PreprocessOrder上的事件通知激活PreprocessOrder.exe实例(最大并发1),执行以下操作:

    • 开始一个SqlTransaction
    • Queue_PreprocessOrder接收前1个MESSAGE
    • 如果消息类型是Message_PreprocessOrder(格式XML):
      • 使用消息正文中的订单ID 将订单状态设置为Table_Orders中的"预处理"
      • 加载n个数据集合,用于计算n-ary Carthesian产品(通过Linq,AFAIK,这在T-SQL中是不可能的)来确定订单项集合
      • 将订单商品行插入Table_OrderItems
      • 使用PreprocessingHandle发送包含相同订单ID的Message_PreprocessingDone类型的MESSAGE
      • 结束与PreprocessingHandle有关的对话
    • 提交SqlTransaction
    • 退出环境.退出(0)
  4. Queue_HandleOrderState上的内部激活执行SP(最大并发1):
    • 开始交易
    • Queue_InitiatePreprocessOrder接收前1个MESSAGE
    • 如果消息类型是Message_PreprocessingDone:
      • 使用消息正文中的订单ID 将订单状态设置为Table_Orders中的"processing"
      • 从 …

sql-server activation sample service-broker

5
推荐指数
1
解决办法
2521
查看次数

如何使用SymbolSource正确用dotnet cli发布到MyGet(nupkg + snupkg统一发布)

我已经尝试了官方文档中示例命令的所有可以想象的组合,但这些都使用 nuget.exe。

以下nuget 问题指出使用 dotnet cli 发布到官方 nuget.org v3 端点https://api.nuget.org/v3/index.json是有效的。


当发布到 MyGet v3 端点时

dotnet nuget push <package-name>.nupkg --api-key <write-api-key> --source https://www.myget.org/F/<some-site>/api/v3/index.json
Run Code Online (Sandbox Code Playgroud)

文件.nupkg已发布,但.snupkg文件未发布。


.snupkg将文件发布到 MyGet v3 端点时

dotnet nuget push <package-name>.snupkg --api-key <write-api-key> --source https://www.myget.org/F/<some-site>/api/v3/index.json
Run Code Online (Sandbox Code Playgroud)

结果是:

error: Unable to load the service index for source https://www.myget.org/F/<some-site>/api/v3/index.json.
error:   Response status code does not indicate success: 401 (Unauthorized).
Run Code Online (Sandbox Code Playgroud)

还尝试过:

dotnet nuget push <package-name>.snupkg --api-key <write-api-key> --source https://www.myget.org/F/<some-site>/api/v3/index.json --no-service-endpoint
Run Code Online (Sandbox Code Playgroud)

..结果相同

通过 WebUI …

nuget myget dotnet-cli

5
推荐指数
1
解决办法
508
查看次数

生成一个n-ary Cartesian产品示例

我发现,埃里克利珀的帖子在这里都有特定的问题,我有.

问题是我无法理解我应该如何使用2个数量的集合.

var collections = new List<List<MyType>>();
foreach(var item in somequery)
{
    collections.Add(
            new List<MyType> { new MyType { Id = 1} .. n }
        );
}
Run Code Online (Sandbox Code Playgroud)

如何在变量集合上应用笛卡尔积linq查询?

扩展方法是这样的:

static IEnumerable<IEnumerable<T>> CartesianProduct<T>(this IEnumerable<IEnumerable<T>> sequences)
{
    IEnumerable<IEnumerable<T>> emptyProduct = new[] { Enumerable.Empty<T>()};
    return sequences.Aggregate(
        emptyProduct,
        (accumulator, sequence) => 
            from accseq in accumulator 
            from item in sequence 
            select accseq.Concat(new[] {item})                       
        );
 }
Run Code Online (Sandbox Code Playgroud)

这是Eric的2个集合的例子:

var arr1 = new[] {"a", "b", "c"};
var arr2 = new[] { 3, 2, …
Run Code Online (Sandbox Code Playgroud)

.net c# linq cartesian-product

3
推荐指数
1
解决办法
4374
查看次数