Table of Contents

Class PrefabKeyedMapDataSource<TData, TLoader>

Namespace
RisingV.Core.Databases
Assembly
RisingV.Core.dll

Represents a data source that uses PrefabGUIDs as keys to access data.

public abstract class PrefabKeyedMapDataSource<TData, TLoader> : MapDataSource<int, TData, TLoader>, IDataSource<int, TData, TLoader>, IDataSource<int, TData>, IDataSource, IDataCrud, IDataCrud<int, TData> where TData : IData where TLoader : IDataLoader<int, TData>

Type Parameters

TData

The type of data stored in the source, which must implement IData.

TLoader

The type of data loader used to load the data, which must implement IDataLoader<TKey, TData>.

Inheritance
DataSource<int, TData, TLoader>
MapDataSource<int, TData, TLoader>
PrefabKeyedMapDataSource<TData, TLoader>
Implements
IDataSource<int, TData, TLoader>
IDataCrud<int, TData>
Inherited Members
Extension Methods

Constructors

PrefabKeyedMapDataSource(Map<int, TData>?)

Represents a data source that uses PrefabGUIDs as keys to access data.

protected PrefabKeyedMapDataSource(Map<int, TData>? map = null)

Parameters

map Map<int, TData>

Optional map to initialize the data source with.

Methods

GetByEntity<TX>(Entity)

Attempts to get the data associated with the specified PrefabGUID.

public TX? GetByEntity<TX>(Entity entity) where TX : TData

Parameters

entity Entity

The entity whose PrefabGUID is used to look up the data.

Returns

TX

The data associated with the PrefabGUID if it exists; otherwise, null.

Type Parameters

TX

The type of data to retrieve, which must be a subclass of TData.

Exceptions

DatabaseException

Thrown if the entity is null.

Get<TX>(PrefabGUID)

Gets the data associated with the specified PrefabGUID.

public TX? Get<TX>(PrefabGUID prefabGuid) where TX : TData

Parameters

prefabGuid PrefabGUID

The PrefabGUID to look up.

Returns

TX

The data associated with the PrefabGUID if it exists; otherwise, null.

Type Parameters

TX

The type of data to retrieve, which must be a subclass of TData.

TryGetByEntity<TX>(Entity)

Attempts to get the data associated with the specified PrefabGUID from an entity.

public TX? TryGetByEntity<TX>(Entity entity) where TX : TData

Parameters

entity Entity

The entity whose PrefabGUID is used to look up the data.

Returns

TX

The data associated with the PrefabGUID if it exists; otherwise, null.

Type Parameters

TX

The type of data to retrieve, which must be a subclass of TData.