Filestream and win32 API

Thread is closed for posting
4 posts, 0 answers
  1. Rob
    Rob avatar
    12 posts
    Member since:
    Mar 2013

    Posted 23 Mar 2013 Link to this post

    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.
  2. Dimitar Tachev
    Dimitar Tachev avatar
    67 posts

    Posted 26 Mar 2013 Link to this post

    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.
  3. John
    John avatar
    31 posts
    Member since:
    May 2011

    Posted 22 Dec 2013 Link to this post

    Can you tell me if support now been added for FILESTREAM including accessing using the win32 API?
  4. Doroteya
    Doroteya avatar
    498 posts

    Posted 25 Dec 2013 Link to this post

    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.

    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!
Back to Top