I try to use FileTable with Entity Framework (I know it is not supported directly). So I use custom Sql commands to insert and delete (no update) the data. My problem is I have a table which refers to the FileTable with a foreign key to the stream_id of the FileTable. If I insert into the FileTable, how can I get the stream_id back?
I want to use SqlBulkCopy to insert lots of files, I can bulk insert into the FileTable, but SqlBulkCopy won´t tell me the inserted stream_id values.
If I execute single insert statements with select scopeIdentity() or something similar, the performance becomes worse.
I want to insert like 5.000 files (2MB until 20MB) into the FileTable and connect them with my own Table via foreign key. Is this bad practice and I should use a simple path column and store the data directly in the filesystem? I thought FileTable is doing exactly this for me, because I need to secure the database and the files are always in sync even if I go one hour or 4 days back in the past. I cannot backup the database and the filesystem exactly at the same time so they are 100 percent synchronized.