Semantica.Lib.Domain.Data 8.1.0-beta

This is a prerelease version of Semantica.Lib.Domain.Data.
dotnet add package Semantica.Lib.Domain.Data --version 8.1.0-beta
                    
NuGet\Install-Package Semantica.Lib.Domain.Data -Version 8.1.0-beta
                    
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="Semantica.Lib.Domain.Data" Version="8.1.0-beta" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Semantica.Lib.Domain.Data" Version="8.1.0-beta" />
                    
Directory.Packages.props
<PackageReference Include="Semantica.Lib.Domain.Data" />
                    
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 Semantica.Lib.Domain.Data --version 8.1.0-beta
                    
#r "nuget: Semantica.Lib.Domain.Data, 8.1.0-beta"
                    
#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 Semantica.Lib.Domain.Data@8.1.0-beta
                    
#: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=Semantica.Lib.Domain.Data&version=8.1.0-beta&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Semantica.Lib.Domain.Data&version=8.1.0-beta&prerelease
                    
Install as a Cake Tool

Semantica.Lib.Domain.Data

This package is part of the design packages of Semantica.Lib.

Summary

Provides (base class) implementations of the repository interfaces from Semantica.Lib.Domain. These implementations generally assume a strict separation between the domain-level entity models and storable counterparts used in the storage (persistence) layer. For this, the repository base classes are dependent on injected implementations of the converter interfaces also provided in this package. The repository base is also dependent on an injected IDataStore for the entity's storage type, and a IPropertyAnalyser which is used to identify immutable properties on the storable model. Those properties will be ignored when doing replaces/updates using the default implementations. The package provides a default implementation for this interface that utilizes the ImmutableAttribute from the Semantica.Lib.Storage.Attributes namespace.

The repository base classes will implement all standard IRepository members, while additional required custom members can be easily added.

Usage

For each storable entity in your system, a repository is probably wanted.

If this separation is unwanted, there is a generic implementation DomainIsStorageConverter that just passes the input back to the output.

Dependencies

  • Semantica.Lib.Checks
  • Semantica.Lib.Core
  • Semantica.Lib.Domain
  • Semantica.Lib.Extensions
  • Semantica.Lib.Linq
  • Semantica.Lib.Patterns
  • Semantica.Lib.Patterns.Converters
  • Semantiva.Lib.Storage

Documentation generated from the XMLDoc:

<a name='assembly'></a>

Lib.Domain.Data

Contents

<a name='T-Semantica-Domain-Data-Repositories-AddRemoveRepositoryBase`4'></a>

AddRemoveRepositoryBase`4 type

Namespace

Semantica.Domain.Data.Repositories

Summary

Inherit from parent.

Summary

Base class that provides default implementations for all methods of IAddRemoveRepository`3.

Generic Types
Name Description
TStorable Type of the storable used to represent the entity or value object.
Remarks

Use when different model types are used for add and read methods.

<a name='T-Semantica-Domain-Data-DomainStorageConverters-DomainIsStorageConverter`2'></a>

DomainIsStorageConverter`2 type

Namespace

Semantica.Domain.Data.DomainStorageConverters

Summary

Generic implementation for IDomainStorageConverter`3, used when TStorable and TDomain are the same type (i.e., the storage type is also used as domain type). The implementation requires injecting a IKeyConverter`2.

Generic Types
Name Description
TDomain Model type used for storage and domain.
TKey Primary key type for the entity or value object in domain.

<a name='T-Semantica-Domain-Data-DomainStorageConverters-IAddRemoveReadConverter`3'></a>

IAddRemoveReadConverter`3 type

Namespace

Semantica.Domain.Data.DomainStorageConverters

Summary

Converter interface used by the base repository to convert storables to domain models and back of one entity or value object. This is the full interface required by AddRemoveRepositoryBase`4 base class.

Generic Types
Name Description
TStorable Storable (entity) type.
TDomain Domain model type.
TKey Primary key type for the entity or value object in domain.
Remarks

Use when the same model type is used for add and read methods.

<a name='T-Semantica-Domain-Data-DomainStorageConverters-IAddRemoveReadConverter`4'></a>

IAddRemoveReadConverter`4 type

Namespace

Semantica.Domain.Data.DomainStorageConverters

Summary

Converter interface used by the base repository to convert storables to domain models and back of one entity or value object. This is the full interface required by AddRemoveRepositoryBase`4 base class.

Generic Types
Name Description
TStorable Storable (entity) type.
TDomainOut Domain model type.
TDomainAdd Domain model type used for creation.
TKey Primary key type for the entity or value object in domain.
Remarks

Use when different model types are used for add and read methods.

<a name='T-Semantica-Domain-Data-DomainStorageConverters-IAggregationStorageConverter`2'></a>

IAggregationStorageConverter`2 type

Namespace

Semantica.Domain.Data.DomainStorageConverters

Summary

Converter interface to convert storables to domain models of one entity or value object. The domain model type is the type used as the aggregation domain model. i.e. a model type with properties that reference other domain model types, and is not used in the repository.

Generic Types
Name Description
TStorable Storable (entity) type.
TDomain Aggregation domain model type.
Remarks

Implement this interface on a domain storage converter when you have an aggregation model type, and use it in your aggregators.

<a name='M-Semantica-Domain-Data-DomainStorageConverters-IAggregationStorageConverter2-ToAggregation-0-'></a>

ToAggregation() method

Summary

Converts a storable to its domain representation.

Returns

Domain model instance.

Parameters

This method has no parameters.

<a name='T-Semantica-Domain-Data-DomainStorageConverters-ICommonPropertyDomainConverter`2'></a>

ICommonPropertyDomainConverter`2 type

Namespace

Semantica.Domain.Data.DomainStorageConverters

Summary

Converter interface that is not directly used by repository base classes, but can be helpful as a way to standarize common property assignment in converters when multiple ToStorage implementations are needed.

Generic Types
Name Description
TStorable Type of the storable.
TDomainCommon Domain base class/interface that has the common properties.

<a name='M-Semantica-Domain-Data-DomainStorageConverters-ICommonPropertyDomainConverter2-SetCommonDomainProperties-1,`0-'></a>

SetCommonDomainProperties(domainModel,storable) method

Summary

Sets the properties on domainModel that can be accessed through the TDomainCommon type.

Parameters
Name Type Description
domainModel `1 Domain model instance (as base type) to set the properties on.
storable `0 Storable instance to get the values from.

<a name='T-Semantica-Domain-Data-DomainStorageConverters-ICommonPropertyStorageConverter`2'></a>

ICommonPropertyStorageConverter`2 type

Namespace

Semantica.Domain.Data.DomainStorageConverters

Summary

Converter interface that is not directly used by repository base classes, but can be helpful as a way to standarize common property assignment in converters when multiple ToStorage implementations are needed.

Generic Types
Name Description
TStorable Type of the storable.
TDomainCommon Domain base class/interface that has the common properties.

<a name='M-Semantica-Domain-Data-DomainStorageConverters-ICommonPropertyStorageConverter2-SetCommonStorageProperties-0,`1-'></a>

SetCommonStorageProperties(storable,domainModel) method

Summary

Sets the properties on storable that can be accessed through the TDomainCommon type.

Parameters
Name Type Description
storable `0 Storable instance to set the properties on.
domainModel `1 Domain model instance (as base type) to get the values from.

<a name='T-Semantica-Domain-Data-DomainStorageConverters-IDomainConverter`2'></a>

IDomainConverter`2 type

Namespace

Semantica.Domain.Data.DomainStorageConverters

Summary

Converter interface used by the base repository to convert domain models to storables of one entity or value object.

Generic Types
Name Description
TStorable Storable (entity) type.
TDomain Domain model type.

<a name='M-Semantica-Domain-Data-DomainStorageConverters-IDomainConverter2-ToStorable-1-'></a>

ToStorable() method

Summary

Converts a domain model instance to its storable representation.

Returns

Storable instance.

Parameters

This method has no parameters.

<a name='T-Semantica-Domain-Data-DomainStorageConverters-IDomainStorageConverter`3'></a>

IDomainStorageConverter`3 type

Namespace

Semantica.Domain.Data.DomainStorageConverters

Summary

Converter interface used by the base repository to convert storables to domain models and back of one entity or value object. This is the full interface required by RepositoryBase`3 base class.

Generic Types
Name Description
TStorable Storable type
TDomain Confined domain model type
TKey Primary key type for entity/model
Remarks

Use when the same model type is used for add, replace and read methods.

<a name='T-Semantica-Domain-Data-DomainStorageConverters-IDomainStorageConverter`4'></a>

IDomainStorageConverter`4 type

Namespace

Semantica.Domain.Data.DomainStorageConverters

Summary

Converter interface used by the base repository to convert storables to domain models and back of one entity or value object. This is the full interface required by RepositoryBase`4 base class.

Generic Types
Name Description
TStorable Storable (entity) type.
TDomainAdd Domain model type for creating.
TDomain Domain model type.
TKey Primary key type for the entity or value object in domain.
Remarks

Use when one model type is used for adds and another for replace and read methods.

<a name='T-Semantica-Domain-Data-DomainStorageConverters-IDomainStorageConverter`5'></a>

IDomainStorageConverter`5 type

Namespace

Semantica.Domain.Data.DomainStorageConverters

Summary

Converter interface used by the base repository to convert storables to domain models and back of one entity or value object. This is the full interface required by RepositoryBase`5 base class.

Generic Types
Name Description
TStorable Storable (entity) type.
TDomainOut Domain model type
TDomainAdd Domain model type for creating.
TDomainReplace Domain model type used for replacing.
TKey Primary key type for the entity or value object in domain.
Remarks

Use when different model types are used for add, replace and read methods.

<a name='T-Semantica-Domain-Data-Repositories-IPropertyAnalyser'></a>

IPropertyAnalyser type

Namespace

Semantica.Domain.Data.Repositories

Summary

Interface for functionality to analyse properties of a storable type, in order to identify immutable properties. Used by repositories for replace methods.

<a name='M-Semantica-Domain-Data-Repositories-IPropertyAnalyser-GetOrAnalyse``1'></a>

GetOrAnalyse``1() method

Summary

Analyse type T for immutable properties.

Returns

A newly generated or cached PropertyAnalysisResult for the provided type.

Parameters

This method has no parameters.

Generic Types
Name Description
T Model type to analyse.

<a name='T-Semantica-Domain-Data-Repositories-IPropertyIdentifier'></a>

IPropertyIdentifier type

Namespace

Semantica.Domain.Data.Repositories

Summary

Can identify an immutable storage property using its PropertyInfo. Used in the default implementation of IPropertyAnalyser. Register/inject custom implementations of this interface to use a different method of identifying immutable properties than the (default) ImmutableAttribute.

<a name='T-Semantica-Domain-Data-DomainStorageConverters-IStorageConverter`3'></a>

IStorageConverter`3 type

Namespace

Semantica.Domain.Data.DomainStorageConverters

Summary

Converter interface used by the base repository to convert storables to domain models of one entity or value object. This is the full interface required by ReadRepositoryBase`3 base class.

Generic Types
Name Description
TStorable Storable (entity) type.
TDomain Domain model type.
TKey Primary key type for the entity or value object in domain.

<a name='M-Semantica-Domain-Data-DomainStorageConverters-IStorageConverter3-ToDomain-0-'></a>

ToDomain() method

Summary

Converts a storable instance to its domain model representation.

Returns

Domain model instance.

Parameters

This method has no parameters.

<a name='T-Semantica-Domain-Data-DomainStorageConverters-IStorageReplicator`2'></a>

IStorageReplicator`2 type

Namespace

Semantica.Domain.Data.DomainStorageConverters

Summary

A converter interface used to make replicates (copies) of a storable. Replicating creates a new instance (key is not copied), with the same values as the original, that can be added using the datastore. If the primary key is generated in the storage system (e.g. database) itself, new key value should not be provided, otherwise it should.

Generic Types
Name Description
TStorable Type of the storable.
TKey Primary key type for the entity or value object in domain.

<a name='M-Semantica-Domain-Data-DomainStorageConverters-IStorageReplicator2-Replicate-0,System-Nullable{`1}-'></a>

Replicate(storable,newKey) method

Summary

Makes a copy of storable. Primary key is not copied.

Returns

A new storable instance.

Parameters
Name Type Description
storable `0 Storable instance to copy.
newKey System.Nullable{`1} Optional. Primary key value for the new instance. Omit iff storage system generates the new id.

<a name='T-Semantica-Domain-Data-Module'></a>

Module type

Namespace

Semantica.Domain.Data

Summary

Module that registers implementations of:

<a name='T-Semantica-Domain-Data-Repositories-PropertyAnalyser'></a>

PropertyAnalyser type

Namespace

Semantica.Domain.Data.Repositories

Summary

Default implementation of IPropertyAnalyser, that uses the injected IPropertyIdentifier to determine immutable properties for any analysed model type. The PropertyAnalysisResult is stored statically for each analysed type, so the analysis is only done once.

<a name='T-Semantica-Domain-Data-Repositories-PropertyAnalysisResult'></a>

PropertyAnalysisResult type

Namespace

Semantica.Domain.Data.Repositories

Summary

Holdings the result of property analysis of a single type. Used in PropertyAnalyser.

<a name='P-Semantica-Domain-Data-Repositories-PropertyAnalysisResult-ImmutableProperties'></a>

ImmutableProperties property

Summary

A list of all immutable properties of the analysed type.

<a name='T-Semantica-Domain-Data-Repositories-PropertyIdentifier'></a>

PropertyIdentifier type

Namespace

Semantica.Domain.Data.Repositories

Summary

Default implementation for IPropertyIdentifier, detecting the ImmutableAttribute on properties to determine mutability.

<a name='T-Semantica-Domain-Data-Repositories-ReadRepositoryBase`3'></a>

ReadRepositoryBase`3 type

Namespace

Semantica.Domain.Data.Repositories

Summary

Inherit from parent.

Summary

Base class that provides default implementations for all methods of IReadRepository`2.

Generic Types
Name Description
TStorable Type of the storage model class used to represent the entity or value object.

<a name='T-Semantica-Domain-Data-Repositories-RepositoryBase`3'></a>

RepositoryBase`3 type

Namespace

Semantica.Domain.Data.Repositories

Summary

Inherit from parent.

Summary

Base class that provides default implementations for all methods of IRepository`2.

Generic Types
Name Description
TStorable Type of the storable class used to represent the entity or value object.
Remarks

Use when the same model type is used for add, replace and read methods.

<a name='T-Semantica-Domain-Data-Repositories-RepositoryBase`4'></a>

RepositoryBase`4 type

Namespace

Semantica.Domain.Data.Repositories

Summary

Inherit from parent.

Summary

Base class that provides default implementations for all methods of IRepository`3.

Generic Types
Name Description
TStorable Type of the storable class used to represent the entity or value object.
Remarks

Use when one model type is used for adds and another for replace and read methods.

<a name='T-Semantica-Domain-Data-Repositories-RepositoryBase`5'></a>

RepositoryBase`5 type

Namespace

Semantica.Domain.Data.Repositories

Summary

Inherit from parent.

Summary

Base class that provides default implementations for all methods of IRepository`4.

Generic Types
Name Description
TStorable Type of the storable class used to represent the entity or value object.
Remarks

Use when different model types are used for add, replace and read methods.

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 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 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.  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. 
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 Semantica.Lib.Domain.Data:

Package Downloads
Semantica.Lib.Domain.Data.SimpleInjector

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
8.1.0-beta 86 5/30/2025
8.0.7-beta 71 9/6/2024
8.0.6-beta 686 7/10/2024
8.0.5-beta 122 7/4/2024
8.0.4-beta 76 7/2/2024
8.0.3-beta 79 6/14/2024
8.0.2-beta 139 6/4/2024
8.0.1-beta 74 6/4/2024
8.0.0-beta 74 6/4/2024
6.6.1-beta 210 4/5/2024
6.6.0-beta 235 3/5/2024
6.5.5-alpha2 84 3/4/2024
6.5.5-alpha 91 3/4/2024
6.5.4-beta 103 2/29/2024
6.5.3-beta 527 10/5/2023
6.5.2-beta 98 10/5/2023
6.5.1-beta 156 9/29/2023
6.5.0-beta 116 9/22/2023
6.4.0-beta 428 7/11/2023
6.3.0-beta 136 6/15/2023
6.2.5-beta 203 3/14/2023
6.2.4-beta 580 10/12/2022
6.2.3-beta 266 9/1/2022
6.2.1-beta 173 8/25/2022