Rystem.Content.Abstractions 5.0.2

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

// Install Rystem.Content.Abstractions as a Cake Tool
#tool nuget:?package=Rystem.Content.Abstractions&version=5.0.2                

What is Rystem?

Content Repository Abstractions

You may use this library to help the integration with your business and your several storage repositories.

Dependency injection

services
    .AddContentRepository()
    .WithIntegration<SimpleIntegration>("example", ServiceLifetime.Singleton);

with integration class

internal sealed class SimpleIntegration : IContentRepository
{
    public ValueTask<bool> DeleteAsync(string path, CancellationToken cancellationToken = default)
    {
        throw new NotImplementedException();
    }

    public Task<ContentRepositoryDownloadResult?> DownloadAsync(string path, ContentInformationType informationRetrieve = ContentInformationType.None, CancellationToken cancellationToken = default)
    {
        throw new NotImplementedException();
    }

    public ValueTask<bool> ExistAsync(string path, CancellationToken cancellationToken = default)
    {
        throw new NotImplementedException();
    }

    public Task<ContentRepositoryResult?> GetPropertiesAsync(string path, ContentInformationType informationRetrieve = ContentInformationType.All, CancellationToken cancellationToken = default)
    {
        throw new NotImplementedException();
    }

    public IAsyncEnumerable<ContentRepositoryDownloadResult> ListAsync(string? prefix = null, bool downloadContent = false, ContentInformationType informationRetrieve = ContentInformationType.None, CancellationToken cancellationToken = default)
    {
        throw new NotImplementedException();
    }

    public void SetName(string name)
    {
        throw new NotImplementedException();
    }

    public ValueTask<bool> SetPropertiesAsync(string path, ContentRepositoryOptions? options = null, CancellationToken cancellationToken = default)
    {
        throw new NotImplementedException();
    }

    public ValueTask<bool> UploadAsync(string path, byte[] data, ContentRepositoryOptions? options = null, bool overwrite = true, CancellationToken cancellationToken = default)
    {
        throw new NotImplementedException();
    }
}

How to use

If you have only one integration installed at once, you may inject directly

public sealed class SimpleBusiness
{
    private readonly IContentRepository _contentRepository;

    public SimpleBusiness(IContentRepository contentRepository)
    {
        _contentRepository = contentRepository;
    }
}

In case of multiple integrations you have to use the factory service

DI

services
    .AddContentRepository()
    .WithIntegration<SimpleIntegration>("example", ServiceLifetime.Singleton);
    .WithIntegration<SimpleIntegration2>("example2", ServiceLifetime.Singleton);

in Business class to use the first integration

public sealed class SimpleBusiness
{
    private readonly IContentRepository _contentRepository;

    public SimpleBusiness(IContentRepositoryFactory contentRepositoryFactory)
    {
        _contentRepository = contentRepositoryFactory.Create("example");
    }
}

in Business class to use the second integration

public sealed class SimpleBusiness
{
    private readonly IContentRepository _contentRepository;

    public SimpleBusiness(IContentRepositoryFactory contentRepositoryFactory)
    {
        _contentRepository = contentRepositoryFactory.Create("example2");
    }
}

Migration tool

You can migrate from two different sources. For instance from a blob storage to a sharepoint site document library.

Setup in DI

 services
    .AddSingleton<Utility>()
    .AddContentRepository()
    .WithBlobStorageIntegrationAsync(x =>
    {
        x.ContainerName = "supertest";
        x.Prefix = "site/";
        x.ConnectionString = configuration["ConnectionString:Storage"];
    },
    "blobstorage")
    .ToResult()
    .WithInMemoryIntegration("inmemory")
    .WithSharepointIntegrationAsync(x =>
    {
        x.TenantId = configuration["Sharepoint:TenantId"];
        x.ClientId = configuration["Sharepoint:ClientId"];
        x.ClientSecret = configuration["Sharepoint:ClientSecret"];
        x.MapWithSiteNameAndDocumentLibraryName("TestNumberOne", "Foglione");
    }, "sharepoint")
    .ToResult();

Usage

var result = await _contentMigration.MigrateAsync("blobstorage", "sharepoint",
    settings =>
    {
        settings.OverwriteIfExists = true;
        settings.Prefix = prefix;
        settings.Predicate = (x) =>
        {
            return x.Path?.Contains("fileName6") != true;
        };
        settings.ModifyDestinationPath = x =>
        {
            return x.Replace("Folder2", "Folder3");
        };
    }).NoContext();    
Product Compatible and additional computed target framework versions.
.NET 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 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 (4)

Showing the top 4 NuGet packages that depend on Rystem.Content.Abstractions:

Package Downloads
Rystem.Content.Infrastructure.Storage.Blob

Rystem.Content helps you to integrate with azure services or to create an abstraction layer among your infrastructure and your business.

Rystem.Content.Infrastructure.M365.Sharepoint

Rystem.Content helps you to integrate with azure services or to create an abstraction layer among your infrastructure and your business.

Rystem.Content.Infrastructure.InMemory

Rystem.Content helps you to integrate with azure services or to create an abstraction layer among your infrastructure and your business.

Rystem.Content.Infrastructure.Storage.File

Rystem.Content helps you to integrate with azure services or to create an abstraction layer among your infrastructure and your business.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
9.0.0-rc.1 109 10/18/2024
6.2.0 181,954 10/9/2024
6.1.1 115 10/9/2024
6.1.0 47,932 9/29/2024
6.0.24 171 9/11/2024
6.0.23 340,069 7/18/2024
6.0.21 150 6/18/2024
6.0.20 727,354 6/16/2024
6.0.19 30,557 6/14/2024
6.0.18 145 6/14/2024
6.0.17 139 6/14/2024
6.0.16 50,015 6/10/2024
6.0.15 142 6/9/2024
6.0.14 94,503 5/24/2024
6.0.13 162 5/23/2024
6.0.12 144 5/23/2024
6.0.11 161 5/20/2024
6.0.9 167 5/19/2024
6.0.7 151 5/18/2024
6.0.6 154 5/10/2024
6.0.5 159 5/10/2024
6.0.4 550,000 4/3/2024
6.0.3 177 3/25/2024
6.0.2 254 3/11/2024
6.0.1 121 3/8/2024
6.0.0 318 11/21/2023
6.0.0-rc.6 103 10/25/2023
6.0.0-rc.5 79 10/25/2023
6.0.0-rc.4 75 10/23/2023
6.0.0-rc.3 65 10/19/2023
6.0.0-rc.2 86 10/18/2023
6.0.0-rc.1 87 10/16/2023
5.0.20 417 9/25/2023
5.0.19 794 9/10/2023
5.0.18 241 9/6/2023
5.0.17 216 9/6/2023
5.0.16 221 9/5/2023
5.0.15 232 9/5/2023
5.0.14 214 9/5/2023
5.0.13 325 9/1/2023
5.0.12 196 8/31/2023
5.0.11 206 8/30/2023
5.0.10 212 8/29/2023
5.0.9 222 8/24/2023
5.0.8 211 8/24/2023
5.0.7 227 8/23/2023
5.0.6 233 8/21/2023
5.0.5 238 8/21/2023
5.0.4 233 8/16/2023
5.0.3 410 8/2/2023
5.0.2 233 8/2/2023
5.0.1 218 8/1/2023
5.0.0 228 7/31/2023
4.0.6 243 7/20/2023
4.0.4 278 7/10/2023
4.0.3 202 7/10/2023
4.0.2 145 7/7/2023
4.0.1 195 7/7/2023