Can F # core libs be approved by SQLCLR?

In accordance with this thread, F # Core must be approved by SQLCLR for SAFE assembled marks. Is this planned? Can this be done?

+7
source share
2 answers

I believe that this can be done. However, the core F # library is Microsoft's only property. This means that you cannot change your code and recompile it to comply with SQLCLR SAFE. I suggest you add a Microsoft offer using the Microsoft connect website.

Microsoft connect is located at: http://connect.microsoft.com (you must register and have an email account at live.com or hotmail.com before registering).

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

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

Remember to add PERMISSION_SET = SAFE to the CREATE ASSEMBLY command.

Here are the steps that I quote from the link above:

Download and run the Hello World stored procedure in SQL Server

After successfully completing the compiled selection procedure, you can test it in SQL Server. To do this, open SQL Server Management Studio and create a new query, connecting to a suitable database test (for example, AdventureWorks Sample Database). We will need to create an assembly so that we can access the stored procedure. For this example, we will assume that you created the helloworld.dll assembly in the C: \ directory. Add after the Transact-SQL statement for 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 using the expression creation procedure. We will call our saved hello procedure:

 CREATE PROCEDURE hello AS EXTERNAL NAME helloworld.HelloWorldProc.HelloWorld 

Once a procedure has been created, it can be started as a regular stored procedure written in Transact-SQL. Run the following command:

 EXEC hello 

This should result in the following: output to SQL Server Management Studio message box.

 Hello world! 

Edit : based on the comment below, he's right about F # now open source! You can change and recompile it according to your needs.

Edit: Add in-depth guidance on integrating CLR integration into DLLs and SQL Server.

+1
source

A trick as unpleasant as it is will use the -standalone fsc flag (also known as the F # compiler). You can even add this to project settings and include the F # time library in the output artifact (along with all other dependencies that are considered nested). I believe that at this moment you can do exactly what you want by simply marking your build with a secure SQLCLR.

+1
source

All Articles