0

I've been using LINQ-to-SQL class (.dbml) in my WPF/C# application to query and manage data saved in SQL server, and it has been working well. Recently we have an increasing need of saving files so I started to look at SQL Filestream. I'm very new to this so pardon me if the questions are vague or crazy... -

  • Examples with SQLFilestream in C# that I can find seem to be mostly using SQLconnection rather than LINQ. Can someone provide or point me to a somehow complete example of saving and retrieving files with SQLFilestream using LINQ?
  • In general, is there a reason/preference NOT to use LINQ to deal with SQLFilestream?
  • What is the best practice for saving/retrieving files with SQLFilestream in WPF/C# applications?

Thanks a lot.

Qing Ju
  • 23
  • 3
  • Strictly speaking, Linq is not a saving mechanism, and never was; it is a *query* mechanism. If you're confusing Linq with Linq to SQL, they're not the same thing. Linq to SQL is an Object-Relational Mapper, and does have save capability. – Robert Harvey Oct 05 '21 at 21:38
  • Depends how you want to retrieve the data. If you just want to retrieve via the actual column, you can still do that as it is a `varbinary(max)` column. But you won't be able to use the `SqlFileStream` class with LINQ, you need fairly customized code for that – Charlieface Oct 06 '21 at 00:37

0 Answers0