小编rda*_*pan的帖子

合并 terraform 局部变量

你能指导我如何结合当地人吗?尽管一些在线文档建议以这种方式构建,但这是行不通的。感谢您的帮助,谢谢!

# see README.md for developer guide
# prepare subscription where resources are created
locals {
  location_code           = "weu"
  environment_code        = "test"
}

locals {
  kv_name = "oamp-kv-${local.environment_code}-${location_code}"
  ai_name = "oamp-ai-${local.environment_code}-${location_code}"
}

# prepare azure rm configuration
provider "azurerm" {
    version = "~>2.15.0"
    use_msi = true
    features {}
}
Run Code Online (Sandbox Code Playgroud)

验证

Error: Invalid reference

  on main.tf line 20, in locals:
  20:   kv_name = "oamp-kv-${local.environment_code}-${location_code}"

A reference to a resource type must be followed by at least one attribute
access, specifying the …
Run Code Online (Sandbox Code Playgroud)

terraform

7
推荐指数
1
解决办法
1万
查看次数

使SQL Server表在Rx和C#中可观察

我正在研究Rx.NET流SQL服务器数据表的潜力。基本上,我希望在插入数据时尽可能地使数据更接近而不使用轮询。

我使用Rx / DataReader进行了一些POC,但是插入新行时无法订阅。当没有更多行可供选择时,流停止(当然这是预期的)。

限制条件:

  • SQL Server和数据库上没有配置更改
  • 可能没有轮询

我想到了这些解决方案,但是这些解决方案需要许可证或服务器更改:

  • StreamInsight
  • SQLDependency
  • 扳机

.NET中是否有类似SQLBrite的内容?

c# sql-server system.reactive

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

单元测试RhinoMocks中的回调函数Func <T>

我一直试图弄清楚如何覆盖从缓存中获取项目时用作回调的内部函数.我有一个接受密钥和Func的CacheService.当项目不在缓存中时,将调用Func.

此示例代码基于SO中的其他建议,但cacheService.Get方法始终返回null并且从未调用过WhenCalled.

我理解它应该覆盖这个内部方法的争议,但是为了开始我尝试可能的方法来覆盖这个而不为这个内部方法创建一个新类.感谢您的帮助.

CacheService.cs

    public T Get<T>(string key, Func<T> funcWhenNotExist)
    {
        if (!Exists(key))
        {
            var result = funcWhenNotExist();
            Cache.Put(key, result);
        }

        return DoSomethingWithRetry(() => (T)Cache.Get(key), MAXRETRY);
    }
Run Code Online (Sandbox Code Playgroud)

SomeService.cs

    public SomeDto GetSomeDto(string dtoAlias)
    {
           string cacheKey = "whatever";
           var someDto = cacheService.Get(cacheKey, () => GetSomeDtoInternal(dtoAlias));

           return someDto
    }

    internal SomeDto GetSomeDtoInternal(string dtoAlias
    {
    //do more here
    }
Run Code Online (Sandbox Code Playgroud)

SomeServiceTest.cs

    // Arrange
        SomeDto stubResult = new SomeDto();
        cacheService.Stub(s => s.Get(Arg<string>.Is.Anything, Arg<Func<SomeDto>>.Is.Anything)).WhenCalled(m =>
        {
            var func = (Func<SomeDto>) m.Arguments[1];
            stubResult = func();
        }).Return(stubResult);

        // …
Run Code Online (Sandbox Code Playgroud)

c# rhino-mocks

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

无法在 .NET Core 3.0 中使用 AssemblyLoadContext 加载插件依赖项

我有一个依赖项失败的插件,尽管我试图在 .NET Core 3.0 上遵循尽可能多的 MS 建议。2 天来一直试图找出问题所在:/。欣赏输入或查看位置。谢谢!

细节:

  • 入口点是 .NET Core 3.0 自包含应用程序发布的 CLI 应用程序
    //publishes as EXE file
    dotnet publish -c release -r win-x64 /p:publishsinglefile=true /p:publishtrimmed=true
    
    Run Code Online (Sandbox Code Playgroud)
  • 在 Win-x64 和 Linux-x64 上测试
  • .NET Core 3.0 程序集
  • 使用此命令发布插件 DLL

    //publishes as DLL files
    dotnet publish -c release -r linux-x64 /p:publishtrimmed=true -o ./app
    
    Run Code Online (Sandbox Code Playgroud)

日志显示文件在那里,它存在但依赖解析器无法加载它并抛出 FileNotFoundException。奇怪的。


C:\play\yuniql\yuniql-cli\bin\release\netcoreapp3.0\win-x64\publish>yuniql.exe run --plugins-path C:\temp\aztools\yuniql\0.0.0\x64\.plugins -p C:\play\yuniql\yuniql-plugins\postgresql\samples -c "Host=localhost;Port=5432;Username=xxx;Password=xxx;Database=yuniqldb" --platform postgresql -a 1 --debug
...
DBG   platformLowerCased: postgresql
DBG   pluginsPathParameter: C:\temp\aztools\yuniql\0.0.0\x64\.plugins
DBG   defaultAssemblyBasePath: C:\temp\aztools\yuniql\0.0.0\x64\.plugins\postgresql
...
DBG   Found …
Run Code Online (Sandbox Code Playgroud)

c# npgsql .net-core .net-core-3.0

5
推荐指数
0
解决办法
877
查看次数