WeCanLibrary 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package WeCanLibrary --version 1.0.0                
NuGet\Install-Package WeCanLibrary -Version 1.0.0                
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="WeCanLibrary" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WeCanLibrary --version 1.0.0                
#r "nuget: WeCanLibrary, 1.0.0"                
#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 WeCanLibrary as a Cake Addin
#addin nuget:?package=WeCanLibrary&version=1.0.0

// Install WeCanLibrary as a Cake Tool
#tool nuget:?package=WeCanLibrary&version=1.0.0                

WeCanLibrary

A single library to support multiple dotnet application features.

Projects

  1. WeCanLibrary is a Class Library written in dotnet6 and is the main project of this solution.
  2. WeCanLibrary.IntegrationTests is a WebApi project in dotnet6 to install and perform integration tests on the package
  3. WeCanLibrary.UnitTests is a XUnit Test project to cover the libary with good unit test coverage

Supports Api Key Authentication

The WeCanLibrary supports ApiKey authentication.

Configuration

  1. Install the package WeCanLibrary using Nuget Package Manager
  2. Add the below configuration in the appsettings.json
"ApiKeyConfiguration": {
    "ApiKey": "<<your_api_key>>"
  }
  1. Add the AzureBlobHandlerService in the Program.cs using below code
builder.Services.AddApiKeyAuthentication(configuration);

Procedure

  1. The requests made to API needs to have a header with a key X-API-KEY and a value assigned to it
  2. The library expects a configuration section which contains the ApiKey
  3. The WeCanLibrary reads the request and retrieves the ApiKey value
  4. It then validates the retreived value with the configured value
  5. Authorization result is returned based on the validation result

Supports Azure Blob Service

The WeCanLibrary supports file handling using Azure Blob service.

Pre-requisites

  1. Microsoft Azure Blob container with a ConnectionString. You can learn more about configuring connection string for Azure Storage account here
  2. Dotnet6 application

Configuration

  1. Install the package WeCanLibrary using Nuget Package Manager
  2. Add the below configuration in the appsettings.json
"AzureBlobConfiguration": {
    "ConnectionString": "<<Your_Azure_Blob_Connection_String>>"
  }
  1. Add the AzureBlobHandlerService in the Program.cs using below code
builder.Services.AddAzureBlobHandlerService(configuration);

Procedure

  1. Inject the IAzureBlobHandlerService interface in the target service.
  2. Invoke the methods UploadBlob, DownloadBlob and DeleteBlob for Uploading, Downloading and Deleting the blobs
  3. For uploading the file to the blob container, the library requires
    • Container Name
    • MemoryStream of the file to be processed
  4. For downloading and deleting the file from blob container, the lobrary requires
    • Container Name
    • Blob Name
  5. The response from the service contains the
    • IsSuccess flag indicating whether the transaction is successful or not
    • Blob - Contains the memory stream of the downloaded file
    • Error - Contains the exception which occurred during the process
    • Message - Transaction message
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 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 was computed.  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
1.2.0 161 5/27/2023
1.0.0 157 5/27/2023

Initial Cut