BulkDataSeeder.EfCore 1.0.4

dotnet add package BulkDataSeeder.EfCore --version 1.0.4
NuGet\Install-Package BulkDataSeeder.EfCore -Version 1.0.4
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="BulkDataSeeder.EfCore" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BulkDataSeeder.EfCore --version 1.0.4
#r "nuget: BulkDataSeeder.EfCore, 1.0.4"
#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 BulkDataSeeder.EfCore as a Cake Addin
#addin nuget:?package=BulkDataSeeder.EfCore&version=1.0.4

// Install BulkDataSeeder.EfCore as a Cake Tool
#tool nuget:?package=BulkDataSeeder.EfCore&version=1.0.4

BulkDataSeeder.EfCore

Introduction :

BulkDataSeeder.EfCore is a versatile library that simplifies the process of seeding data into multiple database systems using Entity Framework Core. It supports SQL Server, MySQL, and PostgreSQL, making it an ideal choice for projects with diverse database requirements.

GetStarted

Features

  • Multi-Database Support: Seamlessly seed data into SQL Server, MySQL, and PostgreSQL databases.
  • Entity Framework Core Integration: Utilizes the power of Entity Framework Core for efficient data operations.
  • Easy Configuration: Simple setup and configuration using JSON files.
  • Bulk Insert or Update: Efficiently inserts or updates data in bulk, reducing database round-trips.

Installation

You can install this package via NuGet. Use the following command:

nuget install BulkDataSeeder.EfCore

Prerequisties

Install the appropriate database packages and configure this code in Startup.cs

var dbContext = new YourDbContext();

var dataSeeder = new DataSeeder<YourDbContext>(dbContext);

  • Initialize your Entity Framework Core DbContext and use the below code

  • Prepare Your Data

  • Create CSV files for each table you want to seed and store them in a directory (e.g., "YOUR").

  • Create a JSON configuration file (e.g., "YOUR-CSV-ORDER-CONFIGURATION_FILE_NAME.json") that specifies the order in which the CSV files should be processed.

  • Sample JSON Configuration

[
  {
    "FileName": "Table1.csv",
    "Order": 1
  },
  {
    "FileName": "Table2.csv",
    "Order": 2
  }
]

  • Create a DataSeeder instance
using (var dbContext = new YourDbContext(options))
{
    var dataseeder = new DataSeeder<AppDbContext>(dbContext);
    string fullPath = Path.Combine(Directory.GetCurrentDirectory(), "YOUR-CSV-FOLDER-NAME");

    if (!Directory.Exists(fullPath))
    {
        Console.WriteLine($"Directory not found: {fullPath}");
        return;
    }

    // Read the configuration file
    string configFile = Path.Combine(fullPath, "YOUR-CSV-ORDER-CONFIGURATION_FILE_NAME");

    if (!File.Exists(configFile))
    {
        Console.WriteLine($"Configuration file not found: {configFile}");
        return;
    }
    dataseeder.PublishCsvData(fullPath, configFile);
}

Enjoy Bulk Seeding

BulkDataSeeder.EfCore will efficiently insert or update data in your specified databases, using the appropriate SQL statements for each database system.

Contributing

Contributions are welcome! If you encounter issues or have suggestions for improvements, please open an issue or create a pull request on our GitHub repository.

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.0.4 293 10/15/2023
1.0.3 113 9/26/2023
1.0.2 106 9/21/2023
1.0.1 117 9/18/2023
1.0.0 124 9/12/2023

BulkDataSeeder.EfCore is a versatile library that simplifies the process of seeding data into multiple database systems using Entity Framework Core. It supports SQL Server, MySQL, and PostgreSQL, making it an ideal choice for projects with diverse database requirements.