Stardust.Paradox.Data
2.1.1
See the version list below for details.
dotnet add package Stardust.Paradox.Data --version 2.1.1
NuGet\Install-Package Stardust.Paradox.Data -Version 2.1.1
<PackageReference Include="Stardust.Paradox.Data" Version="2.1.1" />
paket add Stardust.Paradox.Data --version 2.1.1
#r "nuget: Stardust.Paradox.Data, 2.1.1"
// Install Stardust.Paradox.Data as a Cake Addin
#addin nuget:?package=Stardust.Paradox.Data&version=2.1.1
// Install Stardust.Paradox.Data as a Cake Tool
#tool nuget:?package=Stardust.Paradox.Data&version=2.1.1
Stardust.Paradox
Entity framework'ish tool for developing .net applications using gremlin graph query language with CosmosDb
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; }
EpochDateTime Birthday {get;set;}//Wrapper type for DateTime that serializes into unix epoch. Can be used in predicate steps directly.
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; }
}
[EdgeLabel("employer")]
public interface IEmployment : IEdge<IProfile, ICompany>
{
string Id { get; }
EpochDateTime HiredDate { get; set; }
string Manager { get; set; }
}
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 IGraphSet<IEmployment> Employments => EdgeGraphSet<IEmployment>();
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)
.ConfigureCollection<IEmployment>();;
return true;
}
}
Using the datacontext
public class DemoController:Controller
{
private MyEntityContext _dataContext;
public DemoController(MyEntityContext dataContext)
{
_dataContext=dataContext;
}
public Task<IActionResult> GetDataAsync(string personId)
{
var person=await _dataContext.Persons.GetAsync(persionId);
return new User
{
Id=person.Id,
FirstName=person.FistName,
LastName=person.LastName,
Email=person.Email
}
}
public Task<IActionResult> AddEmploymentAsync(string userId, string companyId,DateTime hiredDate, string managerName) //new in V2
{
var user=await await _dataContext.Persons.GetAsync(persionId);
var company=await _dataContext.Companies.GetAsync(companyId);
var e= _dataContext.Employments.Create(user,company);
e.HiredDate=hiredDate.ToEpoch();
e.ManagerName=managerName;
await _dataContext.SaveChangesAsync();
//alternative
}
public Task<IActionResult> AddEmploymentAlternativeAsync(string userId, string companyId,DateTime hiredDate, string managerName) //edge property handling in V1
{
var user=await await _dataContext.Persons.GetAsync(persionId);
var company=await _dataContext.Companies.GetAsync(companyId);
user.Employers.Add(company,new Dictionary<string,object>{
{"hiredDate",hiredDate.ToEpoch()},
{"managerName","managerName"}
})
await _dataContext.SaveChangesAsync();
//alternative
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 2.1.1)
- Newtonsoft.Json (>= 10.0.3)
- Stardust.Paradox.Data.Annotations (>= 2.1.0)
- Stardust.Particles (>= 5.0.1)
- System.IO.Compression (>= 4.3.0)
- System.Reflection (>= 4.3.0)
- System.Reflection.Emit (>= 4.3.0)
- System.Reflection.Emit.ILGeneration (>= 4.3.0)
- System.Reflection.Emit.Lightweight (>= 4.3.0)
- System.Reflection.Primitives (>= 4.3.0)
- System.Reflection.TypeExtensions (>= 4.4.0)
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 | Downloads | Last updated |
---|---|---|
3.0.0-rc03 | 774 | 2/14/2020 |
3.0.0-rc01 | 485 | 2/14/2020 |
2.3.14 | 1,006 | 10/20/2023 |
2.3.13 | 123 | 10/20/2023 |
2.3.10 | 305 | 9/22/2023 |
2.3.9 | 257 | 9/7/2023 |
2.3.8 | 2,703 | 2/7/2023 |
2.3.7 | 2,412 | 5/4/2022 |
2.3.6 | 3,743 | 10/12/2020 |
2.3.5 | 455 | 10/7/2020 |
2.3.4 | 3,642 | 1/13/2020 |
2.3.3 | 596 | 1/8/2020 |
2.3.2 | 517 | 1/8/2020 |
2.3.1 | 481 | 1/7/2020 |
2.3.0 | 1,072 | 12/2/2019 |
2.2.0 | 930 | 11/12/2019 |
2.1.7 | 487 | 11/5/2019 |
2.1.6 | 491 | 10/8/2019 |
2.1.5 | 490 | 9/16/2019 |
2.1.4 | 489 | 8/13/2019 |
2.1.3 | 1,420 | 6/5/2019 |
2.1.2 | 566 | 5/28/2019 |
2.1.1 | 1,938 | 4/2/2019 |
2.1.0 | 1,098 | 4/2/2019 |
2.0.6 | 710 | 4/1/2019 |
2.0.5 | 1,103 | 3/27/2019 |
2.0.4 | 948 | 3/6/2019 |
2.0.0 | 1,043 | 2/20/2019 |
2.0.0-pre29 | 523 | 2/19/2019 |
2.0.0-pre26 | 495 | 2/14/2019 |
2.0.0-pre23 | 482 | 2/12/2019 |
2.0.0-pre15 | 494 | 2/6/2019 |
2.0.0-pre11 | 540 | 2/4/2019 |
2.0.0-pre09 | 501 | 1/25/2019 |
2.0.0-pre02 | 560 | 1/16/2019 |
2.0.0-pre01 | 580 | 12/5/2018 |
1.4.9 | 615 | 2/8/2019 |
1.4.8 | 743 | 12/6/2018 |
1.4.7 | 1,138 | 11/28/2018 |
1.4.5 | 732 | 11/21/2018 |
1.4.4 | 680 | 11/20/2018 |
1.4.3 | 1,120 | 11/6/2018 |
1.4.1 | 695 | 10/30/2018 |
1.4.0 | 710 | 10/22/2018 |
1.3.11 | 700 | 10/16/2018 |
1.3.5 | 729 | 10/15/2018 |
1.3.4 | 786 | 10/8/2018 |
1.3.3 | 794 | 10/2/2018 |
1.3.2 | 795 | 9/11/2018 |
1.3.1 | 879 | 8/23/2018 |
1.3.0 | 1,273 | 8/23/2018 |
1.2.0 | 856 | 8/20/2018 |
1.1.5 | 835 | 8/15/2018 |
1.0.4 | 1,001 | 8/14/2018 |
1.0.3 | 824 | 8/13/2018 |
1.0.2 | 814 | 8/13/2018 |
1.0.1 | 1,085 | 8/10/2018 |
1.0.0-pre005 | 781 | 7/3/2018 |
1.0.0-pre001 | 992 | 6/11/2018 |
Added support for typed Edges.
Added parameterized queries for connectors that support it, for connectors that doesnt support it input strings are escaped to avoid some injection attacks
Added support for partitioning (CosmosDB)
Added missing 'and' overload and fixed get edge partitioning issue.
Added missing 'and' overload
Bugfix: new TypedEdge is not saved when no properties are updated
Bugfix: Parameterization of numbers larger than int.MaxValue fails when calling cosmosDB
Enhancement: Added EpochDateTime type to handle datetime values better.
Enhancement: Added support for EpochDateTime in the appropriate predicate steps