Table of Contents

Enum EntityMappingSource

Namespace
Neo4j.Driver.Mapping
Assembly
Neo4j.Driver.dll

Controls what aspect of a graph entity is read when mapping a record field to a C# property.

public enum EntityMappingSource
Extension Methods

Fields

Property = 0

The value of the named property on the entity will be read.

RelationshipType = 1

Reads the type string of an IRelationship field.

The field in the record must be an IRelationship. The relationship's type string is then assigned to the target property. If the field is not a relationship the property is ignored.

NodeLabel = 2

Reads the labels of an INode field.

The field in the record must be an INode. The node's labels are then assigned to the target property using one of these rules:

  • If the target property is a string, the labels are joined with a comma separator (e.g. "Person,Employee").
  • If the target property is a collection type such as List<string> or IEnumerable<string>, each label is added as a separate element.

If the field is not a node the property is ignored.

Remarks

By default the mapper reads a named property from the entity (Property). Use NodeLabel or RelationshipType when you need to capture graph-structural information — such as the label of a node or the type of a relationship — rather than a stored property value.

Specify the mapping source via MappingSourceAttribute on a property or parameter, or via the mappingSource parameter of Map<TProperty>(Expression<Func<TObject, TProperty>>, string, EntityMappingSource, Func<object, TProperty>, bool).