Stardust.Paradox.Data 1.3.2

Entityframework styled tool for accessing gremlin based graph databases like CosmosDB and Apache Tinkerpop

There is a newer version of this package available.
See the version list below for details.
Install-Package Stardust.Paradox.Data -Version 1.3.2
dotnet add package Stardust.Paradox.Data --version 1.3.2
<PackageReference Include="Stardust.Paradox.Data" Version="1.3.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Stardust.Paradox.Data --version 1.3.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Stardust.Paradox.Data, 1.3.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Stardust.Paradox.Data as a Cake Addin
#addin nuget:?package=Stardust.Paradox.Data&version=1.3.2

// Install Stardust.Paradox.Data as a Cake Tool
#tool nuget:?package=Stardust.Paradox.Data&version=1.3.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Usage (asp.net core)

Startup.cs

ConfigureServices

Add the generated entity implementations to the IOC container (I will provide an extention method to make this easier)

 services.AddEntityBinding((entityType, entityImplementation) => services.AddTransient(entityType, entityImplementation))
        .AddScoped<MyEntityContext,MyEntityContext>()
        .AddScoped<IGremlinLanguageConnector>(s => new CosmosDbLanguageConnector(DbAccountName, AccessKey, "databaseName","collectionName"));

Defining the model

[VertexLabel("person")]
public interface IPerson : IVertex
{
    string Id {get;}

    string FirstName { get; set; }

    string LastName { get; set; }
    
    string Email { get; set; }

    IEdgeCollection<IPerson> Parents { get; }

    IEdgeCollection<IPerson> Children { get; }

    IEdgeCollection<IPerson> Siblings { get; }

    [EdgeLabel("city")] //pointing to the Residents property in ICity
    IEdgeReference<ICity> HomeCity { get; }//use IEdgeReference to enable task-async operations

    IEdgeCollection<ICompany> Employers { get; }
}

[VertexLabel("city")]
public interface ICity : IVertex
{
    string Id { get; }

    string Name { get; set; }

    string ZipCode { get; set; }
    

   [ReverseEdgeLabel("city")] //pointing to the HomCity property in IPerson
    IEdgeCollection<Iperson> Residents { get; } //use IEdgeCollection to enable task-async operations on the collection

    IEdgeReference<ICountry> Country { get; }
}

[VertexLabel("company")]
public interface ICompany : IVertex
{
    string Id { get; }

    string Name { get; set; }

    IEdgeCollection<ICompany> Employees { get; }
}

[VertexLabel("country")]
public interface ICountry : IVertex
{
    string Id { get; }

    string Name { get; set; }

    string CountryCode { get; set; }

    string PhoneNoPrefix { get; set; }

    IEdgeCollection<ICity> Cities { get; }
}

Defining the entity context and generating the entity implementations

public class MyEntityContext : Stardust.Paradox.Data.GraphContextBase
{
    public IGraphSet<IPerson> Persons => GraphSet<IPerson>();

    public IGraphSet<ICity> Cities => GraphSet<ICity>();

    public IGraphSet<ICountry> Countries => GraphSet<ICountry>();

    public IGraphSet<ICompany> Companies => GraphSet<ICompany>();

    public MyEntityContext(IGremlinLanguageConnector connector, IServiceProvider resolver) : base(connector, resolver)
    {
    }

    protected override bool InitializeModel(IGraphConfiguration configuration)
    {
        //Added some fluent configuration of the edges
        configuration.ConfigureCollection<IPerson>()
                .AddEdge(t => t.Children, "children").Reverse<IPerson>(t => t.Parents)
            .ConfigureCollection<ICity>()
            .ConfigureCollection<ICountry>()
                .AddEdge(t=>t.Cities).Reverse<ICountry>(t=>t.Country)
            .ConfigureCollection<ICompany>()
                .AddEdge(t => t.Employees, "employees").Reverse<IPerson>(t => t.Employers);
        return true;
    }
}

Usage (asp.net core)

Startup.cs

ConfigureServices

Add the generated entity implementations to the IOC container (I will provide an extention method to make this easier)

 services.AddEntityBinding((entityType, entityImplementation) => services.AddTransient(entityType, entityImplementation))
        .AddScoped<MyEntityContext,MyEntityContext>()
        .AddScoped<IGremlinLanguageConnector>(s => new CosmosDbLanguageConnector(DbAccountName, AccessKey, "databaseName","collectionName"));

Defining the model

[VertexLabel("person")]
public interface IPerson : IVertex
{
    string Id {get;}

    string FirstName { get; set; }

    string LastName { get; set; }
    
    string Email { get; set; }

    IEdgeCollection<IPerson> Parents { get; }

    IEdgeCollection<IPerson> Children { get; }

    IEdgeCollection<IPerson> Siblings { get; }

    [EdgeLabel("city")] //pointing to the Residents property in ICity
    IEdgeReference<ICity> HomeCity { get; }//use IEdgeReference to enable task-async operations

    IEdgeCollection<ICompany> Employers { get; }
}

[VertexLabel("city")]
public interface ICity : IVertex
{
    string Id { get; }

    string Name { get; set; }

    string ZipCode { get; set; }
    

   [ReverseEdgeLabel("city")] //pointing to the HomCity property in IPerson
    IEdgeCollection<Iperson> Residents { get; } //use IEdgeCollection to enable task-async operations on the collection

    IEdgeReference<ICountry> Country { get; }
}

[VertexLabel("company")]
public interface ICompany : IVertex
{
    string Id { get; }

    string Name { get; set; }

    IEdgeCollection<ICompany> Employees { get; }
}

[VertexLabel("country")]
public interface ICountry : IVertex
{
    string Id { get; }

    string Name { get; set; }

    string CountryCode { get; set; }

    string PhoneNoPrefix { get; set; }

    IEdgeCollection<ICity> Cities { get; }
}

Defining the entity context and generating the entity implementations

public class MyEntityContext : Stardust.Paradox.Data.GraphContextBase
{
    public IGraphSet<IPerson> Persons => GraphSet<IPerson>();

    public IGraphSet<ICity> Cities => GraphSet<ICity>();

    public IGraphSet<ICountry> Countries => GraphSet<ICountry>();

    public IGraphSet<ICompany> Companies => GraphSet<ICompany>();

    public MyEntityContext(IGremlinLanguageConnector connector, IServiceProvider resolver) : base(connector, resolver)
    {
    }

    protected override bool InitializeModel(IGraphConfiguration configuration)
    {
        //Added some fluent configuration of the edges
        configuration.ConfigureCollection<IPerson>()
                .AddEdge(t => t.Children, "children").Reverse<IPerson>(t => t.Parents)
            .ConfigureCollection<ICity>()
            .ConfigureCollection<ICountry>()
                .AddEdge(t=>t.Cities).Reverse<ICountry>(t=>t.Country)
            .ConfigureCollection<ICompany>()
                .AddEdge(t => t.Employees, "employees").Reverse<IPerson>(t => t.Employers);
        return true;
    }
}

Release Notes

Added fluent configuration of edge references
Added basic Edge properties support

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Stardust.Paradox.Data:

Package Downloads
Stardust.Paradox.Data.Providers.Gremlin
Entityframework styled tool for accessing gremlin based graph databases like CosmosDB and Apache Tinkerpop A database connector based on gremlin.net
Stardust.Paradox.Data.Providers.CosmosDb
[This package will be deprecated in V 3.0, consider moving to 'Stardust.Paradox.Data.Providers.Gremlin'] Connector for CosmosDb using the document client

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
3.0.0-rc03 617 2/14/2020
3.0.0-rc01 296 2/14/2020
2.3.6 789 10/12/2020
2.3.5 222 10/7/2020
2.3.4 2,273 1/13/2020
2.3.3 316 1/8/2020
2.3.2 245 1/8/2020
2.3.1 234 1/7/2020
2.3.0 458 12/2/2019
2.2.0 336 11/12/2019
2.1.7 214 11/5/2019
2.1.6 233 10/8/2019
2.1.5 232 9/16/2019
2.1.4 245 8/13/2019
2.1.3 788 6/5/2019
2.1.2 277 5/28/2019
2.1.1 939 4/2/2019
2.1.0 388 4/2/2019
2.0.6 302 4/1/2019
2.0.5 411 3/27/2019
2.0.4 377 3/6/2019
2.0.0 453 2/20/2019
2.0.0-pre29 351 2/19/2019
2.0.0-pre26 339 2/14/2019
2.0.0-pre23 329 2/12/2019
2.0.0-pre15 341 2/6/2019
2.0.0-pre11 370 2/4/2019
2.0.0-pre09 349 1/25/2019
2.0.0-pre02 380 1/16/2019
2.0.0-pre01 423 12/5/2018
1.4.9 359 2/8/2019
1.4.8 462 12/6/2018
1.4.7 470 11/28/2018
1.4.5 392 11/21/2018
1.4.4 393 11/20/2018
1.4.3 464 11/6/2018
1.4.1 399 10/30/2018
1.4.0 407 10/22/2018
1.3.11 409 10/16/2018
1.3.5 405 10/15/2018
1.3.4 463 10/8/2018
1.3.3 466 10/2/2018
1.3.2 456 9/11/2018
1.3.1 532 8/23/2018
1.3.0 554 8/23/2018
1.2.0 464 8/20/2018
1.1.5 457 8/15/2018
1.0.4 471 8/14/2018
1.0.3 452 8/13/2018
1.0.2 439 8/13/2018
1.0.1 503 8/10/2018
1.0.0-pre005 531 7/3/2018
1.0.0-pre001 624 6/11/2018
Show less