File Manager with FileManagerService and SqlFileProvider
Hi, i use VS2022 with .Net Core 7.0.17 and Syncfusion FileManager 24.1.46 and the SqlFileProvider with SqlServer 2022 on a Windows Server 2022 with IIS 10.X.
At the moment i use the 'AjaxSettings' where i construct some 'parameter' in the 'query string' that i must 'deconstruct' on the server to create my select statements (for set new root, filter some data based on the user and so on) and the resulting response.
Now i see that there is a new topic with the FileManagerService!
So my question: Is there a full sample with FileManagerService and SqlFileProvider available?
Is there a kind of 'notification service' available or in the 'pipeline' so if one user change the content of a file, other users that has that file in there 'actual view' get a message about this?
Thanks for some infos
Pat
Hi Patric,
We have reviewed your query and understand that you have two concerns regarding the File Manager component with the SQL File Provider. Please find the details below:
Query 1 : Is there a full sample with FileManagerService and SqlFileProvider available?
We would like to inform you that the Blazor FileManager component provides the option to load a list of objects. This can be achieved by providing the response within the corresponding events. The Blazor FileManager can also be populated from an injected service, eliminating the need for HTTP client requests and backend URL configuration. This allows you to utilize your required SQL File Provider.
By utilizing the “OnRead” event, you can trigger the GetFiles method and update the FileManager component’s result data by incorporating the data returned from the injected service. Assign this returned data to the “Response” property in the “OnRead” event handler.
To set up a locally injected physical service, create a new file with the extension .cs within the project, include the following GitHub file code in this file, and then proceed to inject the created service into the program.cs file.
This will fetch the details of the static folder from the wwwroot directory. Likewise, you can inject your own service.
We have shared the user guide documentation which contains further details regarding injected service.
Documentation : https://blazor.syncfusion.com/documentation/file-manager/data-binding#injected-service
Query 2 : Is there a kind of 'notification service' available or in the 'pipeline' so if one user change the content of a file, other users that has that file in there 'actual view' get a message about this?
We would like to inform you that File Manager component currently do not have built-in support to send notifications to users when data is modified or changed in the File Manager component. However, we believe you have achieved file preview support on the controller side of the File Manager component using dependent components like PdfViewer and DocumentEditor. Once you have saved the modified content data, you can utilize the SignalR connection concept to send the required data.
Regards,
Suresh.
Hi Suresh,
thanks for your reply, but the GitHub project you point is for 'flat file' where the root is some kind of url from where you navigate down like 'wwwroot\files\...'.
With the SqlProvider the root is some data in a table connected via ParentID and the content of a file is a blob in one column of this table.
So the handling to 'create' a 'Response-structure' is an other!
So as i understand:
- There is no example of the FileManagerService and SqlFileProvider available
- And no 'notification service' on the line
Hi Patric,
Sorry for the inconvenience caused.
We want to inform you that, In ASP.NET Core, the SQL database file system provider allows users to manage the file system maintained in a SQL database table. To establish a SQL server connection with the database file (e.g., FileManager.mdf), specify the connection string in the web.config file and also register the connection string entry in the appsettings.json file.
To configure the database connection, set the connection name, table name, and root folder ID value by passing these values to the SetSQLConnection method.
|
public SQLProviderController(IConfiguration configuration) { operation = new SQLFileProvider(configuration); string connectionName = "FileManagerConnection"; string tableName = "Product"; string rootFolderID = "0";
...
//To configure the database connection, set the connection name, table name and root folder ID value by passing these values to the SetSQLConnection method. operation.SetSQLConnection(connectionName, tableName, rootFolderID); } |
By utilizing the “OnRead” event, you can trigger the GetFiles method and update the FileManager component’s result data by incorporating the data returned from the injected service. Assign this returned data to the “Response” property in the “OnRead” event handler.
To set up a locally injected the file service, create a new file with the extension .cs within the project, include the following GitHub file code in this file, and then proceed to inject the created service into the program.cs file.
We have shared the SQL File Provider user guide documentation for your reference.
Documentation : https://ej2.syncfusion.com/angular/documentation/file-manager/file-system-provider#sql-database-file-system-provider
Regards,
Suresh.
Hi Suresh,
sorry for my late reply. Syncfusion did an excelent job in updating the documentation. It us now a lot better as the old examples!
But the code of the sql file provider (that i must customize) use
Microsoft.AspNetCore.Http which is depreceated!
Do you know how to replace this assembly?
Thanks for help-
Patric
Hi Patric,
We have reviewed your query and understand that you are looking for an alternative assembly due to concerns about the deprecation of Microsoft.AspNetCore.Http. To clarify, the IFormFile interface within Microsoft.AspNetCore.Http is not deprecated and continues to be actively used for handling files sent with HTTP requests in ASP.NET Core applications. . However, there have been some changes and updates in the ASP.NET Core ecosystem that might have caused some confusion.
For example, the Microsoft.AspNetCore.Http.Features package was split into two assemblies starting from ASP.NET Core 6.02. This change was made to allow core types to be shared more broadly across components and to take advantage of new runtime and language features.
We have shared general blogs for your references:
- IFormFile Interface (Microsoft.AspNetCore.Http) | Microsoft Learn
- Breaking change: Microsoft.AspNetCore.Http.Features split up - .NET | Microsoft Learn
- Microsoft.AspNetCore.Http.Abstractions is deprecated · Issue #342 · microsoft/kernel-memory (github.com)
- Deprecation notice for Microsoft.AspNetCore.Http package, provider of IFormFile · Issue #55430 · dotnet/aspnetcore (github.com)
Regards,
Suresh.
- 5 Replies
- 2 Participants
-
PG Patric Gehl
- Jun 27, 2024 04:49 PM UTC
- Sep 4, 2024 05:16 PM UTC