Netigent.Utils.FileStoreIO
1.4.0
See the version list below for details.
dotnet add package Netigent.Utils.FileStoreIO --version 1.4.0
NuGet\Install-Package Netigent.Utils.FileStoreIO -Version 1.4.0
<PackageReference Include="Netigent.Utils.FileStoreIO" Version="1.4.0" />
<PackageVersion Include="Netigent.Utils.FileStoreIO" Version="1.4.0" />
<PackageReference Include="Netigent.Utils.FileStoreIO" />
paket add Netigent.Utils.FileStoreIO --version 1.4.0
#r "nuget: Netigent.Utils.FileStoreIO, 1.4.0"
#:package Netigent.Utils.FileStoreIO@1.4.0
#addin nuget:?package=Netigent.Utils.FileStoreIO&version=1.4.0
#tool nuget:?package=Netigent.Utils.FileStoreIO&version=1.4.0
FileStoreIOClient
A generic layer to allow the saving and loading of file from configurable stores using a uniqueFileRef with prefix code for detection in your code, supports UNC, Database, Box and AWS S3 Buckets.
How to use
Initially thanks for considering using this library - we hope that it gives you some benefits. In terms of using the Library the following should get you up and running quickly
Database The library will autocreate and upgrade filestore table {schema}.[FileStoreIndex]. You can then manually remove column no longer used [FileType], [MainGroup] ,[SubGroup] from [FileStoreIndex] if you want - they're longer used!
Version Changes
1.4.0 The following methods have been marked Obsolete
List<InternalFileModel> Files_GetAllV2(string[] pathTags, bool recursiveSearch = false)
List<InternalFileModel> Files_GetAllV2(string relationalFilePathAndName, bool recursiveSearch = false)
Instead you should move to, these new methods provide clearer functionality to the intent.
List<FileStoreItem> Files_GetByFolder(string folderPath, bool includeSubFolders = false)
List<FileStoreItem> Files_GetByFileAndFolder(string folderPath, bool includeSubFolders, string fileToFind, bool exactFileMatch)
Removed Microsoft.AspNetCore.Http.Features - this has also meant removal of the Upsert methods for IFormFile, instead extract and use the byte[] directly e.g.
IFormFile myFile = [from HttpRequest]
using (var dataStream = new MemoryStream())
{
await file.CopyToAsync(dataStream);
string fileRef = fileStoreIOClient.File_UpsertAsyncV2("HT/Training/myprocedures.pdf", dataStream.toArray());
}
Relabel of data types, to align the system and make more sense from implementation. FileObjectModel becomes FileOutput (simple file output, aimed at sending content to a client) InternalFileModel becomes FileStoreItem (full record from the FileStoreIndex table) Finally internal in the FileStoreIndex table, it now uses Folder, to indicate the Files location.
1.3.0 Added support for relocating files to new storage locations (folders/paths) within the underlying provider.
Task<ResultModel> File_MoveAsync(string fileRef, string[] pathTags);
Task<ResultModel> File_MoveAsync(string fileRef, string relationalFilePathAndName);
1.2.1 Bug fix Subfile, gets replaced by single Parent. RecursiveSearch = false is now default, if you want a list of all files, including subFolders then set as true.
Files_GetAllV2(string[] pathTags, bool recursiveSearch = false);
Files_GetAllV2(string relationalFilePathAndName, bool recursiveSearch = false);
1.2.0 Recursive flag has been added to Files_GetAllV2. Obsolete legacy methods have been removed.
1.1.7 Bug fix for AppPrefix setting not populating correctly. Upgraded .net to 8.0 LTS support and various internal package upgrades.
1.1.6 Database Migration update, include AppPrefix into PathTags column, if you implemented v1.1.5 and are using AppPrefix and your files have 'disappeared', then run (this will apply update to ensure files show again)
UPDATE {schema}.[FileStoreIndex] SET PathTags = '{AppPrefix}/' + PathTags WHERE PathTags NOT LIKE '{AppPrefix}%'
1.1.5 Readme updates and stablization updates.
1.1.4 Internal database upgrade.
1.1.3 Added this Readme.md into package
1.1.2 Added Legacy MainGroup, SubGroup helpers onto InternalFileModel, also added helper Properties onto the client AppPrefix and PathSeperator
1.1.1 Added Support for AWS S3 Bucket Storage, upgraded code to .net 7 and .net Standard 2.0, some methods have been marked as Obsolete and have been repointed to newer methods. Older versions are still working, but try and swap.
1.0.14 Upgraded Bounycastle dependencies.
1.0.13 If the appSettings / DefaultStorage, it will default to Database.
1.0.10 Support for indexing existing Box Storage account (still to come FileStore Indexing and >50MB files in Box). New field sizeInBytes for the file.
1.0.9 Missing Prop in DI / appSettings for default Storage, updating Readme example
1.0.8 Support for Box Storage (>50MB files not yet supported will be in next version), Migrate File function (keep file references and relocate the binary to new location), default Provider
1.0.7 Relational Filepath Storage, makes it easier to move UNC shares around
1.0.6 Versioning, if you via Constructor increment maxVersions the app will store that many latest copies, if you push same file+ext in the same mainGroup, subGroup, it considers same file and will return same fileRef keeping X last versions.
1.0.5 Upgraded to .net 6 LTS
1.0.4 Stablity improvements.
1.0.3 Stablity improvements.
1.0.2 'Customer' has been relabelled to 'MainGroup', and 'FileTypeGroup' relabelled to 'SubGroup' for clarity and added functionality to access those. 'FileType' is also now known as 'MimeType' to reflect the data stored.
Files_GetAllV2(string[] pathTags);
Files_GetAllV2(string relationalFilePathAndName);
Direct Usage
You can use the client directly as follows, keeping Last 3 versions of the file
BoxConfig myBoxConfig = new BoxConfig()
{
EnterpriseID = "123456789",
BoxAppSettings = new BoxAppSettings()
{
ClientID = "exampleid12345",
ClientSecret = "examplesecret12345",
AppAuth = new BoxAppAuth()
{
Passphrase = "examplepassphrase12345",
PrivateKey = "-----BEGIN ENCRYPTED PRIVATE KEY-----\nEXAMPLEEXAMPLEEXMAPLE\n-----END ENCRYPTED PRIVATE KEY-----\n",
PublicKeyID = "abc1234",
},
},
TimeoutInMins = 15,
};
S3Config myS3Config = new S3Config()
{
AccessKey = "ExampleAccessKey",
BucketName = "my-example-bucket-name",
Region = "us-west-2",
SecretKey = "mysecretkeyinhere",
};
FileSystemConfig myFsConfig = new FileSystemConfig()
{
RootFolder = @"C:\temp\Files\",
StoreFileAsUniqueRef = false,
};
IFileStoreIOClient fileStoreIOClient = new FileStoreIOClient(
appPrefix: "MyApp",
databaseConnection: "mysqlserver connection string",
maxVersions: 3,
dbSchema: _dbSchema,
defaultFileStore: FileStorageProvider.FileSystem,
boxConfig: myBoxConfig,
s3Config: myS3Config,
fileSystemConfig: myFsConfig);
var newFile = await fileStoreIOClient.File_GetAsyncV2("_$23fe627c5a5b410aa6017db308b71077");
Using Dependency Injection
The below method steps you through using IServiceCollection registration and injection to your controllers
FileStoreIOClient settings in appSettings.json
Define via appSettings, keeping last 5 versions of file.
"FileStoreIO": {
"Database": "Server=.;Database=myDatabase;UID=mySa;PWD=myPassword;",
"AppPrefix": "MyAppToScopeTo",
"FilePrefix": "_$",
"DatabaseSchema": "filestore",
"MaxVersions": 5,
"DefaultStorage": "S3",
"S3": {
"AccessKey": "ExampleAccessKey",
"SecretKey": "mysecretkeyinhere+",
"Region": "us-west-2",
"BucketName": "my-example-bucket-name"
},
"Box": {
"EnterpriseID": "123456789",
"AutoCreateRoot": false,
"TimeoutInMins": 15,
"BoxAppSettings": {
"ClientID": "exampleid12345",
"ClientSecret": "examplesecret12345",
"AppAuth": {
"Passphrase": "examplepassphrase12345",
"PrivateKey": "-----BEGIN ENCRYPTED PRIVATE KEY-----\nEXAMPLEEXAMPLEEXMAPLE\n-----END ENCRYPTED PRIVATE KEY-----\n",
"PublicKeyID": "abc1234"
}
}
},
"FileSystem": {
"RootFolder": "c:\\temp\\files\\",
"StoreFileAsUniqueRef": false
}
},
Registering In Startup.cs
Register the service into the DI
public void ConfigureServices(IServiceCollection services)
{
//Inject FileStoreIOClient provider
services.Configure<FileStoreIOConfig>(Configuration.GetSection(FileStoreIOConfig.Section));
services.AddSingleton<Netigent.Utils.FileStoreIO.IFileStoreIOClient, FileStoreIOClient>();
}
Usage in a Controller Example
Utilising in the controller class, the below should give you a good example of how to use the Library
using Netigent.Examples.UploadApp.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Netigent.Utils.FileStoreIO;
using Netigent.Utils.FileStoreIO.Enums;
using System.Threading.Tasks;
namespace Netigent.Examples.UploadApp.Controllers
{
public class HomeController : Controller
{
public readonly IFileStoreIOClient _ioClient;
public HomeController(IFileStoreIOClient fileStoreIOClient)
{
_ioClient = fileStoreIOClient;
}
public async Task<IActionResult> Index()
{
ViewBag.Message = TempData["Message"];
return View(new FileUploadViewModel { Files = await _ioClient.Files_GetAll() });
}
[HttpPost]
[ActionName("Upload")]
public async Task<IActionResult> Upload(IFormFile selectedFile, string location = "database", string description = "", string customerCode = "", string itemType = "")
{
var uploadLocation = (location ?? "").Equals("Database", System.StringComparison.CurrentCultureIgnoreCase) ? FileStorageProvider.Database : FileStorageProvider.FileSystem;
var uploadedCode = await _ioClient.File_UpsertAsync(selectedFile, uploadLocation, description: description, customerCode, itemType);
TempData["Message"] = $"File successfully uploaded to {uploadLocation.ToString()} {uploadedCode}";
//Setting success properties
TempData["FileId"] = uploadedCode;
TempData["FileLink"] = $"https://localhost:44317/Home/GetFile/{uploadedCode}";
//In this case you can now for example render dynamic images from FileStoreIOClient
//e.g. <img src="@TempData["FileLink"]" style="height: 100px; width: auto;" />
return RedirectToAction("Index");
}
public async Task<IActionResult> GetFile(string id)
{
var file = await _ioClient.File_Get(id);
if (file == null) return null;
return File(file.Data, file.ContentType, file.Name);
}
public async Task<IActionResult> DeleteFile(string id)
{
var xyz = await something();
var fileInfo = await _ioClient.File_DeleteAsync(id);
return RedirectToAction("Index");
}
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- AWSSDK.S3 (>= 3.7.412.4)
- BouncyCastle.Cryptography (>= 2.5.0)
- Dapper (>= 2.1.44)
- Microsoft.Extensions.Options (>= 9.0.1)
- Newtonsoft.Json (>= 13.0.3)
- System.Data.SqlClient (>= 4.9.0)
- System.IdentityModel.Tokens.Jwt (>= 8.3.1)
-
net8.0
- AWSSDK.S3 (>= 3.7.412.4)
- BouncyCastle.Cryptography (>= 2.5.0)
- Dapper (>= 2.1.44)
- Microsoft.Extensions.Options (>= 9.0.1)
- Newtonsoft.Json (>= 13.0.3)
- System.Data.SqlClient (>= 4.9.0)
- System.IdentityModel.Tokens.Jwt (>= 8.3.1)
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 |
|---|---|---|
| 1.4.4 | 126 | 1/31/2026 |
| 1.4.3 | 114 | 1/23/2026 |
| 1.4.2 | 102 | 1/23/2026 |
| 1.4.1 | 228 | 12/5/2025 |
| 1.4.0 | 207 | 11/27/2025 |
| 1.3.1 | 215 | 10/28/2025 |
| 1.3.0 | 297 | 8/6/2025 |
| 1.2.1 | 312 | 5/20/2025 |
| 1.2.0 | 207 | 1/24/2025 |
| 1.1.7 | 180 | 1/23/2025 |
| 1.1.6 | 272 | 2/17/2024 |
| 1.1.5 | 239 | 2/15/2024 |
| 1.1.4 | 203 | 2/15/2024 |
| 1.1.3 | 208 | 2/15/2024 |
| 1.1.2 | 210 | 2/15/2024 |
| 1.1.1 | 217 | 2/15/2024 |
| 1.0.14 | 1,619 | 6/2/2023 |
| 1.0.13 | 342 | 3/30/2023 |
| 1.0.12 | 328 | 3/30/2023 |
| 1.0.11 | 367 | 3/16/2023 |