Neo4jMapper renamed
Neo4jMapper is now known as Neo4j.Mapper.
What is Neo4j.Mapper?
Formally known as Neo4jMapper, Neo4j.Mapper is a .NET6.0 library to simplify mapping of cypher values onto your models.
Features
- Simple Map API which extends Neo4j Driver's
IRecordto greatly simplify the extraction and projection of cypher values onto your entity models. - Works asynchronously via
IStatementResultCursormethods. - Automatic mapping of node Ids to your entity models, and
GetNode&SetNodehelper methods to simplify writing CRUD methods. - Custom converters to facilitate conversion between Neo4j Driver's temporal data types such as
ZonedDateTimeand .NET CLR types such asDateTimeOffset. Neo4jParameterswrapper and Dictionary extension methods to assist in creating parameter maps when performing cypher updates.- Superior performance due to the use of best-in-class mapper ServiceStack.Text.
- Targets .NET6.0.
- Supports Neo4j.Driver v4.x.
Minimum Viable Snippet
var cursor = await Session.RunAsync(@"
MATCH (person:Person {name: 'Cuba Gooding Jr.'})-[:ACTED_IN]->(movie:Movie)
RETURN person, COLLECT(movie) AS movies");
var actor = await cursor
.MapSingleAsync((Person person, IEnumerable<Movie> movies) =>
{
person.MoviesActedIn = movies;
return person;
});
Assert.AreEqual("Cuba Gooding Jr.", actor.name);
Assert.AreEqual(1968, actor.born);
Assert.AreEqual(4, actor.MoviesActedIn.Count());
Install Package
Install-Package Neo4j.Mapper
For further information see the Neo4j.Mapper readme and documentation.