EasilyNET.Mongo.GridFS.Extension 1.5.5.1

Suggested Alternatives

EasilyNET.MongoGridFS.AspNetCore

Additional Details

请使用推荐包

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package EasilyNET.Mongo.GridFS.Extension --version 1.5.5.1                
NuGet\Install-Package EasilyNET.Mongo.GridFS.Extension -Version 1.5.5.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EasilyNET.Mongo.GridFS.Extension" Version="1.5.5.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EasilyNET.Mongo.GridFS.Extension --version 1.5.5.1                
#r "nuget: EasilyNET.Mongo.GridFS.Extension, 1.5.5.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EasilyNET.Mongo.GridFS.Extension as a Cake Addin
#addin nuget:?package=EasilyNET.Mongo.GridFS.Extension&version=1.5.5.1

// Install EasilyNET.Mongo.GridFS.Extension as a Cake Tool
#tool nuget:?package=EasilyNET.Mongo.GridFS.Extension&version=1.5.5.1                
如何使用?
  • 在系统环境变量或者 Docker 容器中设置环境变量名称为: CONNECTIONSTRINGS_MONGO = mongodb 链接字符串 或者在 appsetting.json 中添加,
  • 现在你也可以参考 Test 项目查看直接传入相关数据.
{
  "ConnectionStrings": {
    "Mongo": "mongodb链接字符串"
  },
  // 或者使用
  "CONNECTIONSTRINGS_MONGO": "mongodb链接字符串"
}
使用 EasilyNET.Mongo.GridFS
  • 使用 Nuget 安装 EasilyNET.Mongo.GridFS
  • .Net 6 +
  • 已配置Kestrel和IIS的最大文件限制,无需再次配置
var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

// 添加Mongodb数据库服务
builder.Services.AddMongoContext<EasilyNETMongoContext>(builder.Configuration);
// 添加GridFS服务
builder.Services.AddEasilyNETGridFS(fsOptions: c =>
{
    c.BusinessApp = "easilyfs";
    c.Options = new()
    {
        BucketName = "easilyfs",
        ChunkSizeBytes = 1024,
        DisableMD5 = true,
        ReadConcern = new() { },
        ReadPreference = ReadPreference.Primary,
        WriteConcern = WriteConcern.Unacknowledged
    };
    c.DefaultDB = true;
    c.ItemInfo = "item.info";
});
...

var app = builder.Build();
使用 EasilyNET.Mongo.GridFS.Extension
  • 配置appsettings.json
{
  // 添加文件缓存
  "EasilyFS": {
    "VirtualPath": "/easilyfs",
    "PhysicalPath": "/home/username/test"
  }
}
  • 新增文件缓存到物理路径,便于文件在线使用.
  • 添加物理路径清理接口.(可通过调用该接口定时清理所有缓存的文件)

  • 使用 Nuget 安装 EasilyNET.Mongo.GridFS.Extension
  • .Net 6 +
var app = builder.Build();
...

// 添加虚拟目录用于缓存文件,便于在线播放等功能.
app.UseGridFSVirtualPath(builder.Configuration);

...

app.Run();
  • 使用EasilyNET.Mongo.GridFS.Extension后建议使用Extension控制器中的接口,原GridFS中的接口就可以不使用了.
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated