小编JDB*_*ett的帖子

选择所有层次结构级别和SQL Server下面

我正忙着玩这个.我已经看到了一些关于如何从给定父级的自引用表中获取所有子记录以及如何获取子记录的父级的示例.

我想要做的是返回一个记录和所有给出ID的子记录.

把它放到上下文中 - 我有一个公司层次结构.哪里:

#Role        Level#
--------------------
Corporate         0
Region            1
District          2
Rep               3
Run Code Online (Sandbox Code Playgroud)

我需要的是一个程序,(1)确定记录的级别,(2)检索记录和所有子记录.

作为一个地区的想法可以看到一个地区的所有地区和代表,地区可以看到他们的代表.经销商只能看到自己.

我有桌子:

ID            ParentId           Name
-------------------------------------------------------
1             Null               Corporate HQ
2             1                  South Region
3             1                  North Region
4             1                  East Region
5             1                  West Region
6             3                  Chicago District
7             3                  Milwaukee District
8             3                  Minneapolis District
9             6                  Gold Coast Dealer
10            6                  Blue Island Dealer
Run Code Online (Sandbox Code Playgroud)

我该怎么做呢:

CREATE PROCEDURE GetPositions
    @id int
AS
BEGIN
    --What is the most efficient way to …
Run Code Online (Sandbox Code Playgroud)

sql sql-server stored-procedures

6
推荐指数
1
解决办法
3968
查看次数

模拟 IConfigurationSection 返回字符串数组

使用此答案来模拟IConfigurationASP.NET Core 应用程序中的方法。

我需要模拟 anIConfigurationSection返回一个string数组。

我的配置类如下所示:

public class LoggingConfiguration
{
    public string ApplicationName { get; set; }
    public string[] Loggers { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

应用程序设置.json

{
    "Logging": {
        "LoggingConfiguration": {
              "ApplicationName": "Some app",
              "Loggers":  [ "DiskLogger", "MemoryLogger"],
              "DiskLogger": {
                  "SomeSettingOne" : "setting",
                  "SomeSettingTwo" : "setting",
               },
              "MemoryLogger": {
                  "AnotherSetting": "...",
               }
       }
}
Run Code Online (Sandbox Code Playgroud)

在设置模拟时 - 我有两个问题。

  1. 我不知道如何模拟IConfigurationSection会返回string[]( loggers)
  2. GetChildren()当我尝试在上设置该方法时出现异常LoggingSectionMock
public void Setup()
{
    var …
Run Code Online (Sandbox Code Playgroud)

c# configuration unit-testing moq asp.net-core

6
推荐指数
1
解决办法
4550
查看次数

在 Angular 组件中配置旋转滑块

我正在使用从 Theme Forest 购买的模板作为 angular 应用程序的基础。

我想把这些模板部分做成组件。

努力让革命滑块工作。

在模板 html 中 - 它连接了文档就绪事件上的滑块:

    <script>
  jQuery(document).ready(function() {

    jQuery("#rev_slider_280_1").show().revolution({
      sliderType: "hero",
      jsFileLocation: "revo-slider/js/",
      sliderLayout: "fullscreen",
      dottedOverlay: "none",
      delay: 9000,
      /*navigation: {},*/
      responsiveLevels: [1240, 1024, 778, 480],
      visibilityLevels: [1240, 1024, 778, 480],
      gridwidth: [1240, 1024, 778, 480],
      gridheight: [868, 768, 960, 720],
      lazyType: "none",
      parallax: {
        type: "off",
        origo: "slidercenter",
        speed: 1000,
        levels: [0],
        type: "scroll",
        disable_onmobile: "on"
      },
      shadow: 0,
      spinner: "spinner2",
      autoHeight: "off",
      fullScreenAutoWidth: "off",
      fullScreenAlignForce: "off",
      fullScreenOffsetContainer: "",
      fullScreenOffset: "", …
Run Code Online (Sandbox Code Playgroud)

typescript revolution-slider angular

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

AspNetCore.deps.json 包括 runtimes/win/lib/netcoreapp2.1/System.Data.SqlClient.dll 参考

几天来,我一直在寻找在 Azure 应用服务上运行的 AspNetCore Web api 项目的问题。

基本上我有一个非常小的 api 项目,在部署/启动时 - 我收到 500.30 ANCM 错误。足够隐秘 - 我从应用程序服务中提取事件日志,我发现:

<Data>Could not find inprocess request handler. 
     Captured output from invoking hostfxr: Error:
     An assembly specified in the application dependencies manifest 
     (SampleApp.Api.deps.json) was not found:
    package: 'System.Data.SqlClient', version: '4.6.1'
    path: 'runtimes/win/lib/netcoreapp2.1/System.Data.SqlClient.dll'
</Data>
Run Code Online (Sandbox Code Playgroud)

查看 SampleApp.deps.json - 果然我看到了:

"runtimeTargets": {
      "runtimes/unix/lib/netcoreapp2.1/System.Data.SqlClient.dll": {
        "rid": "unix",
        "assetType": "runtime",
        "assemblyVersion": "4.5.0.1",
        "fileVersion": "4.6.27618.1"
      },
      "runtimes/win/lib/netcoreapp2.1/System.Data.SqlClient.dll": {
        "rid": "win",
        "assetType": "runtime",
        "assemblyVersion": "4.5.0.1",
        "fileVersion": "4.6.27618.1"
      }
    },
Run Code Online (Sandbox Code Playgroud)

我有一个类似(几乎相同)的项目,它在另一个应用程序服务上运行良好。如果运行

dotnet publish …
Run Code Online (Sandbox Code Playgroud)

configuration runtime asp.net-core

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