gpt4 book ai didi

f# - F# 核心库可以得到 SQLCLR 批准吗?

转载 作者:行者123 更新时间:2023-12-02 20:47:31 25 4
gpt4 key购买 nike

根据this线程,F# Core 必须经过 SQLCLR 批准才能将程序集标记为 SAFE。这是有计划的吗?还可以吗?

最佳答案

我相信这是可以做到的。但是,F# 核心库是 Microsoft 的专有属性(property)。这意味着您无法修改其代码并重新编译它以匹配和遵守 SQLCLR SAFE。我建议您使用 Microsoft 的 connect 网站向 Microsoft 添加建议。

Microsoft 连接位于:http://connect.microsoft.com (注册前您必须在 live.com 或 hotmail.com 上注册并拥有电子邮件帐户)。

要手动添加 .NET DLL 并将其集成到 SQL Server,您可以执行以下操作:

在此示例中,必须首先编译 F# 代码中的 DLL。我从 MSDN Library 链接中采取这一步: http://msdn.microsoft.com/en-us/library/ms254956(v=vs.80).aspx

只是不要忘记将 PERMISSION_SET = SAFE 添加到 CREATE ASSEMBLY 命令中。

以下是我从上面链接中引用的步骤:

Loading and Running the "Hello World" Stored Procedure in SQL Server

Once the sample procedure has successfully compiled, you can test it in SQL Server. To do this, open SQL Server Management Studio and create a new query, connecting to a suitable test database (for example, the AdventureWorks sample database). We will need to create the assembly so we can access the stored procedure. For this example, we will assume that you have created the helloworld.dll assembly in the C:\ directory. Add the following Transact-SQL statement to your query.

CREATE ASSEMBLY helloworld from 'c:\helloworld.dll' WITH PERMISSION_SET = SAFE

Once the assembly has been created, we can now access our HelloWorld method by using the create procedure statement. We will call our stored procedure "hello":

CREATE PROCEDURE hello
AS
EXTERNAL NAME helloworld.HelloWorldProc.HelloWorld

Once the procedure has been created, it can be run just like a normal stored procedure written in Transact-SQL. Execute the following command:

EXEC hello

This should result in the following output in the SQL Server Management Studio messages window.

Hello world!

编辑:根据下面的评论者,他关于 F# 现已开源的说法是正确的!您可以修改并重新编译它以满足您的需要。

编辑:添加有关如何将 DLL 集成到 SQL Server CLR 集成的更多详细指南。

关于f# - F# 核心库可以得到 SQLCLR 批准吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5666703/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com