ln.skyscanner/SkyEntities.cs

51 lines
1.6 KiB
C#

// /**
// * 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; }
public ODB odDatabase { get; private set; }
public ODBCollection<Node> nodeCollection { get; private set; }
public ODBCollection<NetworkInterface> interfaceCollection { get; private set; }
public ODBCollection<IntfIP> intfIPCollection { get; private set; }
public ODBCollection<Subnet> subnetCollection { get; private set; }
public SkyEntities(SkyScanner skyScanner)
{
SkyScanner = skyScanner;
odDatabase = new ODB(BasePath);
nodeCollection = odDatabase.GetCollection<Node>();
interfaceCollection = odDatabase.GetCollection<NetworkInterface>();
intfIPCollection = odDatabase.GetCollection<IntfIP>();
subnetCollection = odDatabase.GetCollection<Subnet>();
nodeCollection.EnsureIndex("PrimaryIP");
interfaceCollection.EnsureIndex("NodeID");
intfIPCollection.EnsureIndex("interfaceID");
intfIPCollection.EnsureIndex("Network");
GlobalNetwork = new GlobalNetwork(this);
}
}
}