Skip to content

Commit d2a3607

Browse files
author
kostkams
committed
Creates a wrapper around the offical OrientDB API with create, update, delete and get
1 parent f5cc1ab commit d2a3607

23 files changed

+728
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
**/.vs/
2+
**/bin/
3+
**/obj/
135 KB
Binary file not shown.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
namespace OrientDB.Net.Core.BusinessObjects.Console
2+
{
3+
public class CompanyBO : BusinessObject, ICompanyBO
4+
{
5+
public CompanyBO()
6+
{
7+
ClassName = "Company";
8+
}
9+
10+
[DocumentProperty("CompanyName", true)]
11+
public string Name { get; set; }
12+
}
13+
14+
public static class CompanyBOExtension{
15+
public static ICompanyBO CreateCompany(this ITransaction transaction)
16+
{
17+
var company = new CompanyBO();
18+
transaction.Create(company);
19+
return company;
20+
}
21+
}
22+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace OrientDB.Net.Core.BusinessObjects.Console
2+
{
3+
public interface ICompanyBO : IBusinessObject
4+
{
5+
string Name { get; set; }
6+
7+
}
8+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp3.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<ProjectReference Include="..\OrientDB.Net.Core.BusinessObjects\OrientDB.Net.Core.BusinessObjects.csproj" />
10+
</ItemGroup>
11+
12+
</Project>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System.Linq;
2+
3+
namespace OrientDB.Net.Core.BusinessObjects.Console
4+
{
5+
internal class Program
6+
{
7+
private static void Main(string[] args)
8+
{
9+
var businessDocument = BusinessDocumentFactory.Connect(new ConnectionInfo("localhost",
10+
2424,
11+
"root",
12+
"rootpwd",
13+
"Helios",
14+
EDatabaseType.Graph));
15+
16+
using (var session = businessDocument.OpenSession())
17+
{
18+
var company = session.Get<ICompanyBO>(e => "Test" == e.Name && (e.Name != "tu" || e.Name != "tsssu") /**/);
19+
var transaction = session.BeginTransaction();
20+
var comp = transaction.CreateCompany();
21+
comp.Name = "Neu";
22+
transaction.Commit();
23+
var company1 = session.Get<ICompanyBO>();
24+
25+
transaction = session.BeginTransaction();
26+
comp.Name = "Neu 1";
27+
transaction.Update(comp);
28+
transaction.Commit();
29+
30+
31+
transaction = session.BeginTransaction();
32+
transaction.Delete(session.Get<ICompanyBO>(c => c.Name == "Neu 1").First());
33+
transaction.Commit();
34+
}
35+
}
36+
}
37+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp3.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
</Project>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System;
2+
3+
namespace OrientDB.Net.Core.BusinessObjects.Generator
4+
{
5+
class Program
6+
{
7+
static void Main(string[] args)
8+
{
9+
Console.WriteLine("Hello World!");
10+
}
11+
}
12+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.28407.52
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrientDB.Net.Core.BusinessObjects", "OrientDB.Net.Core.BusinessObjects\OrientDB.Net.Core.BusinessObjects.csproj", "{1C5F1464-A7D9-4EA1-8DD0-ECD4E6DFBDDD}"
7+
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrientDB.Net.Core.BusinessObjects.Generator", "OrientDB.Net.Core.BusinessObjects.Generator\OrientDB.Net.Core.BusinessObjects.Generator.csproj", "{2286C7C9-D2DC-446B-8FBE-509E18D6B7A2}"
9+
EndProject
10+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrientDB.Net.Core.BusinessObjects.Console", "OrientDB.Net.Core.BusinessObjects.Console\OrientDB.Net.Core.BusinessObjects.Console.csproj", "{421E5BC0-3AD8-4E87-B4A5-C95B063DB816}"
11+
EndProject
12+
Global
13+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
14+
Debug|Any CPU = Debug|Any CPU
15+
Release|Any CPU = Release|Any CPU
16+
EndGlobalSection
17+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18+
{1C5F1464-A7D9-4EA1-8DD0-ECD4E6DFBDDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19+
{1C5F1464-A7D9-4EA1-8DD0-ECD4E6DFBDDD}.Debug|Any CPU.Build.0 = Debug|Any CPU
20+
{1C5F1464-A7D9-4EA1-8DD0-ECD4E6DFBDDD}.Release|Any CPU.ActiveCfg = Release|Any CPU
21+
{1C5F1464-A7D9-4EA1-8DD0-ECD4E6DFBDDD}.Release|Any CPU.Build.0 = Release|Any CPU
22+
{2286C7C9-D2DC-446B-8FBE-509E18D6B7A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23+
{2286C7C9-D2DC-446B-8FBE-509E18D6B7A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
24+
{2286C7C9-D2DC-446B-8FBE-509E18D6B7A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
25+
{2286C7C9-D2DC-446B-8FBE-509E18D6B7A2}.Release|Any CPU.Build.0 = Release|Any CPU
26+
{421E5BC0-3AD8-4E87-B4A5-C95B063DB816}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27+
{421E5BC0-3AD8-4E87-B4A5-C95B063DB816}.Debug|Any CPU.Build.0 = Debug|Any CPU
28+
{421E5BC0-3AD8-4E87-B4A5-C95B063DB816}.Release|Any CPU.ActiveCfg = Release|Any CPU
29+
{421E5BC0-3AD8-4E87-B4A5-C95B063DB816}.Release|Any CPU.Build.0 = Release|Any CPU
30+
EndGlobalSection
31+
GlobalSection(SolutionProperties) = preSolution
32+
HideSolutionNode = FALSE
33+
EndGlobalSection
34+
GlobalSection(ExtensibilityGlobals) = postSolution
35+
SolutionGuid = {523754E0-89A2-474A-BB73-5493CE009CF0}
36+
EndGlobalSection
37+
EndGlobal
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System;
2+
using Orient.Client;
3+
4+
namespace OrientDB.Net.Core.BusinessObjects
5+
{
6+
public class BusinessDocument : IBusinessDocument
7+
{
8+
private readonly ConnectionInfo connectionInfo;
9+
10+
public BusinessDocument(ConnectionInfo connectionInfo)
11+
{
12+
this.connectionInfo = connectionInfo;
13+
}
14+
15+
public string Server => connectionInfo.HostName;
16+
public string DatabaseName => connectionInfo.DatabaseName;
17+
public EDatabaseType DatabaseType => connectionInfo.DatabaseType;
18+
public ISession OpenSession()
19+
{
20+
CurrentSession = new Session(connectionInfo);
21+
return CurrentSession;
22+
}
23+
24+
public ISession CurrentSession { get; private set; }
25+
}
26+
}

0 commit comments

Comments
 (0)