当前位置:  开发笔记 > 编程语言 > 正文

SqlDependency和.NET Core?

如何解决《SqlDependency和.NETCore?》经验,为你挑选了1个好方法。

是否可以从.NET Core v1.1应用程序中利用System.Data.SqlClient.SqlDependency?似乎System.Data.SqlClient中的大多数其他类和方法都可用,但SqlDependency除外.

本质上,我正在尝试在表数据更改时订阅SQL通知然后更新客户端的UI,因此如果.NET Core中没有SqlDependency,我可以通过其他方式实现此目的.

提前致谢!这是我完整的project.json文件:

{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.1.0",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Authentication": "1.0.0",
    "Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
    "System.IdentityModel.Tokens.Jwt": "5.0.0",
    "Microsoft.AspNetCore.Authentication.OpenIdConnect": "1.0.0",
    "Microsoft.AspNetCore.Authentication.Google": "1.0.0",
    "Microsoft.AspNetCore.Authentication.JwtBearer": "1.0.0",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
    "Microsoft.AspNetCore.StaticFiles": "1.1.0",
    "Microsoft.EntityFrameworkCore": "1.1.0",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
    "Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0",
    "Microsoft.Extensions.Configuration.Binder": "1.1.0",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
    "Microsoft.Extensions.Configuration.Json": "1.1.0",
    "Microsoft.Extensions.Logging.Console": "1.1.0",
    "Microsoft.AspNetCore.Diagnostics": "1.1.0",
    "Microsoft.AspNetCore.Identity": "1.1.0",
    "Microsoft.AspNetCore.Mvc": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
    "Microsoft.AspNetCore.Rewrite": "1.0.0",
    "Microsoft.AspNetCore.ResponseCompression": "1.0.0",
    "Microsoft.AspNetCore.SignalR.Server": "0.2.0-*",
    "Microsoft.AspNetCore.WebSockets": "0.2.0-*"
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
  },

  "frameworks": {
    "netstandard1.1": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8",
        "net461",
        "dnxcore50"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "Views",
      "wwwroot",
      "appsettings.json",
      "appsettings.dev.json",
      "web.config"
    ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

Micaël Félix.. 6

在GitHub上有一个基于.Net Core的开源解决方案:https: //github.com/dyatchenko/ServiceBrokerListener

然而,我不确定性能,因为似乎多个客户端应用程序正在监听更改正在创建专用队列.所以也许它的扩展性不如原始的SqlDependency.



1> Micaël Félix..:

在GitHub上有一个基于.Net Core的开源解决方案:https: //github.com/dyatchenko/ServiceBrokerListener

然而,我不确定性能,因为似乎多个客户端应用程序正在监听更改正在创建专用队列.所以也许它的扩展性不如原始的SqlDependency.

推荐阅读
yzh148448
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有