This is a migrated thread and some comments may be shown as answers.

Filestream and win32 API

3 Answers 243 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Rob
Top achievements
Rank 1
Rob asked on 23 Mar 2013, 01:43 PM
Does OpenAccess have an API for accessing filestream files in SQL Server databases using the win32 API? From doing research here, it seems that Microsoft highly recommends using the win32 API for larger files for maximum performance, but I haven't been able to find any documentation on how to best integrate that strategy into my OpenAccess supported application.

My application needs to enable users to upload (and later read) large pdfs (sometimes up to ~50MB), and I want to take advantage of best practices where I can to ensure maximum performance.

Note: all database changes are first made directly in SQL Server and then uploaded to the application.  I'm concerned about creating code in my application that will get overwritten next time I do that sync, so any tips on how to avoid that would be very welcome.

Note: I'm using SQL Server 2012, Visual Studio 2012, and ASP.NET MVC4. I also have a DevCraft complete license, so I have access to other Telerik tools, if that helps.

3 Answers, 1 is accepted

Sort by
0
Dimitar Tachev
Telerik team
answered on 26 Mar 2013, 09:07 AM
Hi Jacob,

 
In the current version of Telerik OpenAccess ORM (Q1 2013) the FileStream columns support was not yet included but it is already implemented and it will be released with our next Service Pack which is expected in the end of April.

The API that you have found is internally used in our Stream API and it will work out of the box without making any addition changes compared with the normal varbinary(MAX) column implementation.

All you need is to have a table with a column marked as a FileStream one and update your OpenAccess ORM model from the database.

Also with the Service Pack there will be a new example in our Sample Kit - a video library demonstrating a streaming read and write (upload on separated parts - chunked upload) of BLOB objects over a varbinary(MAX) column using the Stream API and a new documentation section about the streaming support for a FileStream column.

Meanwhile you could take a look at this documentation section where you could find useful information about the working with Data Streams using OpenAccess ORM.

Regarding your question about overriding your code during the synchronization with database changes - all of the auto-generated files (the OpenAccessContext an the Persistent classes) are regenerating on each save of your RLINQ file. In order to avoid loosing your code in these files you should extend them in partial classes (in separated files) without making any changes in the auto-generated ones. You could find more information about this extending in this documentation section.

I hope this helps. Do not hesitate to contact us back if you need any additional assistance. 

Kind regards,
Dimitar Tachev
the Telerik team
Free Webinar: OpenAccess Integration in Sitefinity. SIGN UP NOW.
0
John
Top achievements
Rank 1
answered on 23 Dec 2013, 04:16 AM
Can you tell me if support now been added for FILESTREAM including accessing using the win32 API?
0
Doroteya
Telerik team
answered on 25 Dec 2013, 02:54 PM
Hi John,

Indeed, the support for FileStream has been released as part of our Stream API with the Q1 2013 SP1 version of Telerik OpenAccess ORM. This particular version is available for download from your Telerik account, although, the feature is available with Q3 2013 SP1 as well. The Win32 API is internally used by our Stream API and there will be no need for you to implement it manually.

Additionally, our off-line resource browser - OpenAccess Samples Kit, contains the Streaming Videos from the Database sample which demonstrates how to stream read and write over a blob column in the database through a Web API service. The sample is implemented on both C# and VB.

I would also suggest to you the following articles:
- Working with Streams - contains the description of the feature.
- How to: Work with Data Streams - offers guidance to the basic streaming operations.


Regards,
Doroteya
Telerik
OpenAccess ORM Q3 2013 simplifies your model operations even further providing you with greater flexibility. Check out the list of new features shipped with our latest release!
Tags
Development (API, general questions)
Asked by
Rob
Top achievements
Rank 1
Answers by
Dimitar Tachev
Telerik team
John
Top achievements
Rank 1
Doroteya
Telerik team
Share this question
or