Skip to content

Commit 834d81f

Browse files
committed
Add BLOB storing documentation for layered web application solution template
1 parent 4d973f3 commit 834d81f

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Layered Solution: BLOB Storing
2+
3+
```json
4+
//[doc-nav]
5+
{
6+
"Previous": {
7+
"Name": "Multi-Tenancy",
8+
"Path": "solution-templates/layered-web-application/multi-tenancy"
9+
},
10+
"Next": {
11+
"Name": "CORS Configuration",
12+
"Path": "solution-templates/layered-web-application/cors-configuration"
13+
}
14+
}
15+
```
16+
17+
> Some of the features mentioned in this document may not be available in the free version. We're using the **\*** symbol to indicate that a feature is available in the **[Team](https://abp.io/pricing)** and **[Higher](https://abp.io/pricing)** licenses.
18+
19+
This document explains how to store BLOBs (Binary Large Objects) in a layered solution. It is common to store files, images, videos, and other large objects in a distributed system. You can learn more about BLOB storage in the [BLOB Storing System](../../framework/infrastructure/blob-storing/index.md) documentation.
20+
21+
In the layered solution template, the [Database Provider](../../framework/infrastructure/blob-storing/database.md) is used to store BLOBs in the database. The `Volo.Abp.BlobStoring.Database.EntityFrameworkCore` or `Volo.Abp.BlobStoring.Database.MongoDB` package provides the necessary implementations to store and retrieve BLOBs in the database. This setup is integrated into the layered solution template and is used in all related projects. You can change the database configuration in the `appsettings.json` file of the related project.
22+
23+
You can use the `IBlobContainer` or `IBlobContainer<T>` service to store and retrieve BLOBs. Here is an example of storing a BLOB:
24+
25+
```csharp
26+
public class MyService : ITransientDependency
27+
{
28+
private readonly IBlobContainer _blobContainer;
29+
30+
public MyService(IBlobContainer blobContainer)
31+
{
32+
_blobContainer = blobContainer;
33+
}
34+
35+
public async Task SaveBytesAsync(byte[] bytes)
36+
{
37+
await _blobContainer.SaveAsync("my-blob-1", bytes);
38+
}
39+
40+
public async Task<byte[]> GetBytesAsync()
41+
{
42+
return await _blobContainer.GetAllBytesOrNullAsync("my-blob-1");
43+
}
44+
}
45+
```
46+
47+
The *File Management* module is optional and can be added to the solution during the creation process. It provides a user interface to manage folders and files. You can learn more about the module in the [File Management](../../modules/file-management.md) document.**\***
48+
49+
![file-management](images/file-management-index-page.png)
71.5 KB
Loading

0 commit comments

Comments
 (0)