Biostatistics.Contracts
0.130.0
See the version list below for details.
dotnet add package Biostatistics.Contracts --version 0.130.0
NuGet\Install-Package Biostatistics.Contracts -Version 0.130.0
<PackageReference Include="Biostatistics.Contracts" Version="0.130.0" />
paket add Biostatistics.Contracts --version 0.130.0
#r "nuget: Biostatistics.Contracts, 0.130.0"
// Install Biostatistics.Contracts as a Cake Addin #addin nuget:?package=Biostatistics.Contracts&version=0.130.0 // Install Biostatistics.Contracts as a Cake Tool #tool nuget:?package=Biostatistics.Contracts&version=0.130.0
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:
- Open the "DataSource.json" file located in the "SeedData/Data" directory within the "Biostatistics.Seeder" project.
- 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:
- Create a new directory to contain the model.
- 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:
- Create a class named
ModelNameConfiguration
implementingIEntityTypeConfiguration<ModelName>
. - 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 | Versions 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. |
-
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.144.0 | 334 | 10/31/2024 |
0.143.0 | 81 | 10/30/2024 |
0.142.0 | 79 | 10/30/2024 |
0.141.0 | 85 | 10/30/2024 |
0.140.0 | 81 | 10/29/2024 |
0.139.0 | 79 | 10/29/2024 |
0.138.1 | 104 | 10/28/2024 |
0.138.0 | 86 | 10/28/2024 |
0.137.1 | 145 | 10/24/2024 |
0.137.0 | 82 | 10/24/2024 |
0.136.0 | 119 | 10/23/2024 |
0.135.1 | 86 | 10/23/2024 |
0.135.0 | 92 | 10/23/2024 |
0.134.3 | 670 | 9/21/2024 |
0.134.2 | 157 | 9/18/2024 |
0.134.1 | 102 | 9/17/2024 |
0.134.0 | 202 | 9/16/2024 |
0.133.0 | 137 | 9/15/2024 |
0.132.0 | 111 | 9/14/2024 |
0.131.0 | 118 | 9/14/2024 |
0.130.0 | 107 | 9/14/2024 |
0.129.1 | 114 | 9/14/2024 |
0.128.0 | 175 | 9/8/2024 |
0.127.1 | 182 | 9/7/2024 |
0.127.0 | 133 | 9/7/2024 |
0.126.0 | 169 | 9/5/2024 |