.NET Core Support for SQL Server FILESTREAM

I am upgrading an existing application to .NET Core (DNX SDK 1.0.0-rc1-update2), which uses the SQL Server FILESTREAM function to read / write large BLOB data to a database. To achieve this, it uses the SqlFileStream class, however it is not available in .NET Core. Here are my links in project.json:

"frameworks": { "net451": { "frameworkAssemblies": { "System.Runtime": "4.0.10.0", "System.Collections": "4.0.0.0" } }, "dotnet5.4": { "dependencies": { "Microsoft.CSharp": "4.0.1-beta-23516", "System.Data.Common": "4.0.1-beta-23516", "System.Data.SqlClient": "4.0.0-rc2-23623", "System.Collections": "4.0.11-beta-23516", "System.IO.FileSystem": "4.0.1-beta-23516", "System.Linq": "4.0.1-beta-23516", "System.Runtime": "4.0.21-beta-23516", "System.Threading": "4.0.11-beta-23516" } } } 

I tried looking for SO and Google, both of which are absolutely irrelevant.

Can someone confirm whether it is really unavailable or if I do not know it in another package?

+5
source share
2 answers

I understand that the question is old, but I just ran into a problem - the SqlFileStream implementation - is listed in the github registry for CoreFX (.NET Core core libraries) and thought that I mention it here. Here's a link to the question, for reference: https://github.com/dotnet/corefx/issues/15652

Recall: the problem is the implementation of SqlFileStream. This is currently an open question, but not in the near future. One participant states: "If there are any Windows-dependent dependencies, we cannot bring it to Core."

+2
source

I have really been interested in this for a while and have taken some time over the past few days.

Unfortunately, FILESTREAM uses several NTFS and NT system calls (in particular, NtCreateFile , DeviceIoControl , but several others to support them) to control file access. Unfortunately, at the time of this writing, the latest CTPs for MSSQL for Linux do not support FILESTREAM, and there is little clarity as to what the roadmap is or where it may be (oddly enough, you can restore a database that supports FILESTREAM, but FileTable doesn seems to be supported.)

There are two problems here: it is not clear that replacing certain NT APIs will respect transaction integrity (or even work at all), and it is not clear that they can ever work from a non-Windows environment. Due to these facts, I do not see SqlFileStream support SqlFileStream soon for the kernel.

There is some use case for Windows. Only a low-level type, for example, in System.Net.Socket.IOControl . SqlFileStream could go the same way. Alternatively, it may be possible to create a specific SqlFileStream NuGet package, but it will only be supported / run on Windows. I'm not sure how useful this would be - if you are going to use P / Invoke for Windows only, why not just P / Invoke for DLL.NET 4.6.x?

Redirecting this question to github: https://github.com/dotnet/corefx/issues/15652

Change As an alternative to P / Invoke, you can certainly create another type of service (RESTful, WCF, some other channel or TCP or even a memory-mapped file) in .NET 4.x for the .NET Core library or access application.

+1
source

Source: https://habr.com/ru/post/1247703/


All Articles