This repository contains the SQL server database file provider in ASP.NET Core for the Syncfusion File Manager component.
To know more about SQL server database file system provider for File Manager, please refer our documentation [here] (https://ej2.syncfusion.com/aspnetcore/documentation/file-manager/file-system-provider#sql-database-file-system-provider).
The SQL FILESTREAM feature provides efficient storage, management, and streaming of unstructured data stored as files on the file system.
The SQL server database file provider serves the file system support for the FileManager component in SQL server database.
The following actions can be performed with the SQL server database file provider.
Actions | Description |
---|---|
Read | Read the files from SQL table. |
Details | Gets a file's details which consists of Type, Size, Location and Modified date. |
Download | Downloads the selected file or folder from the SQL table. |
Upload | Uploads a file to the SQL table. It accepts uploaded media with the following characteristics:
|
Create | Creates a New folder. |
Delete | Deletes a folder or file. |
Copy | Copys the selected Files from target. |
Move | Pastes the copied files to the desired location. |
Rename | Renames a folder or file. |
Search | Full-text queries perform linguistic searches against text data in full-text indexes by operating on words and phrases. |
- Visual Studio 2022
Make the SQL server connection with SQL database file (App_Data/FileManager.mdf) and specify the connection string in "Web.config" file as specified in below code example.
<add name="FileExplorerConnection" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\FileManager.mdf;Integrated Security=True;Trusted_Connection=true" />
Also need to add the entry for the connection string in the appsettings.json
file as specified in below code example.
{
"ConnectionStrings": {
"FileManagerConnection": "Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\\App_Data\\FileManager.mdf;Integrated Security=True;Connect Timeout=30"
}
}
To configure the SQL server database connection use the SetSQLConnection
method to set the connection name, table name and rootId of the table.
SetSQLConnection(string name, string tableName, string tableID)
- Checkout this project to a location in your disk.
- Open the solution file using Visual Studio 2022.
- Restore the NuGet packages by rebuilding the solution.
- Run the project.
To access the basic actions such as Read, Delete, Copy, Move, Rename, Search, and Get Details of File Manager using the SQL server database file provider service, just map the following code snippet in the Ajaxsettings property of File Manager.
Here, the hostUrl
will be your locally hosted port number.
var hostUrl = http://localhost:62870/;
ajaxSettings: {
url: hostUrl + 'api/SQLProvider/SQLFileOperations'
}
To perform download operation, initialize the downloadUrl
property in ajaxSettings of the File Manager component.
var hostUrl = http://localhost:62870/;
ajaxSettings: {
url: hostUrl + 'api/SQLProvider/SQLFileOperations',
downloadUrl: hostUrl + 'api/SQLProvider/SQLDownload'
}
To perform upload operation, initialize the uploadUrl
property in ajaxSettings of the File Manager component.
var hostUrl = http://localhost:62870/;
ajaxSettings: {
url: hostUrl + 'api/SQLProvider/SQLFileOperations',
uploadUrl: hostUrl + 'api/SQLProvider/SQLUpload'
}
To perform image preview support in the File Manager component, initialize the getImageUrl
property in ajaxSettings of the File Manager component.
var hostUrl = http://localhost:62870/;
ajaxSettings: {
url: hostUrl + 'api/SQLProvider/SQLFileOperations',
getImageUrl: hostUrl + 'api/SQLProvider/SQLGetImage'
}
The FileManager will be rendered as the following.
Product support is available for through following mediums.
- Creating incident in Syncfusion Direct-trac support system or Community forum.
- New GitHub issue.
- Ask your query in Stack Overflow with tag
syncfusion
andej2
.
Check the license detail here.
Check the changelog here
Copyright 2023 Syncfusion, Inc. All Rights Reserved. The Syncfusion Essential Studio license and copyright applies to this distribution.