小编jak*_*zon的帖子

如何在 SQL Server 中禁用“clr strict security”

我通过运行启用了 clr 集成(即 SQLCLR):

EXEC sp_configure 'clr enabled', 1;  
RECONFIGURE;  
Run Code Online (Sandbox Code Playgroud)

现在当我尝试:

EXEC sp_configure 'clr strict security', 0;
RECONFIGURE;
Run Code Online (Sandbox Code Playgroud)

我收到一条错误消息,说该设置不存在:

消息 15123,级别 16,状态 1,过程 sp_configure,第 62 行

配置选项“clr strict security”不存在,或者它可能是一个高级选项。

我知道我的问题的正确解决方案是签署包含存储过程的程序集,以允许它以严格的安全性运行,但现在我需要快速而肮脏的修复。

sql-server configuration sqlclr

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

在JSP中将枚举值作为标记属性传递

我有一个自定义JSP标记,它使用的参数是枚举.这种方法是使用需要此枚举的其他类的结果.关键是我不知道如何在EL中分配枚举值:

<mytaglib:mytag enumParam="${now what do I type here?}" />
Run Code Online (Sandbox Code Playgroud)

到目前为止,我发现的唯一解决方法是使enumParam成为一个整数并将其转换为所需的值:

<mytaglib:mytag enumParam="3" />
Run Code Online (Sandbox Code Playgroud)

我相信必须有更好的方法来做到这一点.请帮忙.

enums jsp taglib

10
推荐指数
1
解决办法
6490
查看次数

为什么javascript生成器函数的yield语句返回.next()的参数?

在MDN上偶然发现了生成器函数,让我感到困惑的是以下示例:

function* logGenerator() {
  console.log(yield);
  console.log(yield);
  console.log(yield);
}

var gen = logGenerator();

// the first call of next executes from the start of the function
// until the first yield statement
gen.next(); 
gen.next('pretzel'); // pretzel
gen.next('california'); // california
gen.next('mayonnaise'); // mayonnaise
Run Code Online (Sandbox Code Playgroud)

我不明白的是为什么作为yield参数的语句console.log返回传递给.next()生成器方法的参数.这是否发生是因为空yield必须返回.next()方法的第一个参数的值?

我还尝试了一些例子,似乎证实了上述陈述:

gen.next(1,2,3); // the printed value is 1, the 2 and 3 are ignored
// and the actual yielded value is undefined
Run Code Online (Sandbox Code Playgroud)

还有一种方法可以访问.next() …

javascript yield

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

为什么IEnumerable会丢失更新的数据?

你能解释一下为什么在执行下面的代码后Selected属性没有更新到true

使用的ListItem类型来自System.Web.UI.WebControls命名空间,是一个类(不是结构.)我相信该FirstOrDefault函数返回一个实例的引用,我可以在items枚举中更新和传递.

// produce list items out of the communities
IEnumerable<ListItem> items = communities.Select(community => new ListItem(community.Name, community.Id.ToString()));

// mark the right list item as selected, if needed
if (platform.CommunityId > 0)
{
    string strCommunityId = platform.CommunityId.ToString();
    ListItem selectedItem = items.FirstOrDefault(item => item.Value == strCommunityId);
    if (selectedItem != null) selectedItem.Selected = true;
}

// now items do not store any updated item!
Run Code Online (Sandbox Code Playgroud)

这是因为每次foreach调用a时都会执行枚举器,从而创建新项而不是返回包含我更新的项的集合?

c# linq

5
推荐指数
3
解决办法
817
查看次数

Blazor - 如何使子组件显示验证消息?

如果嵌套组件未正确填充,我需要显示验证消息。该组件由其他父组件使用,它们需要获得有关是否存在验证问题的反馈。

我已经为嵌套组件尝试了以下代码并使用了该CanSubmit方法。虽然该方法可以正确判断是否存在验证问题,但验证消息并未显示。

下面的所有代码都可以在blzorrepl上测试: https ://blazorrepl.com/repl/GvOQlvvv1789ra1G37

@if(editContext != null) {
    <EditForm EditContext="@editContext">
        <input type="text" @bind="testModel.Name" />
        <DataAnnotationsValidator />
        <ValidationSummary />
    </EditForm>
}

@code {
    [Parameter]
    public TestModel testModel
    {
        get { return (TestModel)editContext?.Model; }
        set { editContext = new EditContext(value); }
    }

    EditContext editContext;

    public bool CanSubmit()
    {
        return editContext.Validate();
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我的父组件代码,稍微减少但重现了问题:

<ChildComponent @ref="myTestComponent" testModel="testModel" />
<input type="button" @onclick="buttonClick" value="validate programmatically" />
<div>@testMessage</div>

@code {
    TestModel testModel = new TestModel();
    ChildComponent myTestComponent;
    string testMessage;

    void buttonClick()
    {
        testMessage …
Run Code Online (Sandbox Code Playgroud)

razor blazor blazor-component

5
推荐指数
2
解决办法
6953
查看次数

如何应用正确的元素加消息框样式?

这是元素加消息框在我构建的最小页面上的外观: 在此输入图像描述

我期望它看起来像element-plus 文档中的那样。

我将VueviteElementPlus一起使用。我从 vite 和 element plus 文档复制了设置。我玩了很多其他元素,它们都渲染正确。App.vue可以重现问题的最小组件:

<template>
  <el-button text @click="open">Click to open the Message Box</el-button>
</template>

<script setup>
import { ElMessageBox } from 'element-plus'

const open = () => {
  ElMessageBox.alert('This is a message', 'Title', {
    confirmButtonText: 'OK'
  })
}
</script>
Run Code Online (Sandbox Code Playgroud)

我的vite.config.js

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' …
Run Code Online (Sandbox Code Playgroud)

css vue.js vite element-plus

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

如何用C#格式化美式和欧式的数字?

我希望能够格式化美国和欧洲风格的数字(双重类型).根据用户的选择,编号123123123.456应格式化为:

  • 123,123,123.456 //美国格式
  • 123.123.123,456 //欧洲格式

另一个要求是能够设置小数位数.我相信我可以使用double.ToString(string format, IFormatProvider provider)和放置"F2",format但msdn似乎并没有IFormatProvider说明分别解释我可以自己实现它.

double x = 123123123.456
IFormatProvider myFormatProvider = whatToDo ?
x.ToString("F2", myFormatProvider); // I need 2 decimal digits hence F2
Run Code Online (Sandbox Code Playgroud)

我可以为此目的使用任何预制数量的IFormatProvider对象吗?或者也许还有其他解决方案而且我的方向错了?

.net c# formatting

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