143 lines
5.0 KiB
C#
143 lines
5.0 KiB
C#
//---------------------------------------------------------------------------------------------------
|
|
// <auto-generated>
|
|
// This code was generated by T4Model template for T4 (https://github.com/linq2db/linq2db).
|
|
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
|
|
// </auto-generated>
|
|
//---------------------------------------------------------------------------------------------------
|
|
|
|
#pragma warning disable 1591
|
|
#nullable enable
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
using LinqToDB;
|
|
using LinqToDB.Mapping;
|
|
|
|
namespace UserService.DatabaseLayer.DataModels
|
|
{
|
|
/// <summary>
|
|
/// Database : UserService2
|
|
/// Data Source : srvbo
|
|
/// Server Version : 5.5.5-10.3.22-MariaDB-1ubuntu1
|
|
/// </summary>
|
|
public partial class UserService2DB : LinqToDB.Data.DataConnection
|
|
{
|
|
public ITable<IsMemberOf> IsMemberOfs { get { return this.GetTable<IsMemberOf>(); } }
|
|
public ITable<NodeModel> NodeModels { get { return this.GetTable<NodeModel>(); } }
|
|
|
|
public UserService2DB()
|
|
{
|
|
InitDataContext();
|
|
InitMappingSchema();
|
|
}
|
|
|
|
public UserService2DB(string configuration)
|
|
: base(configuration)
|
|
{
|
|
InitDataContext();
|
|
InitMappingSchema();
|
|
}
|
|
|
|
partial void InitDataContext ();
|
|
partial void InitMappingSchema();
|
|
}
|
|
|
|
[Table("IsMemberOf")]
|
|
public partial class IsMemberOf
|
|
{
|
|
[PrimaryKey(1), NotNull] public int NodeId { get; set; } // int(11)
|
|
[PrimaryKey(2), NotNull] public int NodeMemberId { get; set; } // int(11)
|
|
|
|
#region Associations
|
|
|
|
/// <summary>
|
|
/// IsMemberOf_ibfk_1
|
|
/// </summary>
|
|
[Association(ThisKey="NodeId", OtherKey="Id", CanBeNull=false, Relationship=Relationship.ManyToOne, KeyName="IsMemberOf_ibfk_1", BackReferenceName="IsMemberOfibfks")]
|
|
public NodeModel Node { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// IsMemberOf_ibfk_2
|
|
/// </summary>
|
|
[Association(ThisKey="NodeMemberId", OtherKey="Id", CanBeNull=false, Relationship=Relationship.ManyToOne, KeyName="IsMemberOf_ibfk_2", BackReferenceName="IsMemberOfIbfk2BackReferences")]
|
|
public NodeModel NodeMember { get; set; } = null!;
|
|
|
|
#endregion
|
|
}
|
|
|
|
[Table("NodeModels")]
|
|
public partial class NodeModel
|
|
{
|
|
[PrimaryKey, Identity ] public int Id { get; set; } // int(11)
|
|
[Column, NotNull ] public string CommonName { get; set; } = null!; // varchar(64)
|
|
[Column, Nullable] public string? FirstName { get; set; } // text
|
|
[Column, Nullable] public string? LastName { get; set; } // text
|
|
[Column, Nullable] public string? Description { get; set; } // text
|
|
[Column, Nullable] public int? ParentId { get; set; } // int(11)
|
|
[Column, Nullable] public int? ManagerId { get; set; } // int(11)
|
|
[Column, Nullable] public string? EMail { get; set; } // text
|
|
[Column, NotNull ] public bool IsActive { get; set; } // bit(1)
|
|
[Column, NotNull ] public string Discriminator { get; set; } = null!; // text
|
|
|
|
#region Associations
|
|
|
|
/// <summary>
|
|
/// NodeModels_ibfk_2_BackReference
|
|
/// </summary>
|
|
[Association(ThisKey="Id", OtherKey="ManagerId", CanBeNull=true, Relationship=Relationship.OneToMany, IsBackReference=true)]
|
|
public IEnumerable<NodeModel> Ibfks { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// IsMemberOf_ibfk_2_BackReference
|
|
/// </summary>
|
|
[Association(ThisKey="Id", OtherKey="NodeMemberId", CanBeNull=true, Relationship=Relationship.OneToMany, IsBackReference=true)]
|
|
public IEnumerable<IsMemberOf> IsMemberOfIbfk2BackReferences { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// IsMemberOf_ibfk_1_BackReference
|
|
/// </summary>
|
|
[Association(ThisKey="Id", OtherKey="NodeId", CanBeNull=true, Relationship=Relationship.OneToMany, IsBackReference=true)]
|
|
public IEnumerable<IsMemberOf> IsMemberOfibfks { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// NodeModels_ibfk_2
|
|
/// </summary>
|
|
[Association(ThisKey="ManagerId", OtherKey="Id", CanBeNull=true, Relationship=Relationship.ManyToOne, KeyName="NodeModels_ibfk_2", BackReferenceName="Ibfks")]
|
|
public NodeModel? Manager { get; set; }
|
|
|
|
/// <summary>
|
|
/// NodeModels_ibfk_3_BackReference
|
|
/// </summary>
|
|
[Association(ThisKey="Id", OtherKey="ParentId", CanBeNull=true, Relationship=Relationship.OneToMany, IsBackReference=true)]
|
|
public IEnumerable<NodeModel> NodeModelsIbfk3BackReferences { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// NodeModels_ibfk_3
|
|
/// </summary>
|
|
[Association(ThisKey="ParentId", OtherKey="Id", CanBeNull=true, Relationship=Relationship.ManyToOne, KeyName="NodeModels_ibfk_3", BackReferenceName="NodeModelsIbfk3BackReferences")]
|
|
public NodeModel? Parent { get; set; }
|
|
|
|
#endregion
|
|
}
|
|
|
|
public static partial class TableExtensions
|
|
{
|
|
public static IsMemberOf Find(this ITable<IsMemberOf> table, int NodeId, int NodeMemberId)
|
|
{
|
|
return table.FirstOrDefault(t =>
|
|
t.NodeId == NodeId &&
|
|
t.NodeMemberId == NodeMemberId);
|
|
}
|
|
|
|
public static NodeModel Find(this ITable<NodeModel> table, int Id)
|
|
{
|
|
return table.FirstOrDefault(t =>
|
|
t.Id == Id);
|
|
}
|
|
}
|
|
}
|
|
|
|
#pragma warning restore 1591
|