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

发布于 2024-11-01 00:28:40 字数 192 浏览 6 评论 0原文

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

According to this thread, F# Core must be SQLCLR-approved for assemblies to be marked SAFE. Is this planned? Can it even be done?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

稚气少女 2024-11-08 00:28:40

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

Microsoft connect 位于:http://connect.microsoft.com(您必须注册并拥有实时电子邮件帐户.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 命令中。

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

在 SQL Server 中加载并运行“Hello World”存储过程

样本程序成功后
编译完成,可以用SQL测试一下
服务器。为此,请打开 SQL Server
Management Studio 并创建一个新的
查询,连接到合适的测试
数据库(例如,
AdventureWorks 示例数据库)。我们
需要创建程序集,所以我们
可以访问存储过程。为了
在这个例子中,我们假设您
已经创建了 helloworld.dll
程序集位于 C:\ 目录中。添加
以下 Transact-SQL 语句
您的查询。

使用 PERMISSION_SET = SAFE 从“c:\helloworld.dll”创建程序集 helloworld

创建程序集后,
我们现在可以访问我们的HelloWorld
使用创建过程的方法
陈述。我们将调用我们存储的
过程“你好”:

创建程序你好
作为
外部名称 helloworld.HelloWorldProc.HelloWorld

创建过程后,
它可以像正常一样运行
存储过程写成
Transact-SQL。执行以下命令
命令:

<前><代码>执行你好

这应该会导致以下结果
SQL Server 管理中的输出
Studio 消息窗口。

世界你好!

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

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

I believe it can be done. However, F# core library is the sole property of Microsoft. This means you can't modify its code and recompile it to match and comply with SQLCLR SAFE. I suggest you add suggestion to Microsoft using Microsoft's connect website.

Microsoft connect is at: http://connect.microsoft.com (you have to register and have email account on live.com or hotmail.com before register).

To manually add your .NET DLL and integrate it to SQL Server, you can do this:

In this example, the DLL from your F# code has to be compiled first. I take this step from MSDN Library link:
http://msdn.microsoft.com/en-us/library/ms254956(v=vs.80).aspx

Just don't forget to add PERMISSION_SET = SAFE to the CREATE ASSEMBLY command.

Here are the steps I quote from above link:

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!

Edit: based on the commenter below, he's right about F# is now open source! You can modify and recompile it to suit your needs.

Edit: adding more detail guide on how to integrate the DLL to SQL Server CLR integration.

小巷里的女流氓 2024-11-08 00:28:40

尽管令人讨厌,但有一个技巧是使用 fsc(又名 F# 编译器)的 --standalone 标志。甚至可以将其添加到项目设置中,并将 F# 运行时库(以及所有其他被视为可嵌入的依赖项)嵌入到输出工件中。我相信到那时您应该能够通过将程序集标记为 SQLCLR 安全来完全执行您想要的操作。

A trick, as nasty as it is, would be using the --standalone flag of fsc (aka the F# compiler). This can even be added in the project settings and embeds in the output artifact the F# runtime library (along with all other dependencies deemed embeddable). I believe that at that point you should be able to do exactly what you want just by marking your assembly as SQLCLR safe.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文