ln.skyscanner/SkyEntities.cs

50 lines
1.6 KiB
C#
Raw Normal View History

2019-03-26 12:53:42 +01:00
// /**
// * File: SkyEntities.cs
// * Author: haraldwolff
// *
// * This file and it's content is copyrighted by the Author and / or copyright holder.
// * Any use wihtout proper permission is illegal and may lead to legal actions.
// *
// *
// **/
using System;
using ln.types.odb;
using ln.skyscanner.entities;
using System.IO;
using LiteDB;
namespace ln.skyscanner
{
public class SkyEntities
{
public SkyScanner SkyScanner { get; }
public string BasePath => Path.Combine(SkyScanner.BasePath, "entities");
public GlobalNetwork GlobalNetwork { get; private set; }
2019-03-27 07:49:49 +01:00
public ODB odDatabase { get; private set; }
public ODBCollection<Node> nodeCollection { get; private set; }
2019-04-03 09:19:37 +02:00
//public ODBCollection<NetworkInterface> interfaceCollection { get; private set; }
//public ODBCollection<IntfIP> intfIPCollection { get; private set; }
2019-03-27 07:49:49 +01:00
public ODBCollection<Subnet> subnetCollection { get; private set; }
2019-03-26 12:53:42 +01:00
public SkyEntities(SkyScanner skyScanner)
{
SkyScanner = skyScanner;
2019-03-27 07:49:49 +01:00
odDatabase = new ODB(BasePath);
nodeCollection = odDatabase.GetCollection<Node>();
subnetCollection = odDatabase.GetCollection<Subnet>();
2019-03-26 12:53:42 +01:00
2019-04-01 15:17:41 +02:00
nodeCollection.EnsureIndex("PrimaryIP");
2019-04-03 09:19:37 +02:00
nodeCollection.EnsureIndex("Interfaces[].ConfiguredIPs[].IP");
nodeCollection.EnsureIndex("Interfaces[].ConfiguredIPs[].Network");
2019-04-02 13:00:15 +02:00
2019-04-03 09:19:37 +02:00
subnetCollection.EnsureIndex("Network");
2019-03-29 08:55:09 +01:00
2019-03-26 12:53:42 +01:00
GlobalNetwork = new GlobalNetwork(this);
}
}
}