Class GenericGameObjectRepositoryBase
Represents a generic repository for querying game objects using a property manager.
Inheritance
Inherited Members
Namespace: Microsoft.XboxStudios.GameStateTracker.Generic
Assembly: GameStateTracker.Generic.dll
Syntax
public abstract class GenericGameObjectRepositoryBase : IGenericGameObjectRepository, IGameObjectRepository
Properties
View SourcePropertyManager
Gets or sets a manager of the default set of properties to retrieve for each game class.
Declaration
public IPropertyManager PropertyManager { get; set; }
Property Value
Type | Description |
---|---|
IPropertyManager |
Methods
View SourceGenerateDerivedClassTree<T>(Func<Type, string?>)
Iterates over all types derived from the given base type to create an enumeration of pairs of (base class name, subclass).
Declaration
protected static IEnumerable<Tuple<string?, string>> GenerateDerivedClassTree<T>(Func<Type, string?> getTypeName)
Parameters
Type | Name | Description |
---|---|---|
Func<Type, string> | getTypeName | A function that returns the type's name. |
Returns
Type | Description |
---|---|
IEnumerable<Tuple<string, string>> | An enumeration of pairs. |
Type Parameters
Name | Description |
---|---|
T | The base type. |
GetClassTree(CancellationToken)
Gets the class tree.
Declaration
public virtual Task<ILookup<string?, string>> GetClassTree(CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | token | The cancellation token. |
Returns
Type | Description |
---|---|
Task<ILookup<string, string>> | A lookup table from parent class name to subclass names. |
GetGameObjects(ObjectInfo, CancellationToken)
Retrieves all objects matching the given query.
Declaration
public Task<IEnumerable<IGameObject>> GetGameObjects(ObjectInfo query, CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
ObjectInfo | query | The objects to look for. |
CancellationToken | token | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IEnumerable<IGameObject>> | An enumeration of objects. |
GetProperties(ObjectInfo, IReadOnlyCollection<string>, CancellationToken)
Retrieves property values for all objects matching the given query.
Declaration
public abstract Task<IEnumerable<QueryResult>> GetProperties(ObjectInfo query, IReadOnlyCollection<string> properties, CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
ObjectInfo | query | The objects to look for. |
IReadOnlyCollection<string> | properties | The properties to retrieve. |
CancellationToken | token | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IEnumerable<QueryResult>> | An enumeration of each matching object and property value. |
ListGameObjects(ObjectInfo, CancellationToken)
Retrieves the description of all objects matching the given query.
Declaration
public virtual Task<IEnumerable<ObjectInfo>> ListGameObjects(ObjectInfo query, CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
ObjectInfo | query | The objects to look for. |
CancellationToken | token | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IEnumerable<ObjectInfo>> | An enumeration of object descriptions. |
ListPropertiesByClass(string, string, CancellationToken)
Lists all matching properties of the given class name.
Declaration
public virtual Task<IEnumerable<string>> ListPropertiesByClass(string className, string propertyFilter = "*", CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
string | className | The class name. |
string | propertyFilter | An optional pattern to filter property names, using ? and * as wildcard characters. |
CancellationToken | token | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IEnumerable<string>> | An enumeration of property names. |
PopulateClassProperties(IClassManager, string, string?)
Populates the class manager for the specified class, using the ListPropertiesByClass method.
Declaration
public virtual Task PopulateClassProperties(IClassManager classManager, string className, string? parentClass = null)
Parameters
Type | Name | Description |
---|---|---|
IClassManager | classManager | The class manager. |
string | className | The class name. |
string | parentClass | The parent class name. |
Returns
Type | Description |
---|---|
Task | A task representing the work to populate the class manager. |
PopulateClassTreeProperties(IClassManager, string?, ILookup<string?, string>?)
Populates the class manager for each class in the tree, using the ListPropertiesByClass method.
Declaration
public virtual Task PopulateClassTreeProperties(IClassManager classManager, string? className = null, ILookup<string?, string>? classTree = null)
Parameters
Type | Name | Description |
---|---|---|
IClassManager | classManager | The class manager. |
string | className | The base class to start with. |
ILookup<string, string> | classTree | A mapping of parent class name to subclass name. |
Returns
Type | Description |
---|---|
Task | A task representing the work to populate the class manager. |
UpdateGameObjectProperties(ObjectInfo, IReadOnlyCollection<string>, IReadOnlyCollection<IGameObject>?, CancellationToken)
Updates properties for the queried objects.
Declaration
protected Task<IEnumerable<IGameObject>> UpdateGameObjectProperties(ObjectInfo query, IReadOnlyCollection<string> properties, IReadOnlyCollection<IGameObject>? existing = null, CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
ObjectInfo | query | The objects to look for. |
IReadOnlyCollection<string> | properties | The properties to retrieve. |
IReadOnlyCollection<IGameObject> | existing | The existing objects to merge with and prune. |
CancellationToken | token | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IEnumerable<IGameObject>> | An enumeration of objects. |
UpdateGameObjects(ObjectInfo, IReadOnlyCollection<string>, IReadOnlyCollection<IGameObject>?, CancellationToken)
Updates properties for the queried objects.
Declaration
public Task<IEnumerable<IGameObject>> UpdateGameObjects(ObjectInfo query, IReadOnlyCollection<string> properties, IReadOnlyCollection<IGameObject>? existing = null, CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
ObjectInfo | query | The objects to look for. |
IReadOnlyCollection<string> | properties | The properties to retrieve. |
IReadOnlyCollection<IGameObject> | existing | The existing objects to merge with. |
CancellationToken | token | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IEnumerable<IGameObject>> | An enumeration of objects. |
UpdateGameObjectsExcept(ObjectInfo, IReadOnlyCollection<string>, IReadOnlyCollection<IGameObject>?, CancellationToken)
Updates properties for the queried objects, skipping properties which are excluded.
Declaration
public virtual Task<IEnumerable<IGameObject>> UpdateGameObjectsExcept(ObjectInfo query, IReadOnlyCollection<string> exclude, IReadOnlyCollection<IGameObject>? existing = null, CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
ObjectInfo | query | The objects to look for. |
IReadOnlyCollection<string> | exclude | The properties to skip retrieving. |
IReadOnlyCollection<IGameObject> | existing | The existing objects to merge with and prune. |
CancellationToken | token | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IEnumerable<IGameObject>> | An enumeration of updated objects. |