220 lines
7.4 KiB
C#
220 lines
7.4 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 DataModels
|
|
{
|
|
/// <summary>
|
|
/// Database : UserService
|
|
/// Data Source : srvbo
|
|
/// Server Version : 5.5.5-10.3.22-MariaDB-1ubuntu1
|
|
/// </summary>
|
|
public partial class UserServiceDB : LinqToDB.Data.DataConnection
|
|
{
|
|
public ITable<Member> Members { get { return this.GetTable<Member>(); } }
|
|
public ITable<MembersMember> MembersMembers { get { return this.GetTable<MembersMember>(); } }
|
|
public ITable<Node> Nodes { get { return this.GetTable<Node>(); } }
|
|
public ITable<OrganizationUnit> OrganizationUnits { get { return this.GetTable<OrganizationUnit>(); } }
|
|
public ITable<SecurityGroup> SecurityGroups { get { return this.GetTable<SecurityGroup>(); } }
|
|
public ITable<User> Users { get { return this.GetTable<User>(); } }
|
|
|
|
public UserServiceDB()
|
|
{
|
|
InitDataContext();
|
|
InitMappingSchema();
|
|
}
|
|
|
|
public UserServiceDB(string configuration)
|
|
: base(configuration)
|
|
{
|
|
InitDataContext();
|
|
InitMappingSchema();
|
|
}
|
|
|
|
partial void InitDataContext ();
|
|
partial void InitMappingSchema();
|
|
}
|
|
|
|
[Table("Members")]
|
|
public partial class Member
|
|
{
|
|
[Column, NotNull] public int Id { get; set; } // int(11)
|
|
|
|
#region Associations
|
|
|
|
/// <summary>
|
|
/// MembersMember_ibfk_2_BackReference
|
|
/// </summary>
|
|
[Association(ThisKey="Id", OtherKey="AttachedMemberId", CanBeNull=true, Relationship=Relationship.OneToMany, IsBackReference=true)]
|
|
public IEnumerable<MembersMember> MembersMemberibfks { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Members_ibfk_2
|
|
/// </summary>
|
|
[Association(ThisKey="Id", OtherKey="Id", CanBeNull=false, Relationship=Relationship.ManyToOne, KeyName="Members_ibfk_2", BackReferenceName="Membersibfks")]
|
|
public Node Node { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// SecurityGroups_ibfk_2_BackReference
|
|
/// </summary>
|
|
[Association(ThisKey="Id", OtherKey="Id", CanBeNull=true, Relationship=Relationship.OneToMany, IsBackReference=true)]
|
|
public IEnumerable<SecurityGroup> SecurityGroupsibfks { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Users_ibfk_2_BackReference
|
|
/// </summary>
|
|
[Association(ThisKey="Id", OtherKey="Id", CanBeNull=true, Relationship=Relationship.OneToMany, IsBackReference=true)]
|
|
public IEnumerable<User> Usersibfks { get; set; } = null!;
|
|
|
|
#endregion
|
|
}
|
|
|
|
[Table("MembersMember")]
|
|
public partial class MembersMember
|
|
{
|
|
[PrimaryKey(1), NotNull] public int MemberId { get; set; } // int(11)
|
|
[PrimaryKey(2), NotNull] public int AttachedMemberId { get; set; } // int(11)
|
|
|
|
#region Associations
|
|
|
|
/// <summary>
|
|
/// MembersMember_ibfk_2
|
|
/// </summary>
|
|
[Association(ThisKey="AttachedMemberId", OtherKey="Id", CanBeNull=false, Relationship=Relationship.ManyToOne, KeyName="MembersMember_ibfk_2", BackReferenceName="MembersMemberibfks")]
|
|
public Member AttachedMember { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// MembersMember_ibfk_3
|
|
/// </summary>
|
|
[Association(ThisKey="MemberId", OtherKey="Id", CanBeNull=false, Relationship=Relationship.ManyToOne, KeyName="MembersMember_ibfk_3", BackReferenceName="MembersMemberibfks")]
|
|
public SecurityGroup Member { get; set; } = null!;
|
|
|
|
#endregion
|
|
}
|
|
|
|
[Table("Nodes")]
|
|
public partial class Node
|
|
{
|
|
[PrimaryKey, Identity] public int Id { get; set; } // int(11)
|
|
[Column, NotNull ] public string CommonName { get; set; } = null!; // text
|
|
|
|
#region Associations
|
|
|
|
/// <summary>
|
|
/// Members_ibfk_2_BackReference
|
|
/// </summary>
|
|
[Association(ThisKey="Id", OtherKey="Id", CanBeNull=true, Relationship=Relationship.OneToMany, IsBackReference=true)]
|
|
public IEnumerable<Member> Membersibfks { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// OrganizationUnits_ibfk_2_BackReference
|
|
/// </summary>
|
|
[Association(ThisKey="Id", OtherKey="Id", CanBeNull=true, Relationship=Relationship.OneToMany, IsBackReference=true)]
|
|
public IEnumerable<OrganizationUnit> OrganizationUnitsibfks { get; set; } = null!;
|
|
|
|
#endregion
|
|
}
|
|
|
|
[Table("OrganizationUnits")]
|
|
public partial class OrganizationUnit
|
|
{
|
|
[Column, NotNull ] public int Id { get; set; } // int(11)
|
|
[Column, Nullable] public int? ManagerId { get; set; } // int(11)
|
|
[Column, Nullable] public int? ParentId { get; set; } // int(11)
|
|
|
|
#region Associations
|
|
|
|
/// <summary>
|
|
/// OrganizationUnits_ibfk_3_BackReference
|
|
/// </summary>
|
|
[Association(ThisKey="Id", OtherKey="ParentId", CanBeNull=true, Relationship=Relationship.OneToMany, IsBackReference=true)]
|
|
public IEnumerable<OrganizationUnit> Ibfks { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// OrganizationUnits_ibfk_2
|
|
/// </summary>
|
|
[Association(ThisKey="Id", OtherKey="Id", CanBeNull=false, Relationship=Relationship.ManyToOne, KeyName="OrganizationUnits_ibfk_2", BackReferenceName="OrganizationUnitsibfks")]
|
|
public Node Node { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// OrganizationUnits_ibfk_3
|
|
/// </summary>
|
|
[Association(ThisKey="ParentId", OtherKey="Id", CanBeNull=true, Relationship=Relationship.ManyToOne, KeyName="OrganizationUnits_ibfk_3", BackReferenceName="Ibfks")]
|
|
public OrganizationUnit? Parent { get; set; }
|
|
|
|
#endregion
|
|
}
|
|
|
|
[Table("SecurityGroups")]
|
|
public partial class SecurityGroup
|
|
{
|
|
[Column, NotNull] public int Id { get; set; } // int(11)
|
|
|
|
#region Associations
|
|
|
|
/// <summary>
|
|
/// SecurityGroups_ibfk_2
|
|
/// </summary>
|
|
[Association(ThisKey="Id", OtherKey="Id", CanBeNull=false, Relationship=Relationship.ManyToOne, KeyName="SecurityGroups_ibfk_2", BackReferenceName="SecurityGroupsibfks")]
|
|
public Member Member { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// MembersMember_ibfk_3_BackReference
|
|
/// </summary>
|
|
[Association(ThisKey="Id", OtherKey="MemberId", CanBeNull=true, Relationship=Relationship.OneToMany, IsBackReference=true)]
|
|
public IEnumerable<MembersMember> MembersMemberibfks { get; set; } = null!;
|
|
|
|
#endregion
|
|
}
|
|
|
|
[Table("Users")]
|
|
public partial class User
|
|
{
|
|
[Column, NotNull ] public int Id { get; set; } // int(11)
|
|
[Column, Nullable] public string? FirstName { get; set; } // text
|
|
[Column, Nullable] public string? LastName { get; set; } // text
|
|
[Column, NotNull ] public bool IsActive { get; set; } // bit(1)
|
|
|
|
#region Associations
|
|
|
|
/// <summary>
|
|
/// Users_ibfk_2
|
|
/// </summary>
|
|
[Association(ThisKey="Id", OtherKey="Id", CanBeNull=false, Relationship=Relationship.ManyToOne, KeyName="Users_ibfk_2", BackReferenceName="Usersibfks")]
|
|
public Member Member { get; set; } = null!;
|
|
|
|
#endregion
|
|
}
|
|
|
|
public static partial class TableExtensions
|
|
{
|
|
public static MembersMember Find(this ITable<MembersMember> table, int MemberId, int AttachedMemberId)
|
|
{
|
|
return table.FirstOrDefault(t =>
|
|
t.MemberId == MemberId &&
|
|
t.AttachedMemberId == AttachedMemberId);
|
|
}
|
|
|
|
public static Node Find(this ITable<Node> table, int Id)
|
|
{
|
|
return table.FirstOrDefault(t =>
|
|
t.Id == Id);
|
|
}
|
|
}
|
|
}
|
|
|
|
#pragma warning restore 1591
|