Sufficit.EFData 1.26.430.2043

dotnet add package Sufficit.EFData --version 1.26.430.2043
                    
NuGet\Install-Package Sufficit.EFData -Version 1.26.430.2043
                    
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="Sufficit.EFData" Version="1.26.430.2043" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sufficit.EFData" Version="1.26.430.2043" />
                    
Directory.Packages.props
<PackageReference Include="Sufficit.EFData" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Sufficit.EFData --version 1.26.430.2043
                    
#r "nuget: Sufficit.EFData, 1.26.430.2043"
                    
#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.
#:package Sufficit.EFData@1.26.430.2043
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Sufficit.EFData&version=1.26.430.2043
                    
Install as a Cake Addin
#tool nuget:?package=Sufficit.EFData&version=1.26.430.2043
                    
Install as a Cake Tool

<h1> Sufficit.EFData <a href="https://github.com/sufficit"><img src="https://avatars.githubusercontent.com/u/66928451?s=200&v=4" alt="Sufficit Logo" width="80" align="right"></a> </h1>

NuGet Version .NET Standard License: MIT

Entity Framework Data Providers for Sufficit Ecosystem

A comprehensive .NET library that provides Entity Framework-based data access providers for the Sufficit platform. This library implements the Provider Architecture Pattern with extension methods for optimal performance and maintainability.

πŸ“‹ Table of Contents

  • About
  • Features
  • Architecture
  • Installation
  • Usage
  • Modules
  • Configuration
  • Development
  • Contributing
  • License

πŸ“– About

Sufficit.EFData is a core component of the Sufficit ecosystem, providing standardized data access patterns using Entity Framework Core. The library implements a consistent provider architecture that ensures:

  • Multi-target Framework Support: Compatible with .NET Standard 2.0, .NET 6.0, 7.0, 8.0, and 9.0
  • Provider Pattern: Clean separation between data access logic and business logic
  • Extension Methods: Convenient query methods without additional abstraction layers
  • Dependency Injection: Seamless integration with Microsoft.Extensions.DependencyInjection
  • Database Agnostic: Support for multiple database providers (MySQL, SQL Server, etc.)

Key Principles

  1. Single Responsibility: Each provider handles one specific domain
  2. Extension Methods: Business logic extensions without repository overhead
  3. Scoped Contexts: Proper DbContext lifecycle management
  4. Consistent API: Uniform interface across all providers

✨ Features

πŸ”§ Core Features

  • Multi-Framework Targeting: Supports .NET Standard 2.0+ and modern .NET versions
  • Provider Architecture: Clean separation of data access concerns
  • Extension Methods: Fluent API for complex queries
  • Dependency Injection: Native support for IServiceCollection
  • Database Providers: MySQL, SQL Server, and PostgreSQL support
  • Migration Tools: Built-in database migration utilities

πŸ“Š Domain Modules

  • Exchange: Email tracking, message templates, and communication logs
  • Identity: User management and authentication data
  • Contacts: Customer and contact information management
  • Telephony: Call records, CDR data, and telephony operations
  • Finance: Billing, payments, and financial transactions
  • Statistics: Analytics and reporting data
  • Storage: File and media storage management
  • Tasks: Background job and task management

πŸ› οΈ Developer Experience

  • IntelliSense Support: Full IDE integration
  • Comprehensive Documentation: Detailed API documentation
  • Code Examples: Practical usage samples
  • Migration Tools: Database schema management
  • Testing Support: Unit testing utilities

πŸ—οΈ Architecture

Provider Pattern Implementation

Sufficit.EFData/
β”œβ”€β”€ EFProvider<TContext>          # Abstract base provider
β”œβ”€β”€ ScopedProvider               # Scoped service management
β”œβ”€β”€ Extension Methods            # Query extensions
└── DbContext Implementations    # Database contexts

Key Components

EFProvider Base Class
public abstract class EFProvider<DBContext> : ScopedProvider
    where DBContext : Microsoft.EntityFrameworkCore.DbContext
{
    protected EFProvider(IServiceScopeFactory serviceScopeFactory)
        : base(serviceScopeFactory) { }

    protected DBContext CreateDbContext(IServiceScope scope)
        => scope.ServiceProvider.GetRequiredService<DBContext>();
}
Extension Methods Pattern
public static class EFMessageTemplateProviderExtensions
{
    public static async Task<MessageTemplate?> GetByTitleAsync(
        this EFMessageTemplateProvider provider,
        string title,
        CancellationToken cancellationToken = default)
    {
        return await provider.Search(new MessageTemplateSearchParameters
        {
            Title = title
        }).FirstOrDefaultAsync(cancellationToken);
    }
}

Database Context Management

  • Scoped Lifetime: DbContext instances are properly scoped
  • Connection Pooling: Efficient database connection management
  • Transaction Support: ACID transaction handling
  • Migration Support: Automatic schema updates

πŸ“¦ Installation

NuGet Package

# Install via NuGet
dotnet add package Sufficit.EFData

# Or via Package Manager
Install-Package Sufficit.EFData

Package Reference

<PackageReference Include="Sufficit.EFData" Version="1.0.0" />

Prerequisites

  • .NET Standard 2.0+ or .NET 6.0+
  • Entity Framework Core packages
  • Database Provider (MySQL, SQL Server, etc.)

πŸš€ Usage

Basic Setup

// Program.cs or Startup.cs
using Microsoft.Extensions.DependencyInjection;
using Sufficit.EFData;

public void ConfigureServices(IServiceCollection services)
{
    // Add database context
    services.AddDbContext<ExchangeDbContext>(options =>
        options.UseMySql(connectionString,
            new MySqlServerVersion(new Version(8, 0, 21))));

    // Register providers
    services.AddSufficitEFData();
}

Using Providers

public class MessageService
{
    private readonly EFMessageTemplateProvider _provider;

    public MessageService(EFMessageTemplateProvider provider)
    {
        _provider = provider;
    }

    public async Task<MessageTemplate?> GetTemplateAsync(string title)
    {
        // Using extension method
        return await _provider.GetByTitleAsync(title);
    }

    public async Task<IEnumerable<MessageTemplate>> SearchTemplatesAsync(
        string? searchTerm = null,
        int page = 1,
        int pageSize = 20)
    {
        // Using base Search method
        return await _provider.Search(new MessageTemplateSearchParameters
        {
            Title = searchTerm,
            Paging = new PagingParameters { Page = page, PageSize = pageSize }
        }).ToListAsync();
    }
}

Advanced Queries

public async Task<IEnumerable<MessageTemplate>> GetActiveTemplatesAsync()
{
    return await _provider.Search(new MessageTemplateSearchParameters
    {
        IsActive = true,
        Sorting = new SortingParameters
        {
            SortBy = "CreatedAt",
            SortDirection = SortDirection.Descending
        }
    }).ToListAsync();
}

πŸ“š Modules

Exchange Module

Handles email templates, message tracking, and communication logs.


// Usage
public class EmailService
{
    private readonly EFMessageTemplateProvider _templateProvider;
    private readonly EFEMailTrackingProvider _trackingProvider;

    public async Task SendTemplatedEmailAsync(string templateTitle, string recipient)
    {
        var template = await _templateProvider.GetByTitleAsync(templateTitle);
        if (template == null) return;

        // Send email logic here
        await _trackingProvider.TrackEmailAsync(template.Id, recipient);
    }
}

Identity Module

Manages user authentication and authorization data.

// Register Identity providers
services.AddSufficitIdentityProviders();

// Usage
public class UserService
{
    private readonly EFIdentityProvider _identityProvider;

    public async Task<User?> AuthenticateAsync(string username, string password)
    {
        return await _identityProvider.AuthenticateAsync(username, password);
    }
}

Telephony Module

Handles call records, CDR data, and telephony operations.

// Register Telephony providers
services.AddSufficitTelephonyProviders();

// Usage
public class CallService
{
    private readonly EFCallRecordProvider _callProvider;

    public async Task<IEnumerable<CallRecord>> GetRecentCallsAsync(string extension)
    {
        return await _callProvider.Search(new CallRecordSearchParameters
        {
            Extension = extension,
            DateRange = new DateTimeRange
            {
                Start = DateTime.UtcNow.AddDays(-7),
                End = DateTime.UtcNow
            }
        }).ToListAsync();
    }
}

βš™οΈ Configuration

Connection Strings

{
  "ConnectionStrings": {
    "ExchangeDb": "Server=localhost;Database=exchange;User=user;Password=password;",
    "IdentityDb": "Server=localhost;Database=identity;User=user;Password=password;",
    "TelephonyDb": "Server=localhost;Database=telephony;User=user;Password=password;"
  }
}

Service Registration

public void ConfigureServices(IServiceCollection services)
{
    // Database contexts
    services.AddDbContext<ExchangeDbContext>(options =>
        options.UseMySql(Configuration.GetConnectionString("ExchangeDb"),
            new MySqlServerVersion(new Version(8, 0, 21))));

    services.AddDbContext<IdentityDbContext>(options =>
        options.UseSqlServer(Configuration.GetConnectionString("IdentityDb")));

    // Providers
    services.AddSufficitEFData();
}

Migration Setup

// In Program.cs
using Microsoft.EntityFrameworkCore;

var app = builder.Build();

// Apply migrations
using (var scope = app.Services.CreateScope())
{
    var dbContext = scope.ServiceProvider.GetRequiredService<ExchangeDbContext>();
    await dbContext.Database.MigrateAsync();
}

πŸ’» Development

Project Structure

Sufficit.EFData/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ EFProvider.cs              # Base provider class
β”‚   β”œβ”€β”€ ScopedProvider.cs          # Scoped service management
β”‚   β”œβ”€β”€ DEFAULT.cs                 # Constants and utilities
β”‚   β”œβ”€β”€ Exchange/                  # Exchange domain providers
β”‚   β”œβ”€β”€ Identity/                  # Identity domain providers
β”‚   β”œβ”€β”€ Telephony/                 # Telephony domain providers
β”‚   β”œβ”€β”€ Contacts/                  # Contacts domain providers
β”‚   β”œβ”€β”€ Finance/                   # Finance domain providers
β”‚   └── Extensions/                # Extension methods
β”œβ”€β”€ tests/                         # Unit tests
β”œβ”€β”€ docs/                          # Documentation
└── migrations-tool/              # Migration utilities

Building the Project

# Restore dependencies
dotnet restore

# Build for all target frameworks
dotnet build --configuration Release

# Run tests
dotnet test

# Create NuGet package
dotnet pack --configuration Release

Testing

// Example unit test
[Fact]
public async Task GetByTitleAsync_ReturnsCorrectTemplate()
{
    // Arrange
    var options = new DbContextOptionsBuilder<ExchangeDbContext>()
        .UseInMemoryDatabase(databaseName: "TestDb")
        .Options;

    using var context = new ExchangeDbContext(options);
    var provider = new EFMessageTemplateProvider(context);

    // Act
    var result = await provider.GetByTitleAsync("Welcome Email");

    // Assert
    Assert.NotNull(result);
    Assert.Equal("Welcome Email", result.Title);
}

🀝 Contributing

We welcome contributions! Please follow these guidelines:

Development Setup

  1. Fork the repository

  2. Clone your fork

    git clone https://github.com/yourusername/sufficit-efdata.git
    cd sufficit-efdata
    
  3. Create a feature branch

    git checkout -b feature/new-provider
    
  4. Make your changes

  5. Add tests for new functionality

  6. Ensure all tests pass

    dotnet test
    
  7. Submit a pull request

Code Standards

  • Follow C# coding conventions
  • Use meaningful variable and method names
  • Add XML documentation comments
  • Write unit tests for new features
  • Ensure code coverage > 80%

Commit Messages

Use conventional commit format:

feat: add new email tracking provider
fix: resolve connection timeout issue
docs: update API documentation
test: add unit tests for message templates

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


Developed by Sufficit SoluΓ§Γ΅es em Tecnologia da InformaΓ§Γ£o

For more information, visit our GitHub repository or contact development@sufficit.com.br.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  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 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.  net9.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Sufficit.EFData:

Package Downloads
Sufficit.Communication

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.26.430.2043 26 4/30/2026
1.26.415.353 108 4/15/2026
1.26.402.1343 156 4/2/2026
1.26.331.1955 100 3/31/2026
1.26.330.1254 114 3/30/2026
1.26.327.2021 101 3/27/2026
1.26.325.1643 143 3/25/2026
1.26.324.255 94 3/24/2026
1.26.319.1856 142 3/19/2026
1.26.313.1917 224 3/13/2026
1.26.306.1250 104 3/6/2026
1.26.304.2055 102 3/4/2026
1.26.302.1922 105 3/2/2026
1.26.227.150 109 2/27/2026
1.26.215.2041 180 2/15/2026
1.26.212.415 160 2/12/2026
1.26.210.1949 121 2/10/2026
1.26.108.1848 298 1/8/2026
1.25.919.2019 379 9/19/2025
1.25.917.252 375 9/17/2025
Loading failed