Biostatistics.Contracts 0.151.3

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

// Install Biostatistics.Contracts as a Cake Tool
#tool nuget:?package=Biostatistics.Contracts&version=0.151.3                

Biostatistics

EF Core Commands

Drop Database

dotnet ef database drop --project src/Biostatistics.Infrastructure

Compile Models

dotnet ef dbcontext optimize -c BiostatisticsContext -o ../Biostatistics.Infrastructure/Database/CompiledModels -n Biostatistics.Infrastructure.Database.CompileModels --project src/Biostatistics.Infrastructure --nativeaot

Add Migrations

dotnet ef migrations add <migrationName> --project src/Biostatistics.Infrastructure

Remove Migrations

dotnet ef migrations remove --project src/Biostatistics.Infrastructure

How to Add a Data Source

1. Add Data Source

To add a new data source, follow these steps:

  1. Open the "DataSource.json" file located in the "SeedData/Data" directory within the "Biostatistics.Seeder" project.
  2. Replace <guid>, <nameDataSource>, and <DateTimeInUtcFormat> with appropriate values in the JSON structure:
{
  "DataSourceId": "<guid>",
  "Name": "<nameDataSource>",
  "DataToggle": false,
  "RecordCount": 0,
  "LastUpdated": null,
  "OriginTimeZone": "America/Puerto_Rico",
  "CreatedAt": "<DateTimeInUtcFormat>"
}

2. Add Model

In the "Biostatistics.Domain" project, create a new model with its respective properties using the following steps:

  1. Create a new directory to contain the model.
  2. Design the model class with necessary properties. Ensure mandatory properties such as "Id" and "DataToggle" are included:
public sealed class ModelName
{
    public long Id { get; set; } // Mandatory property
    // Insert other properties
    public bool DataToggle { get; set; } // Mandatory property
}

3. Add ConfigurationModel

In the "Biostatistics.Infrastructure" project, within the "Database/Configurations" directory, add a configuration class for the previously created model using these steps:

  1. Create a class named ModelNameConfiguration implementing IEntityTypeConfiguration<ModelName>.
  2. Configure the model properties and indexes in the Configure method:
public class ModelNameConfiguration : IEntityTypeConfiguration<ModelName>
{
    public void Configure(EntityTypeBuilder<ModelName> entity)
    {
        entity.ToTable("ModelName", "SchemaName");

        entity.HasKey(e => e.Id);

        entity.HasIndex(e => e.DataToggle)
            .HasDatabaseName("ModelName_data_toggle_idx");

        // Add other indexes for other properties
    }
}

4. Add Configuration to the Database Context

Navigate to "BiostatisticsContext.cs" within the "Biostatistics.Infrastructure" project and include the following code snippet inside the class:

public sealed class BiostatisticsContext : DbContext
{
    public BiostatisticsContext(DbContextOptions<BiostatisticsContext> options)
        : base(options) {}

    public DbSet<ModelName> ModelName => Set<ModelName>(); // Add this command
    //... other code
}

In the OnModelCreating method within "BiostatisticsContext.cs", incorporate the configuration for the new model:

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    // other configurations
    modelBuilder.ApplyConfiguration(new ModelNameConfiguration()); // Add this command
}

5. Add Migration

To generate a migration for the newly created model, execute the following command in the terminal:

dotnet ef migrations add <migrationName> --project src/Biostatistics.Infrastructure

Replace <migrationName> with an appropriate name for your migration.

6. Run Compiled Models

Run the compiled models

These steps will assimilate the new model configuration into the database context, create a migration, and execute the compiled models. Replace <ModelName> with your model's actual name.

7. Add ImportClient Dto

Within the "Biostatistics.ImportClient" project, generate a new record representing the previously added model, for instance:

public readonly record struct ModelNameImportDto
( 
  // Model properties
);

8. Add Function to Upload Data Source

In the "BiostatisticsImportClient.cs" file, implement the subsequent method:

public async Task<ImportResultDto> UploadDataSource(IAsyncEnumerable<ModelNameImportDto> dataList)
{
    return await UploadDataToSource(nameof(ModelNameImportDto), dataList);
}

Similarly, add the function declaration in the "BiostatisticsImportClient.cs":

Task<ImportResultDto> UploadDataSource(IAsyncEnumerable<ModelNameImportDto> dataList);

9. Update NuGet Package

Bump new project version and create a Release. This will kick off the CI/CD to publish new versions of the project Nuget package.

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Biostatistics.Contracts:

Package Downloads
Biostatistics.ImportClient

Utilities to import data to Biostatistics Server

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.158.1 175 4 days ago
0.158.0 157 4 days ago
0.157.0 158 4 days ago
0.156.0 179 5 days ago
0.155.0 162 5 days ago
0.154.0 196 5 days ago
0.153.0 403 a month ago
0.152.0 99 a month ago
0.151.3 219 a month ago
0.151.2 91 a month ago
0.151.1 97 a month ago
0.151.0 89 a month ago
0.150.0 168 2 months ago
0.149.0 92 2 months ago
0.148.0 95 2 months ago
0.147.0 288 2 months ago
0.146.0 80 2 months ago
0.145.0 78 2 months ago
0.144.1 439 4 months ago
0.144.0 465 4 months ago
0.143.0 104 4 months ago
0.142.0 99 4 months ago
0.141.0 103 4 months ago
0.140.0 101 4 months ago
0.139.0 102 4 months ago
0.138.1 128 4 months ago
0.138.0 106 4 months ago
0.137.1 165 4 months ago
0.137.0 102 4 months ago
0.136.0 141 5 months ago
0.135.1 112 5 months ago
0.135.0 117 5 months ago
0.134.3 701 6 months ago
0.134.2 172 6 months ago
0.134.1 120 6 months ago
0.134.0 220 6 months ago
0.133.0 153 6 months ago
0.132.0 125 6 months ago
0.131.0 134 6 months ago
0.130.0 121 6 months ago
0.129.1 130 6 months ago
0.128.0 188 6 months ago
0.127.1 194 6 months ago
0.127.0 146 6 months ago
0.126.0 190 6 months ago