Skip to content

DiGi.PostgreSQL.UniqueReference

github-actions[bot] edited this page Jul 15, 2026 · 2 revisions

DiGi.PostgreSQL.UniqueReference Namespace

Classes

Convert Class

public static class Convert

Inheritance System.Object → Convert

Methods

Convert.ToDiGi<TSerializableObject,TUniqueReference>(this ConnectionData, IEnumerable<TUniqueReference>) Method

Converts the database objects with the specified unique references to a list of serializable objects of type TSerializableObject.

public static System.Threading.Tasks.Task<System.Collections.Generic.List<TSerializableObject>?> ToDiGi<TSerializableObject,TUniqueReference>(this DiGi.PostgreSQL.Classes.ConnectionData connectionData, System.Collections.Generic.IEnumerable<TUniqueReference> uniqueReferences)
    where TSerializableObject : DiGi.Core.Interfaces.ISerializableObject
    where TUniqueReference : DiGi.Core.Interfaces.IUniqueReference;

Type parameters

TSerializableObject

The type of serializable object to convert to.

TUniqueReference

The type of unique reference.

Parameters

connectionData DiGi.PostgreSQL.Classes.ConnectionData

The connection data used to connect to the database.

uniqueReferences System.Collections.Generic.IEnumerable<TUniqueReference>

The collection of unique references to filter by.

Returns

System.Threading.Tasks.Task<System.Collections.Generic.List<TSerializableObject>>
A task representing the asynchronous operation, returning the list of serializable objects or null.

Convert.ToDiGi<TSerializableObject>(this ConnectionData, bool) Method

Converts the database objects to a list of serializable objects of type TSerializableObject.

public static System.Threading.Tasks.Task<System.Collections.Generic.List<TSerializableObject>?> ToDiGi<TSerializableObject>(this DiGi.PostgreSQL.Classes.ConnectionData connectionData, bool inheritance=true)
    where TSerializableObject : DiGi.Core.Interfaces.ISerializableObject;

Type parameters

TSerializableObject

The type of serializable object to convert to.

Parameters

connectionData DiGi.PostgreSQL.Classes.ConnectionData

The connection data used to connect to the database.

inheritance System.Boolean

A value indicating whether to include inherited types.

Returns

System.Threading.Tasks.Task<System.Collections.Generic.List<TSerializableObject>>
A task representing the asynchronous operation, returning the list of serializable objects or null.

Convert.ToPostgreSQL(this ISerializableObject, ConnectionData) Method

Converts a serializable object to its PostgreSQL unique reference representation.

public static System.Threading.Tasks.Task<DiGi.Core.Classes.UniqueReference?> ToPostgreSQL(this DiGi.Core.Interfaces.ISerializableObject? serializableObject, DiGi.PostgreSQL.Classes.ConnectionData connectionData);

Parameters

serializableObject DiGi.Core.Interfaces.ISerializableObject

The serializable object to convert.

connectionData DiGi.PostgreSQL.Classes.ConnectionData

The connection data for the PostgreSQL database.

Returns

System.Threading.Tasks.Task<DiGi.Core.Classes.UniqueReference>
A task that represents the asynchronous operation, containing the converted unique reference or null if the input object is null.

Convert.ToPostgreSQL<TSerializableObject>(this IEnumerable<TSerializableObject>, ConnectionData) Method

Converts a collection of serializable objects to their PostgreSQL unique reference representations.

public static System.Threading.Tasks.Task<System.Collections.Generic.HashSet<DiGi.Core.Classes.UniqueReference>?> ToPostgreSQL<TSerializableObject>(this System.Collections.Generic.IEnumerable<TSerializableObject>? serializableObjects, DiGi.PostgreSQL.Classes.ConnectionData? connectionData)
    where TSerializableObject : DiGi.Core.Interfaces.ISerializableObject;

Type parameters

TSerializableObject

The type of the serializable objects, which must implement ISerializableObject.

Parameters

serializableObjects System.Collections.Generic.IEnumerable<TSerializableObject>

The collection of serializable objects to convert.

connectionData DiGi.PostgreSQL.Classes.ConnectionData

The connection data for the PostgreSQL database.

Returns

System.Threading.Tasks.Task<System.Collections.Generic.HashSet<DiGi.Core.Classes.UniqueReference>>
A task that represents the asynchronous operation, containing a hash set of converted unique references or null if inputs are null.

Modify Class

public static class Modify

Inheritance System.Object → Modify

Methods

Modify.RemoveAsync(NpgsqlConnection, Type, bool) Method

Removes all unique references associated with a specific type from the database asynchronously.

public static System.Threading.Tasks.Task<bool> RemoveAsync(Npgsql.NpgsqlConnection? npgsqlConnection, System.Type type, bool inheritance=true);

Parameters

npgsqlConnection Npgsql.NpgsqlConnection

The Npgsql connection to be used for the operation.

type System.Type

The type whose references should be removed.

inheritance System.Boolean

A value indicating whether to include inherited types in the removal process.

Returns

System.Threading.Tasks.Task<System.Boolean>
True if the removal was successful; otherwise, false.

Modify.RemoveAsync<TUniqueReference>(NpgsqlConnection, IEnumerable<TUniqueReference>, bool) Method

Removes a collection of unique references from the database asynchronously.

public static System.Threading.Tasks.Task<System.Collections.Generic.List<TUniqueReference>?> RemoveAsync<TUniqueReference>(Npgsql.NpgsqlConnection? npgsqlConnection, System.Collections.Generic.IEnumerable<TUniqueReference> uniqueReferences, bool clean=true)
    where TUniqueReference : DiGi.Core.Interfaces.IUniqueReference;

Type parameters

TUniqueReference

The type of the unique reference, which must implement IUniqueReference.

Parameters

npgsqlConnection Npgsql.NpgsqlConnection

The Npgsql connection to be used for the operation.

uniqueReferences System.Collections.Generic.IEnumerable<TUniqueReference>

The collection of unique references to remove.

clean System.Boolean

A value indicating whether to clean partitions after the removal process.

Returns

System.Threading.Tasks.Task<System.Collections.Generic.List<TUniqueReference>>
A list of successfully removed unique references, or null if the connection is null or no valid references were found.

Modify.UpdateAsync<USerializableObject>(this NpgsqlConnection, IEnumerable<USerializableObject>, Func<Type,DataType>, object, UniqueIdReferenceGeneratingEventHandler) Method

Asynchronously updates or inserts serializable objects into the PostgreSQL database, utilizing partitioning and unique references via a batch operation.

public static System.Threading.Tasks.Task<System.Collections.Generic.HashSet<DiGi.Core.Classes.UniqueReference>?> UpdateAsync<USerializableObject>(this Npgsql.NpgsqlConnection? npgsqlConnection, System.Collections.Generic.IEnumerable<USerializableObject> serializableObjects, System.Func<System.Type?,DiGi.PostgreSQL.Enums.DataType> dataTypeFunc, object? sender=null, DiGi.PostgreSQL.UniqueReference.Delegates.UniqueIdReferenceGeneratingEventHandler? uniqueIdReferenceGeneratingEventHandler=null)
    where USerializableObject : DiGi.Core.Interfaces.ISerializableObject;

Type parameters

USerializableObject

The type of object that implements DiGi.Core.Interfaces.ISerializableObject.

Parameters

npgsqlConnection Npgsql.NpgsqlConnection

The Npgsql.NpgsqlConnection used to connect to the PostgreSQL database.

serializableObjects System.Collections.Generic.IEnumerable<USerializableObject>

An System.Collections.Generic.IEnumerable<> containing the objects to be updated or inserted.

dataTypeFunc System.Func<System.Type,DiGi.PostgreSQL.Enums.DataType>

A delegate that maps a System.Type to a DiGi.PostgreSQL.Enums.DataType.

sender System.Object

The source of the event, used when invoking the unique ID reference generating event handler.

uniqueIdReferenceGeneratingEventHandler UniqueIdReferenceGeneratingEventHandler(object, UniqueIdReferenceGeneratingEventArgs)

An optional UniqueIdReferenceGeneratingEventHandler(object, UniqueIdReferenceGeneratingEventArgs) to customize the generation of unique references.

Returns

System.Threading.Tasks.Task<System.Collections.Generic.HashSet<DiGi.Core.Classes.UniqueReference>>
A task that represents the asynchronous operation. The task result contains a HashSet of UniqueReference of updated references, or null if the connection or objects are null or an error occurs during table creation.

Query Class

public static class Query

Inheritance System.Object → Query

Methods

Query.ContainsAsync(this NpgsqlConnection, Type) Method

Checks whether the specified type exists in the database.

public static System.Threading.Tasks.Task<bool> ContainsAsync(this Npgsql.NpgsqlConnection npgsqlConnection, System.Type? type);

Parameters

npgsqlConnection Npgsql.NpgsqlConnection

The Npgsql connection to use for the query.

type System.Type

The type to check for existence.

Returns

System.Threading.Tasks.Task<System.Boolean>
A task that represents the asynchronous operation, containing true if the type exists; otherwise, false.

Query.ContainsAsync<TUniqueReference>(this NpgsqlConnection, IEnumerable<TUniqueReference>) Method

Checks whether the specified unique references exist in the database.

public static System.Threading.Tasks.Task<System.Collections.Generic.HashSet<TUniqueReference>?> ContainsAsync<TUniqueReference>(this Npgsql.NpgsqlConnection npgsqlConnection, System.Collections.Generic.IEnumerable<TUniqueReference>? uniqueReferences)
    where TUniqueReference : DiGi.Core.Interfaces.IUniqueReference;

Type parameters

TUniqueReference

The type of the unique reference, which must implement DiGi.Core.Interfaces.IUniqueReference.

Parameters

npgsqlConnection Npgsql.NpgsqlConnection

The Npgsql connection to use for the query.

uniqueReferences System.Collections.Generic.IEnumerable<TUniqueReference>

A collection of unique references to check for existence.

Returns

System.Threading.Tasks.Task<System.Collections.Generic.HashSet<TUniqueReference>>
A hash set containing the unique references that were found in the database, or null if the connection or input collection is null.

Query.CountAsync(this NpgsqlConnection, Type, bool) Method

Asynchronously counts the number of records for a specified type in the database.

public static System.Threading.Tasks.Task<long> CountAsync(this Npgsql.NpgsqlConnection npgsqlConnection, System.Type? type, bool inheritance=true);

Parameters

npgsqlConnection Npgsql.NpgsqlConnection

The PostgreSQL connection instance used to execute the query.

type System.Type

The type of the objects to count.

inheritance System.Boolean

A value indicating whether to include inherited types in the count.

Returns

System.Threading.Tasks.Task<System.Int64>
A task that represents the asynchronous operation. The task result contains the total record count, or -1 if the connection or type is null.

Query.PartitionIdAsync(this NpgsqlConnection, Type) Method

Asynchronously retrieves the partition identifier for a given type using the provided PostgreSQL connection.

public static System.Threading.Tasks.Task<System.Nullable<short>> PartitionIdAsync(this Npgsql.NpgsqlConnection? npgsqlConnection, System.Type? type);

Parameters

npgsqlConnection Npgsql.NpgsqlConnection

The Npgsql connection to use for the query.

type System.Type

The type for which the partition ID is being retrieved.

Returns

System.Threading.Tasks.Task<System.Nullable<System.Int16>>
A task that represents the asynchronous operation. The task result contains the partition identifier as a short, or null if not found or inputs are invalid.

Query.PartitionsAsync(this NpgsqlConnection, string) Method

Asynchronously retrieves a list of partitions associated with the specified type name.

public static System.Threading.Tasks.Task<System.Collections.Generic.List<DiGi.PostgreSQL.Classes.Partition>?> PartitionsAsync(this Npgsql.NpgsqlConnection? npgsqlConnection, string? name);

Parameters

npgsqlConnection Npgsql.NpgsqlConnection

The PostgreSQL connection to use for the query.

name System.String

The name of the type used to filter the partitions.

Returns

System.Threading.Tasks.Task<System.Collections.Generic.List<DiGi.PostgreSQL.Classes.Partition>>
A task that represents the asynchronous operation. The task result contains a list of DiGi.PostgreSQL.Classes.Partition objects, or null if the connection is null or the name is invalid.

Query.PartitionsAsync(this NpgsqlConnection, Type) Method

Asynchronously retrieves a list of partitions that are assignable from the specified type.

public static System.Threading.Tasks.Task<System.Collections.Generic.List<DiGi.PostgreSQL.Classes.Partition>?> PartitionsAsync(this Npgsql.NpgsqlConnection? npgsqlConnection, System.Type? type);

Parameters

npgsqlConnection Npgsql.NpgsqlConnection

The PostgreSQL connection to use for the query.

type System.Type

The system type used to filter the partitions.

Returns

System.Threading.Tasks.Task<System.Collections.Generic.List<DiGi.PostgreSQL.Classes.Partition>>
A task that represents the asynchronous operation. The task result contains a list of DiGi.PostgreSQL.Classes.Partition objects, or null if the connection or type is null.

Query.SerializableObjectsAsync<USerializableObject,TUniqueReference>(NpgsqlConnection, IEnumerable<TUniqueReference>) Method

Asynchronously retrieves a list of serializable objects from the database using a collection of unique references.

public static System.Threading.Tasks.Task<System.Collections.Generic.List<USerializableObject>?> SerializableObjectsAsync<USerializableObject,TUniqueReference>(Npgsql.NpgsqlConnection? npgsqlConnection, System.Collections.Generic.IEnumerable<TUniqueReference> uniqueReferences)
    where USerializableObject : DiGi.Core.Interfaces.ISerializableObject
    where TUniqueReference : DiGi.Core.Interfaces.IUniqueReference;

Type parameters

USerializableObject

The type of serializable object to retrieve, which must implement DiGi.Core.Interfaces.ISerializableObject.

TUniqueReference

The type of the unique reference used for lookup, which must implement DiGi.Core.Interfaces.IUniqueReference.

Parameters

npgsqlConnection Npgsql.NpgsqlConnection

The Npgsql connection used to execute the database query.

uniqueReferences System.Collections.Generic.IEnumerable<TUniqueReference>

A collection of unique references to be resolved into serializable objects.

Returns

System.Threading.Tasks.Task<System.Collections.Generic.List<USerializableObject>>
A task that represents the asynchronous operation. The task result contains a list of retrieved serializable objects, or null if the connection or unique references are null.

Query.SerializableObjectsAsync<USerializableObject>(NpgsqlConnection, bool) Method

Asynchronously retrieves a list of serializable objects from the database based on the specified type and inheritance settings.

public static System.Threading.Tasks.Task<System.Collections.Generic.List<USerializableObject>?> SerializableObjectsAsync<USerializableObject>(Npgsql.NpgsqlConnection? npgsqlConnection, bool inheritance=true)
    where USerializableObject : DiGi.Core.Interfaces.ISerializableObject;

Type parameters

USerializableObject

The type of serializable object to retrieve, which must implement DiGi.Core.Interfaces.ISerializableObject.

Parameters

npgsqlConnection Npgsql.NpgsqlConnection

The Npgsql connection used to execute the database query.

inheritance System.Boolean

A value indicating whether to include inherited types in the retrieval process.

Returns

System.Threading.Tasks.Task<System.Collections.Generic.List<USerializableObject>>
A task that represents the asynchronous operation. The task result contains a list of retrieved serializable objects, or null if the connection is null.

Clone this wiki locally