Class ChildrenBuilder<TParentModel, TChildModel>
- Namespace
- Cratis.Chronicle.Projections
- Assembly
- Cratis.Chronicle.dll
Represents an implementation of IChildrenBuilder<TParentModel, TChildModel>.
public class ChildrenBuilder<TParentModel, TChildModel> : ProjectionBuilder<TChildModel, IChildrenBuilder<TParentModel, TChildModel>>, IChildrenBuilder<TParentModel, TChildModel>, IProjectionBuilder<TChildModel, IChildrenBuilder<TParentModel, TChildModel>>, IChildrenBuilder
Type Parameters
TParentModel
Parent model type.
TChildModel
Child model type.
- Inheritance
-
ProjectionBuilder<TChildModel, IChildrenBuilder<TParentModel, TChildModel>>ChildrenBuilder<TParentModel, TChildModel>
- Implements
-
IChildrenBuilder<TParentModel, TChildModel>IProjectionBuilder<TChildModel, IChildrenBuilder<TParentModel, TChildModel>>
- Inherited Members
Remarks
/// Initializes a new instance of the ProjectionBuilderFor<TModel> class.
Constructors
ChildrenBuilder(IEventTypes, IJsonSchemaGenerator, JsonSerializerOptions, bool)
Represents an implementation of IChildrenBuilder<TParentModel, TChildModel>.
public ChildrenBuilder(IEventTypes eventTypes, IJsonSchemaGenerator schemaGenerator, JsonSerializerOptions jsonSerializerOptions, bool autoMap)
Parameters
eventTypes
IEventTypesIEventTypes for providing event type information.
schemaGenerator
IJsonSchemaGeneratorIJsonSchemaGenerator for generating JSON schemas.
jsonSerializerOptions
JsonSerializerOptionsThe JsonSerializerOptions to use for any JSON serialization.
autoMap
boolWhether to automatically map properties.
Remarks
/// Initializes a new instance of the ProjectionBuilderFor<TModel> class.
Properties
HasIdentifiedBy
Gets whether or not the builder has identified by.
public bool HasIdentifiedBy { get; }
Property Value
Methods
FromEventProperty<TEvent>(Expression<Func<TEvent, TChildModel>>)
Defines the event and property on it that the child should be created as a value from.
public IChildrenBuilder<TParentModel, TChildModel> FromEventProperty<TEvent>(Expression<Func<TEvent, TChildModel>> propertyExpression)
Parameters
propertyExpression
Expression<Func<TEvent, TChildModel>>The expression that represents the property on the event to use.
Returns
- IChildrenBuilder<TParentModel, TChildModel>
Builder continuation.
Type Parameters
TEvent
Type of event.
GetIdentifiedBy()
Gets the property path that identifies the child model in the collection within the parent.
public PropertyPath GetIdentifiedBy()
Returns
- PropertyPath
Cratis.Chronicle.Properties.PropertyPath for the identified by.
IdentifiedBy(PropertyPath)
Sets the property that identifies the child model in the collection within the parent.
public IChildrenBuilder<TParentModel, TChildModel> IdentifiedBy(PropertyPath propertyPath)
Parameters
propertyPath
PropertyPathThe Cratis.Chronicle.Properties.PropertyPath that represents the property used to identify.
Returns
- IChildrenBuilder<TParentModel, TChildModel>
Builder continuation.
IdentifiedBy<TProperty>(Expression<Func<TChildModel, TProperty>>)
Sets the property that identifies the child model in the collection within the parent.
public IChildrenBuilder<TParentModel, TChildModel> IdentifiedBy<TProperty>(Expression<Func<TChildModel, TProperty>> propertyExpression)
Parameters
propertyExpression
Expression<Func<TChildModel, TProperty>>The expression that represents the property used to identify.
Returns
- IChildrenBuilder<TParentModel, TChildModel>
Builder continuation.
Type Parameters
TProperty
Type of property.