diff --git a/.gitignore b/.gitignore index b3a52364a..0ef329122 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ nbproject/ *.swp ## Build folders +Build/ build/ build_*/ install/ diff --git a/plugins/csharp/model/CsharpAstNode.cs b/plugins/csharp/DbModel/CsharpAstNode.cs similarity index 92% rename from plugins/csharp/model/CsharpAstNode.cs rename to plugins/csharp/DbModel/CsharpAstNode.cs index 182a2160e..5745a8543 100644 --- a/plugins/csharp/model/CsharpAstNode.cs +++ b/plugins/csharp/DbModel/CsharpAstNode.cs @@ -2,9 +2,9 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; -namespace CSharpParser.model +namespace DbModel { - enum AstSymbolTypeEnum + public enum AstSymbolTypeEnum { Variable, Method, @@ -17,7 +17,7 @@ enum AstSymbolTypeEnum } - enum AstTypeEnum + public enum AstTypeEnum { Declaration, Definition, @@ -27,10 +27,10 @@ enum AstTypeEnum Expression } - class CsharpAstNode + public class CsharpAstNode { public ulong Id { get; set; } - public string AstValue { get; set; } + public string? AstValue { get; set; } public AstSymbolTypeEnum AstSymbolType { get; set; } public AstTypeEnum AstType { get; set; } public Accessibility Accessibility { get; set; } @@ -38,7 +38,7 @@ class CsharpAstNode public long Location_range_start_column { get; set; } public long Location_range_end_line { get; set; } public long Location_range_end_column { get; set; } - public string Path { get; set; } + public string? Path { get; set; } public long EntityHash { get; set; } public SyntaxKind RawKind { get; set; } //SyntaxKind Enum public void SetLocation(FileLinePositionSpan f) diff --git a/plugins/csharp/model/CsharpClass.cs b/plugins/csharp/DbModel/CsharpClass.cs similarity index 50% rename from plugins/csharp/model/CsharpClass.cs rename to plugins/csharp/DbModel/CsharpClass.cs index fa6642923..151a0d271 100644 --- a/plugins/csharp/model/CsharpClass.cs +++ b/plugins/csharp/DbModel/CsharpClass.cs @@ -1,22 +1,22 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; -namespace CSharpParser.model +namespace DbModel { - enum ClassTypeEnum + public enum ClassTypeEnum { Class, Interface, Record } - class CsharpClass : CsharpEntity + public class CsharpClass : CsharpEntity { public ClassTypeEnum ClassType { get; set; } - public CsharpNamespace CsharpNamespace { get; set; } + public CsharpNamespace? CsharpNamespace { get; set; } } //[Table("csharp_structs")] - class CsharpStruct : CsharpEntity + public class CsharpStruct : CsharpEntity { - public CsharpNamespace CsharpNamespace { get; set; } + public CsharpNamespace? CsharpNamespace { get; set; } } } diff --git a/plugins/csharp/DbModel/CsharpDbContext.cs b/plugins/csharp/DbModel/CsharpDbContext.cs new file mode 100644 index 000000000..6cf2989da --- /dev/null +++ b/plugins/csharp/DbModel/CsharpDbContext.cs @@ -0,0 +1,48 @@ +using System.Text; +using Microsoft.EntityFrameworkCore; + +namespace DbModel +{ + public class CsharpDbContext : DbContext + { + + private readonly string _dbSystem; + private readonly string _connectionString; + public CsharpDbContext(DbContextOptions options) : base(options) { } + + public CsharpDbContext(string dbSystem, string connectionString) : base() + { + _dbSystem = dbSystem; + _connectionString = connectionString; + } + + public DbSet CsharpAstNodes { get; set; } + public DbSet CsharpNamespaces { get; set; } + public DbSet CsharpClasses { get; set; } + public DbSet CsharpMethods { get; set; } + public DbSet CsharpVariables { get; set; } + public DbSet CsharpStructs { get; set; } + public DbSet CsharpEnums { get; set; } + public DbSet CsharpEnumMembers { get; set; } + public DbSet CsharpEtcEntitys { get; set; } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + switch(_dbSystem) + { + case "pgsql": + optionsBuilder.UseNpgsql(_connectionString, + x => x.MigrationsAssembly("PgsqlMigrations")); + break; + case "sqlite": + optionsBuilder.UseSqlite(_connectionString, + x => x.MigrationsAssembly("SqliteMigrations")); + break; + default: + break; + } + } + + } + +} diff --git a/plugins/csharp/DbModel/CsharpEntity.cs b/plugins/csharp/DbModel/CsharpEntity.cs new file mode 100644 index 000000000..32e582099 --- /dev/null +++ b/plugins/csharp/DbModel/CsharpEntity.cs @@ -0,0 +1,33 @@ +using System; + +namespace DbModel +{ + public class CsharpEntity + { + public long Id { get; set; } + public CsharpAstNode? AstNode { get; set; } + public CsharpAstNode? ParentNode{ get; set; } + public long EntityHash { get; set; } + public String? Name { get; set; } = " "; + public String? QualifiedName { get; set; } = " "; + public string? DocumentationCommentXML { get; set; } = " "; + } + + public class CsharpTypedEntity : CsharpEntity + { + public long TypeHash { get; set; } + public String? QualifiedType { get; set; } = " "; + } + + public enum EtcEntityTypeEnum + { + Event, + Invocation, + ForeachExpr + } + public class CsharpEtcEntity : CsharpTypedEntity + { + public EtcEntityTypeEnum EtcEntityType { get; set; } + public ulong DeclaratorNodeId { get; set; } + } +} diff --git a/plugins/csharp/model/CsharpEnum.cs b/plugins/csharp/DbModel/CsharpEnum.cs similarity index 74% rename from plugins/csharp/model/CsharpEnum.cs rename to plugins/csharp/DbModel/CsharpEnum.cs index 5597d05d8..72e9e8c41 100644 --- a/plugins/csharp/model/CsharpEnum.cs +++ b/plugins/csharp/DbModel/CsharpEnum.cs @@ -1,12 +1,12 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; -namespace CSharpParser.model +namespace DbModel { //[Table("csharp_enums")] - class CsharpEnum : CsharpEntity + public class CsharpEnum : CsharpEntity { - public CsharpNamespace CsharpNamespace { get; set; } + public CsharpNamespace? CsharpNamespace { get; set; } public HashSet CsharpEnumMembers { get; set; } = new HashSet(); public void AddMember(CsharpEnumMember member) diff --git a/plugins/csharp/model/CsharpEnumMember.cs b/plugins/csharp/DbModel/CsharpEnumMember.cs similarity index 57% rename from plugins/csharp/model/CsharpEnumMember.cs rename to plugins/csharp/DbModel/CsharpEnumMember.cs index 835147ea1..671fc64e1 100644 --- a/plugins/csharp/model/CsharpEnumMember.cs +++ b/plugins/csharp/DbModel/CsharpEnumMember.cs @@ -1,10 +1,11 @@ using System.ComponentModel.DataAnnotations.Schema; -namespace CSharpParser.model +namespace DbModel { //[Table("csharp_enum_members")] - class CsharpEnumMember : CsharpEntity + public class CsharpEnumMember : CsharpEntity { public int EqualsValue { get; set; } + public long? CsharpEnumId { get; set; } } } diff --git a/plugins/csharp/model/CsharpMethod.cs b/plugins/csharp/DbModel/CsharpMethod.cs similarity index 70% rename from plugins/csharp/model/CsharpMethod.cs rename to plugins/csharp/DbModel/CsharpMethod.cs index 087053af3..985164b8b 100644 --- a/plugins/csharp/model/CsharpMethod.cs +++ b/plugins/csharp/DbModel/CsharpMethod.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; -namespace CSharpParser.model +namespace DbModel { - enum MethodTypeEnum + public enum MethodTypeEnum { Delegate, Accessor, @@ -12,7 +12,7 @@ enum MethodTypeEnum Operator } - class CsharpMethod : CsharpTypedEntity + public class CsharpMethod : CsharpTypedEntity { public MethodTypeEnum MethodType { get; set; } } diff --git a/plugins/csharp/model/CsharpNamespace.cs b/plugins/csharp/DbModel/CsharpNamespace.cs similarity index 66% rename from plugins/csharp/model/CsharpNamespace.cs rename to plugins/csharp/DbModel/CsharpNamespace.cs index 8b4cdc4fd..8fe4b1f9d 100644 --- a/plugins/csharp/model/CsharpNamespace.cs +++ b/plugins/csharp/DbModel/CsharpNamespace.cs @@ -1,10 +1,10 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; -namespace CSharpParser.model +namespace DbModel { //[Table("csharp_namespaces")] - class CsharpNamespace : CsharpEntity + public class CsharpNamespace : CsharpEntity { } diff --git a/plugins/csharp/model/CsharpVariable.cs b/plugins/csharp/DbModel/CsharpVariable.cs similarity index 71% rename from plugins/csharp/model/CsharpVariable.cs rename to plugins/csharp/DbModel/CsharpVariable.cs index 9b3a7b1e3..261c1c7d0 100644 --- a/plugins/csharp/model/CsharpVariable.cs +++ b/plugins/csharp/DbModel/CsharpVariable.cs @@ -1,16 +1,16 @@ using System.ComponentModel.DataAnnotations.Schema; using Microsoft.CodeAnalysis.CSharp.Syntax; -namespace CSharpParser.model +namespace DbModel { - enum VariableTypeEnum + public enum VariableTypeEnum { Property, LINQ, Parameter, Variable } - class CsharpVariable : CsharpTypedEntity + public class CsharpVariable : CsharpTypedEntity { public VariableTypeEnum VariableType { get; set; } } diff --git a/plugins/csharp/DbModel/DbModel.csproj b/plugins/csharp/DbModel/DbModel.csproj new file mode 100644 index 000000000..70fbcf4cf --- /dev/null +++ b/plugins/csharp/DbModel/DbModel.csproj @@ -0,0 +1,27 @@ + + + + net8.0 + enable + enable + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + diff --git a/plugins/csharp/Migrations/PgsqlMigrations/20220518134047_Initial.Designer.cs b/plugins/csharp/Migrations/PgsqlMigrations/20220518134047_Initial.Designer.cs new file mode 100644 index 000000000..51b8413c4 --- /dev/null +++ b/plugins/csharp/Migrations/PgsqlMigrations/20220518134047_Initial.Designer.cs @@ -0,0 +1,545 @@ +// +using System; +using DbModel; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +namespace Migrations.PgsqlMigrations +{ + [DbContext(typeof(CsharpDbContext))] + [Migration("20220518134047_Initial")] + partial class Initial + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "5.0.10") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + modelBuilder.Entity("DbModel.CsharpAstNode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("numeric(20,0)"); + + b.Property("Accessibility") + .HasColumnType("integer"); + + b.Property("AstSymbolType") + .HasColumnType("integer"); + + b.Property("AstType") + .HasColumnType("integer"); + + b.Property("AstValue") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("Location_range_end_column") + .HasColumnType("bigint"); + + b.Property("Location_range_end_line") + .HasColumnType("bigint"); + + b.Property("Location_range_start_column") + .HasColumnType("bigint"); + + b.Property("Location_range_start_line") + .HasColumnType("bigint"); + + b.Property("Path") + .HasColumnType("text"); + + b.Property("RawKind") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("CsharpAstNodes"); + }); + + modelBuilder.Entity("DbModel.CsharpClass", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("ClassType") + .HasColumnType("integer"); + + b.Property("CsharpNamespaceId") + .HasColumnType("bigint"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpNamespaceId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpClasses"); + }); + + modelBuilder.Entity("DbModel.CsharpEnum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("CsharpNamespaceId") + .HasColumnType("bigint"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpNamespaceId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpEnums"); + }); + + modelBuilder.Entity("DbModel.CsharpEnumMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("CsharpEnumId") + .HasColumnType("bigint"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("EqualsValue") + .HasColumnType("integer"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpEnumId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpEnumMembers"); + }); + + modelBuilder.Entity("DbModel.CsharpEtcEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("DeclaratorNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("EtcEntityType") + .HasColumnType("integer"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.Property("QualifiedType") + .HasColumnType("text"); + + b.Property("TypeHash") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpEtcEntitys"); + }); + + modelBuilder.Entity("DbModel.CsharpMethod", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("MethodType") + .HasColumnType("integer"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.Property("QualifiedType") + .HasColumnType("text"); + + b.Property("TypeHash") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpMethods"); + }); + + modelBuilder.Entity("DbModel.CsharpNamespace", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpNamespaces"); + }); + + modelBuilder.Entity("DbModel.CsharpStruct", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("CsharpNamespaceId") + .HasColumnType("bigint"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpNamespaceId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpStructs"); + }); + + modelBuilder.Entity("DbModel.CsharpVariable", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.Property("QualifiedType") + .HasColumnType("text"); + + b.Property("TypeHash") + .HasColumnType("bigint"); + + b.Property("VariableType") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpVariables"); + }); + + modelBuilder.Entity("DbModel.CsharpClass", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpNamespace", "CsharpNamespace") + .WithMany() + .HasForeignKey("CsharpNamespaceId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("CsharpNamespace"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpEnum", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpNamespace", "CsharpNamespace") + .WithMany() + .HasForeignKey("CsharpNamespaceId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("CsharpNamespace"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpEnumMember", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpEnum", null) + .WithMany("CsharpEnumMembers") + .HasForeignKey("CsharpEnumId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpEtcEntity", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpMethod", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpNamespace", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpStruct", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpNamespace", "CsharpNamespace") + .WithMany() + .HasForeignKey("CsharpNamespaceId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("CsharpNamespace"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpVariable", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpEnum", b => + { + b.Navigation("CsharpEnumMembers"); + }); +#pragma warning restore 612, 618 + } + } +} \ No newline at end of file diff --git a/plugins/csharp/Migrations/PgsqlMigrations/20220518134047_Initial.cs b/plugins/csharp/Migrations/PgsqlMigrations/20220518134047_Initial.cs new file mode 100644 index 000000000..72de7b274 --- /dev/null +++ b/plugins/csharp/Migrations/PgsqlMigrations/20220518134047_Initial.cs @@ -0,0 +1,443 @@ +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +namespace Migrations.PgsqlMigrations +{ + public partial class Initial : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "CsharpAstNodes", + columns: table => new + { + Id = table.Column(type: "numeric(20,0)", nullable: false), + AstValue = table.Column(type: "text", nullable: true), + AstSymbolType = table.Column(type: "integer", nullable: false), + AstType = table.Column(type: "integer", nullable: false), + Accessibility = table.Column(type: "integer", nullable: false), + Location_range_start_line = table.Column(type: "bigint", nullable: false), + Location_range_start_column = table.Column(type: "bigint", nullable: false), + Location_range_end_line = table.Column(type: "bigint", nullable: false), + Location_range_end_column = table.Column(type: "bigint", nullable: false), + Path = table.Column(type: "text", nullable: true), + EntityHash = table.Column(type: "bigint", nullable: false), + RawKind = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpAstNodes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CsharpEtcEntitys", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + EtcEntityType = table.Column(type: "integer", nullable: false), + DeclaratorNodeId = table.Column(type: "numeric(20,0)", nullable: false), + AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), + ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), + EntityHash = table.Column(type: "bigint", nullable: false), + Name = table.Column(type: "text", nullable: true), + QualifiedName = table.Column(type: "text", nullable: true), + DocumentationCommentXML = table.Column(type: "text", nullable: true), + TypeHash = table.Column(type: "bigint", nullable: false), + QualifiedType = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpEtcEntitys", x => x.Id); + table.ForeignKey( + name: "FK_CsharpEtcEntitys_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CsharpEtcEntitys_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "CsharpMethods", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + MethodType = table.Column(type: "integer", nullable: false), + AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), + ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), + EntityHash = table.Column(type: "bigint", nullable: false), + Name = table.Column(type: "text", nullable: true), + QualifiedName = table.Column(type: "text", nullable: true), + DocumentationCommentXML = table.Column(type: "text", nullable: true), + TypeHash = table.Column(type: "bigint", nullable: false), + QualifiedType = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpMethods", x => x.Id); + table.ForeignKey( + name: "FK_CsharpMethods_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CsharpMethods_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "CsharpNamespaces", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), + ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), + EntityHash = table.Column(type: "bigint", nullable: false), + Name = table.Column(type: "text", nullable: true), + QualifiedName = table.Column(type: "text", nullable: true), + DocumentationCommentXML = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpNamespaces", x => x.Id); + table.ForeignKey( + name: "FK_CsharpNamespaces_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CsharpNamespaces_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "CsharpVariables", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + VariableType = table.Column(type: "integer", nullable: false), + AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), + ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), + EntityHash = table.Column(type: "bigint", nullable: false), + Name = table.Column(type: "text", nullable: true), + QualifiedName = table.Column(type: "text", nullable: true), + DocumentationCommentXML = table.Column(type: "text", nullable: true), + TypeHash = table.Column(type: "bigint", nullable: false), + QualifiedType = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpVariables", x => x.Id); + table.ForeignKey( + name: "FK_CsharpVariables_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CsharpVariables_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "CsharpClasses", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + ClassType = table.Column(type: "integer", nullable: false), + CsharpNamespaceId = table.Column(type: "bigint", nullable: true), + AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), + ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), + EntityHash = table.Column(type: "bigint", nullable: false), + Name = table.Column(type: "text", nullable: true), + QualifiedName = table.Column(type: "text", nullable: true), + DocumentationCommentXML = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpClasses", x => x.Id); + table.ForeignKey( + name: "FK_CsharpClasses_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CsharpClasses_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CsharpClasses_CsharpNamespaces_CsharpNamespaceId", + column: x => x.CsharpNamespaceId, + principalTable: "CsharpNamespaces", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "CsharpEnums", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + CsharpNamespaceId = table.Column(type: "bigint", nullable: true), + AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), + ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), + EntityHash = table.Column(type: "bigint", nullable: false), + Name = table.Column(type: "text", nullable: true), + QualifiedName = table.Column(type: "text", nullable: true), + DocumentationCommentXML = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpEnums", x => x.Id); + table.ForeignKey( + name: "FK_CsharpEnums_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CsharpEnums_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CsharpEnums_CsharpNamespaces_CsharpNamespaceId", + column: x => x.CsharpNamespaceId, + principalTable: "CsharpNamespaces", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "CsharpStructs", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + CsharpNamespaceId = table.Column(type: "bigint", nullable: true), + AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), + ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), + EntityHash = table.Column(type: "bigint", nullable: false), + Name = table.Column(type: "text", nullable: true), + QualifiedName = table.Column(type: "text", nullable: true), + DocumentationCommentXML = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpStructs", x => x.Id); + table.ForeignKey( + name: "FK_CsharpStructs_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CsharpStructs_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CsharpStructs_CsharpNamespaces_CsharpNamespaceId", + column: x => x.CsharpNamespaceId, + principalTable: "CsharpNamespaces", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "CsharpEnumMembers", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + EqualsValue = table.Column(type: "integer", nullable: false), + CsharpEnumId = table.Column(type: "bigint", nullable: true), + AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), + ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), + EntityHash = table.Column(type: "bigint", nullable: false), + Name = table.Column(type: "text", nullable: true), + QualifiedName = table.Column(type: "text", nullable: true), + DocumentationCommentXML = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpEnumMembers", x => x.Id); + table.ForeignKey( + name: "FK_CsharpEnumMembers_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CsharpEnumMembers_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CsharpEnumMembers_CsharpEnums_CsharpEnumId", + column: x => x.CsharpEnumId, + principalTable: "CsharpEnums", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_CsharpClasses_AstNodeId", + table: "CsharpClasses", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpClasses_CsharpNamespaceId", + table: "CsharpClasses", + column: "CsharpNamespaceId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpClasses_ParentNodeId", + table: "CsharpClasses", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEnumMembers_AstNodeId", + table: "CsharpEnumMembers", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEnumMembers_CsharpEnumId", + table: "CsharpEnumMembers", + column: "CsharpEnumId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEnumMembers_ParentNodeId", + table: "CsharpEnumMembers", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEnums_AstNodeId", + table: "CsharpEnums", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEnums_CsharpNamespaceId", + table: "CsharpEnums", + column: "CsharpNamespaceId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEnums_ParentNodeId", + table: "CsharpEnums", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEtcEntitys_AstNodeId", + table: "CsharpEtcEntitys", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEtcEntitys_ParentNodeId", + table: "CsharpEtcEntitys", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpMethods_AstNodeId", + table: "CsharpMethods", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpMethods_ParentNodeId", + table: "CsharpMethods", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpNamespaces_AstNodeId", + table: "CsharpNamespaces", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpNamespaces_ParentNodeId", + table: "CsharpNamespaces", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpStructs_AstNodeId", + table: "CsharpStructs", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpStructs_CsharpNamespaceId", + table: "CsharpStructs", + column: "CsharpNamespaceId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpStructs_ParentNodeId", + table: "CsharpStructs", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpVariables_AstNodeId", + table: "CsharpVariables", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpVariables_ParentNodeId", + table: "CsharpVariables", + column: "ParentNodeId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "CsharpClasses"); + + migrationBuilder.DropTable( + name: "CsharpEnumMembers"); + + migrationBuilder.DropTable( + name: "CsharpEtcEntitys"); + + migrationBuilder.DropTable( + name: "CsharpMethods"); + + migrationBuilder.DropTable( + name: "CsharpStructs"); + + migrationBuilder.DropTable( + name: "CsharpVariables"); + + migrationBuilder.DropTable( + name: "CsharpEnums"); + + migrationBuilder.DropTable( + name: "CsharpNamespaces"); + + migrationBuilder.DropTable( + name: "CsharpAstNodes"); + } + } +} \ No newline at end of file diff --git a/plugins/csharp/Migrations/PgsqlMigrations/CsharpDbContextModelSnapshot.cs b/plugins/csharp/Migrations/PgsqlMigrations/CsharpDbContextModelSnapshot.cs new file mode 100644 index 000000000..eb8f2020e --- /dev/null +++ b/plugins/csharp/Migrations/PgsqlMigrations/CsharpDbContextModelSnapshot.cs @@ -0,0 +1,543 @@ +// +using System; +using DbModel; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +namespace Migrations.PgsqlMigrations +{ + [DbContext(typeof(CsharpDbContext))] + partial class CsharpDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "5.0.10") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + modelBuilder.Entity("DbModel.CsharpAstNode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("numeric(20,0)"); + + b.Property("Accessibility") + .HasColumnType("integer"); + + b.Property("AstSymbolType") + .HasColumnType("integer"); + + b.Property("AstType") + .HasColumnType("integer"); + + b.Property("AstValue") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("Location_range_end_column") + .HasColumnType("bigint"); + + b.Property("Location_range_end_line") + .HasColumnType("bigint"); + + b.Property("Location_range_start_column") + .HasColumnType("bigint"); + + b.Property("Location_range_start_line") + .HasColumnType("bigint"); + + b.Property("Path") + .HasColumnType("text"); + + b.Property("RawKind") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("CsharpAstNodes"); + }); + + modelBuilder.Entity("DbModel.CsharpClass", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("ClassType") + .HasColumnType("integer"); + + b.Property("CsharpNamespaceId") + .HasColumnType("bigint"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpNamespaceId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpClasses"); + }); + + modelBuilder.Entity("DbModel.CsharpEnum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("CsharpNamespaceId") + .HasColumnType("bigint"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpNamespaceId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpEnums"); + }); + + modelBuilder.Entity("DbModel.CsharpEnumMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("CsharpEnumId") + .HasColumnType("bigint"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("EqualsValue") + .HasColumnType("integer"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpEnumId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpEnumMembers"); + }); + + modelBuilder.Entity("DbModel.CsharpEtcEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("DeclaratorNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("EtcEntityType") + .HasColumnType("integer"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.Property("QualifiedType") + .HasColumnType("text"); + + b.Property("TypeHash") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpEtcEntitys"); + }); + + modelBuilder.Entity("DbModel.CsharpMethod", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("MethodType") + .HasColumnType("integer"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.Property("QualifiedType") + .HasColumnType("text"); + + b.Property("TypeHash") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpMethods"); + }); + + modelBuilder.Entity("DbModel.CsharpNamespace", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpNamespaces"); + }); + + modelBuilder.Entity("DbModel.CsharpStruct", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("CsharpNamespaceId") + .HasColumnType("bigint"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpNamespaceId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpStructs"); + }); + + modelBuilder.Entity("DbModel.CsharpVariable", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.Property("QualifiedType") + .HasColumnType("text"); + + b.Property("TypeHash") + .HasColumnType("bigint"); + + b.Property("VariableType") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpVariables"); + }); + + modelBuilder.Entity("DbModel.CsharpClass", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpNamespace", "CsharpNamespace") + .WithMany() + .HasForeignKey("CsharpNamespaceId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("CsharpNamespace"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpEnum", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpNamespace", "CsharpNamespace") + .WithMany() + .HasForeignKey("CsharpNamespaceId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("CsharpNamespace"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpEnumMember", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpEnum", null) + .WithMany("CsharpEnumMembers") + .HasForeignKey("CsharpEnumId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpEtcEntity", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpMethod", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpNamespace", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpStruct", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpNamespace", "CsharpNamespace") + .WithMany() + .HasForeignKey("CsharpNamespaceId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("CsharpNamespace"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpVariable", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpEnum", b => + { + b.Navigation("CsharpEnumMembers"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/plugins/csharp/Migrations/PgsqlMigrations/PgsqlMigrations.csproj b/plugins/csharp/Migrations/PgsqlMigrations/PgsqlMigrations.csproj new file mode 100644 index 000000000..26b4169dd --- /dev/null +++ b/plugins/csharp/Migrations/PgsqlMigrations/PgsqlMigrations.csproj @@ -0,0 +1,21 @@ + + + + net8.0 + enable + enable + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + diff --git a/plugins/csharp/Migrations/SqliteMigrations/20260302184000_Initial.Designer.cs b/plugins/csharp/Migrations/SqliteMigrations/20260302184000_Initial.Designer.cs new file mode 100644 index 000000000..434da8be7 --- /dev/null +++ b/plugins/csharp/Migrations/SqliteMigrations/20260302184000_Initial.Designer.cs @@ -0,0 +1,536 @@ +// +using System; +using DbModel; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Migrations.SqliteMigrations +{ + [DbContext(typeof(CsharpDbContext))] + [Migration("20260302184000_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "8.0.20"); + + modelBuilder.Entity("DbModel.CsharpAstNode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Accessibility") + .HasColumnType("INTEGER"); + + b.Property("AstSymbolType") + .HasColumnType("INTEGER"); + + b.Property("AstType") + .HasColumnType("INTEGER"); + + b.Property("AstValue") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("Location_range_end_column") + .HasColumnType("INTEGER"); + + b.Property("Location_range_end_line") + .HasColumnType("INTEGER"); + + b.Property("Location_range_start_column") + .HasColumnType("INTEGER"); + + b.Property("Location_range_start_line") + .HasColumnType("INTEGER"); + + b.Property("Path") + .HasColumnType("TEXT"); + + b.Property("RawKind") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("CsharpAstNodes"); + }); + + modelBuilder.Entity("DbModel.CsharpClass", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("ClassType") + .HasColumnType("INTEGER"); + + b.Property("CsharpNamespaceId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpNamespaceId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpClasses"); + }); + + modelBuilder.Entity("DbModel.CsharpEnum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("CsharpNamespaceId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpNamespaceId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpEnums"); + }); + + modelBuilder.Entity("DbModel.CsharpEnumMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("CsharpEnumId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("EqualsValue") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpEnumId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpEnumMembers"); + }); + + modelBuilder.Entity("DbModel.CsharpEtcEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("DeclaratorNodeId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("EtcEntityType") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.Property("QualifiedType") + .HasColumnType("TEXT"); + + b.Property("TypeHash") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpEtcEntitys"); + }); + + modelBuilder.Entity("DbModel.CsharpMethod", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("MethodType") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.Property("QualifiedType") + .HasColumnType("TEXT"); + + b.Property("TypeHash") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpMethods"); + }); + + modelBuilder.Entity("DbModel.CsharpNamespace", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpNamespaces"); + }); + + modelBuilder.Entity("DbModel.CsharpStruct", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("CsharpNamespaceId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpNamespaceId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpStructs"); + }); + + modelBuilder.Entity("DbModel.CsharpVariable", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.Property("QualifiedType") + .HasColumnType("TEXT"); + + b.Property("TypeHash") + .HasColumnType("INTEGER"); + + b.Property("VariableType") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpVariables"); + }); + + modelBuilder.Entity("DbModel.CsharpClass", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpNamespace", "CsharpNamespace") + .WithMany() + .HasForeignKey("CsharpNamespaceId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("CsharpNamespace"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpEnum", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpNamespace", "CsharpNamespace") + .WithMany() + .HasForeignKey("CsharpNamespaceId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("CsharpNamespace"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpEnumMember", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpEnum", null) + .WithMany("CsharpEnumMembers") + .HasForeignKey("CsharpEnumId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpEtcEntity", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpMethod", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpNamespace", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpStruct", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpNamespace", "CsharpNamespace") + .WithMany() + .HasForeignKey("CsharpNamespaceId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("CsharpNamespace"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpVariable", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpEnum", b => + { + b.Navigation("CsharpEnumMembers"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/plugins/csharp/Migrations/SqliteMigrations/20260302184000_Initial.cs b/plugins/csharp/Migrations/SqliteMigrations/20260302184000_Initial.cs new file mode 100644 index 000000000..93c3620df --- /dev/null +++ b/plugins/csharp/Migrations/SqliteMigrations/20260302184000_Initial.cs @@ -0,0 +1,428 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Migrations.SqliteMigrations +{ + /// + public partial class Initial : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "CsharpAstNodes", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + AstValue = table.Column(type: "TEXT", nullable: true), + AstSymbolType = table.Column(type: "INTEGER", nullable: false), + AstType = table.Column(type: "INTEGER", nullable: false), + Accessibility = table.Column(type: "INTEGER", nullable: false), + Location_range_start_line = table.Column(type: "INTEGER", nullable: false), + Location_range_start_column = table.Column(type: "INTEGER", nullable: false), + Location_range_end_line = table.Column(type: "INTEGER", nullable: false), + Location_range_end_column = table.Column(type: "INTEGER", nullable: false), + Path = table.Column(type: "TEXT", nullable: true), + EntityHash = table.Column(type: "INTEGER", nullable: false), + RawKind = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpAstNodes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CsharpEtcEntitys", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + EtcEntityType = table.Column(type: "INTEGER", nullable: false), + DeclaratorNodeId = table.Column(type: "INTEGER", nullable: false), + AstNodeId = table.Column(type: "INTEGER", nullable: true), + ParentNodeId = table.Column(type: "INTEGER", nullable: true), + EntityHash = table.Column(type: "INTEGER", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + QualifiedName = table.Column(type: "TEXT", nullable: true), + DocumentationCommentXML = table.Column(type: "TEXT", nullable: true), + TypeHash = table.Column(type: "INTEGER", nullable: false), + QualifiedType = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpEtcEntitys", x => x.Id); + table.ForeignKey( + name: "FK_CsharpEtcEntitys_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CsharpEtcEntitys_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "CsharpMethods", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + MethodType = table.Column(type: "INTEGER", nullable: false), + AstNodeId = table.Column(type: "INTEGER", nullable: true), + ParentNodeId = table.Column(type: "INTEGER", nullable: true), + EntityHash = table.Column(type: "INTEGER", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + QualifiedName = table.Column(type: "TEXT", nullable: true), + DocumentationCommentXML = table.Column(type: "TEXT", nullable: true), + TypeHash = table.Column(type: "INTEGER", nullable: false), + QualifiedType = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpMethods", x => x.Id); + table.ForeignKey( + name: "FK_CsharpMethods_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CsharpMethods_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "CsharpNamespaces", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + AstNodeId = table.Column(type: "INTEGER", nullable: true), + ParentNodeId = table.Column(type: "INTEGER", nullable: true), + EntityHash = table.Column(type: "INTEGER", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + QualifiedName = table.Column(type: "TEXT", nullable: true), + DocumentationCommentXML = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpNamespaces", x => x.Id); + table.ForeignKey( + name: "FK_CsharpNamespaces_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CsharpNamespaces_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "CsharpVariables", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + VariableType = table.Column(type: "INTEGER", nullable: false), + AstNodeId = table.Column(type: "INTEGER", nullable: true), + ParentNodeId = table.Column(type: "INTEGER", nullable: true), + EntityHash = table.Column(type: "INTEGER", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + QualifiedName = table.Column(type: "TEXT", nullable: true), + DocumentationCommentXML = table.Column(type: "TEXT", nullable: true), + TypeHash = table.Column(type: "INTEGER", nullable: false), + QualifiedType = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpVariables", x => x.Id); + table.ForeignKey( + name: "FK_CsharpVariables_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CsharpVariables_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "CsharpClasses", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ClassType = table.Column(type: "INTEGER", nullable: false), + CsharpNamespaceId = table.Column(type: "INTEGER", nullable: true), + AstNodeId = table.Column(type: "INTEGER", nullable: true), + ParentNodeId = table.Column(type: "INTEGER", nullable: true), + EntityHash = table.Column(type: "INTEGER", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + QualifiedName = table.Column(type: "TEXT", nullable: true), + DocumentationCommentXML = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpClasses", x => x.Id); + table.ForeignKey( + name: "FK_CsharpClasses_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CsharpClasses_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CsharpClasses_CsharpNamespaces_CsharpNamespaceId", + column: x => x.CsharpNamespaceId, + principalTable: "CsharpNamespaces", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "CsharpEnums", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + CsharpNamespaceId = table.Column(type: "INTEGER", nullable: true), + AstNodeId = table.Column(type: "INTEGER", nullable: true), + ParentNodeId = table.Column(type: "INTEGER", nullable: true), + EntityHash = table.Column(type: "INTEGER", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + QualifiedName = table.Column(type: "TEXT", nullable: true), + DocumentationCommentXML = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpEnums", x => x.Id); + table.ForeignKey( + name: "FK_CsharpEnums_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CsharpEnums_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CsharpEnums_CsharpNamespaces_CsharpNamespaceId", + column: x => x.CsharpNamespaceId, + principalTable: "CsharpNamespaces", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "CsharpStructs", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + CsharpNamespaceId = table.Column(type: "INTEGER", nullable: true), + AstNodeId = table.Column(type: "INTEGER", nullable: true), + ParentNodeId = table.Column(type: "INTEGER", nullable: true), + EntityHash = table.Column(type: "INTEGER", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + QualifiedName = table.Column(type: "TEXT", nullable: true), + DocumentationCommentXML = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpStructs", x => x.Id); + table.ForeignKey( + name: "FK_CsharpStructs_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CsharpStructs_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CsharpStructs_CsharpNamespaces_CsharpNamespaceId", + column: x => x.CsharpNamespaceId, + principalTable: "CsharpNamespaces", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "CsharpEnumMembers", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + EqualsValue = table.Column(type: "INTEGER", nullable: false), + CsharpEnumId = table.Column(type: "INTEGER", nullable: true), + AstNodeId = table.Column(type: "INTEGER", nullable: true), + ParentNodeId = table.Column(type: "INTEGER", nullable: true), + EntityHash = table.Column(type: "INTEGER", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + QualifiedName = table.Column(type: "TEXT", nullable: true), + DocumentationCommentXML = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpEnumMembers", x => x.Id); + table.ForeignKey( + name: "FK_CsharpEnumMembers_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CsharpEnumMembers_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CsharpEnumMembers_CsharpEnums_CsharpEnumId", + column: x => x.CsharpEnumId, + principalTable: "CsharpEnums", + principalColumn: "Id"); + }); + + migrationBuilder.CreateIndex( + name: "IX_CsharpClasses_AstNodeId", + table: "CsharpClasses", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpClasses_CsharpNamespaceId", + table: "CsharpClasses", + column: "CsharpNamespaceId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpClasses_ParentNodeId", + table: "CsharpClasses", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEnumMembers_AstNodeId", + table: "CsharpEnumMembers", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEnumMembers_CsharpEnumId", + table: "CsharpEnumMembers", + column: "CsharpEnumId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEnumMembers_ParentNodeId", + table: "CsharpEnumMembers", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEnums_AstNodeId", + table: "CsharpEnums", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEnums_CsharpNamespaceId", + table: "CsharpEnums", + column: "CsharpNamespaceId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEnums_ParentNodeId", + table: "CsharpEnums", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEtcEntitys_AstNodeId", + table: "CsharpEtcEntitys", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEtcEntitys_ParentNodeId", + table: "CsharpEtcEntitys", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpMethods_AstNodeId", + table: "CsharpMethods", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpMethods_ParentNodeId", + table: "CsharpMethods", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpNamespaces_AstNodeId", + table: "CsharpNamespaces", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpNamespaces_ParentNodeId", + table: "CsharpNamespaces", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpStructs_AstNodeId", + table: "CsharpStructs", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpStructs_CsharpNamespaceId", + table: "CsharpStructs", + column: "CsharpNamespaceId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpStructs_ParentNodeId", + table: "CsharpStructs", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpVariables_AstNodeId", + table: "CsharpVariables", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpVariables_ParentNodeId", + table: "CsharpVariables", + column: "ParentNodeId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "CsharpClasses"); + + migrationBuilder.DropTable( + name: "CsharpEnumMembers"); + + migrationBuilder.DropTable( + name: "CsharpEtcEntitys"); + + migrationBuilder.DropTable( + name: "CsharpMethods"); + + migrationBuilder.DropTable( + name: "CsharpStructs"); + + migrationBuilder.DropTable( + name: "CsharpVariables"); + + migrationBuilder.DropTable( + name: "CsharpEnums"); + + migrationBuilder.DropTable( + name: "CsharpNamespaces"); + + migrationBuilder.DropTable( + name: "CsharpAstNodes"); + } + } +} diff --git a/plugins/csharp/Migrations/SqliteMigrations/SqliteDbContextModelSnapshot.cs b/plugins/csharp/Migrations/SqliteMigrations/SqliteDbContextModelSnapshot.cs new file mode 100644 index 000000000..491bb2166 --- /dev/null +++ b/plugins/csharp/Migrations/SqliteMigrations/SqliteDbContextModelSnapshot.cs @@ -0,0 +1,533 @@ +// +using System; +using DbModel; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Migrations.SqliteMigrations +{ + [DbContext(typeof(CsharpDbContext))] + partial class SqliteDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "8.0.20"); + + modelBuilder.Entity("DbModel.CsharpAstNode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Accessibility") + .HasColumnType("INTEGER"); + + b.Property("AstSymbolType") + .HasColumnType("INTEGER"); + + b.Property("AstType") + .HasColumnType("INTEGER"); + + b.Property("AstValue") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("Location_range_end_column") + .HasColumnType("INTEGER"); + + b.Property("Location_range_end_line") + .HasColumnType("INTEGER"); + + b.Property("Location_range_start_column") + .HasColumnType("INTEGER"); + + b.Property("Location_range_start_line") + .HasColumnType("INTEGER"); + + b.Property("Path") + .HasColumnType("TEXT"); + + b.Property("RawKind") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("CsharpAstNodes"); + }); + + modelBuilder.Entity("DbModel.CsharpClass", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("ClassType") + .HasColumnType("INTEGER"); + + b.Property("CsharpNamespaceId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpNamespaceId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpClasses"); + }); + + modelBuilder.Entity("DbModel.CsharpEnum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("CsharpNamespaceId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpNamespaceId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpEnums"); + }); + + modelBuilder.Entity("DbModel.CsharpEnumMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("CsharpEnumId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("EqualsValue") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpEnumId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpEnumMembers"); + }); + + modelBuilder.Entity("DbModel.CsharpEtcEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("DeclaratorNodeId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("EtcEntityType") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.Property("QualifiedType") + .HasColumnType("TEXT"); + + b.Property("TypeHash") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpEtcEntitys"); + }); + + modelBuilder.Entity("DbModel.CsharpMethod", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("MethodType") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.Property("QualifiedType") + .HasColumnType("TEXT"); + + b.Property("TypeHash") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpMethods"); + }); + + modelBuilder.Entity("DbModel.CsharpNamespace", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpNamespaces"); + }); + + modelBuilder.Entity("DbModel.CsharpStruct", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("CsharpNamespaceId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpNamespaceId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpStructs"); + }); + + modelBuilder.Entity("DbModel.CsharpVariable", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.Property("QualifiedType") + .HasColumnType("TEXT"); + + b.Property("TypeHash") + .HasColumnType("INTEGER"); + + b.Property("VariableType") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpVariables"); + }); + + modelBuilder.Entity("DbModel.CsharpClass", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpNamespace", "CsharpNamespace") + .WithMany() + .HasForeignKey("CsharpNamespaceId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("CsharpNamespace"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpEnum", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpNamespace", "CsharpNamespace") + .WithMany() + .HasForeignKey("CsharpNamespaceId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("CsharpNamespace"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpEnumMember", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpEnum", null) + .WithMany("CsharpEnumMembers") + .HasForeignKey("CsharpEnumId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpEtcEntity", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpMethod", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpNamespace", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpStruct", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpNamespace", "CsharpNamespace") + .WithMany() + .HasForeignKey("CsharpNamespaceId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("CsharpNamespace"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpVariable", b => + { + b.HasOne("DbModel.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("DbModel.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("DbModel.CsharpEnum", b => + { + b.Navigation("CsharpEnumMembers"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/plugins/csharp/Migrations/SqliteMigrations/SqliteMigrations.csproj b/plugins/csharp/Migrations/SqliteMigrations/SqliteMigrations.csproj new file mode 100644 index 000000000..d6c888fe9 --- /dev/null +++ b/plugins/csharp/Migrations/SqliteMigrations/SqliteMigrations.csproj @@ -0,0 +1,21 @@ + + + + net8.0 + enable + enable + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + diff --git a/plugins/csharp/migrations/20220518134047_Initial.Designer.cs b/plugins/csharp/migrations/20220518134047_Initial.Designer.cs deleted file mode 100644 index 0a7707b34..000000000 --- a/plugins/csharp/migrations/20220518134047_Initial.Designer.cs +++ /dev/null @@ -1,545 +0,0 @@ -// -using System; -using CSharpParser.model; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -namespace CSharpParser.Migrations -{ - [DbContext(typeof(CsharpDbContext))] - [Migration("20220518134047_Initial")] - partial class Initial - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:MaxIdentifierLength", 63) - .HasAnnotation("ProductVersion", "5.0.10") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - modelBuilder.Entity("CSharpParser.model.CsharpAstNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("numeric(20,0)"); - - b.Property("Accessibility") - .HasColumnType("integer"); - - b.Property("AstSymbolType") - .HasColumnType("integer"); - - b.Property("AstType") - .HasColumnType("integer"); - - b.Property("AstValue") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("Location_range_end_column") - .HasColumnType("bigint"); - - b.Property("Location_range_end_line") - .HasColumnType("bigint"); - - b.Property("Location_range_start_column") - .HasColumnType("bigint"); - - b.Property("Location_range_start_line") - .HasColumnType("bigint"); - - b.Property("Path") - .HasColumnType("text"); - - b.Property("RawKind") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.ToTable("CsharpAstNodes"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpClass", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("ClassType") - .HasColumnType("integer"); - - b.Property("CsharpNamespaceId") - .HasColumnType("bigint"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("CsharpNamespaceId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpClasses"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEnum", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("CsharpNamespaceId") - .HasColumnType("bigint"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("CsharpNamespaceId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpEnums"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEnumMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("CsharpEnumId") - .HasColumnType("bigint"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("EqualsValue") - .HasColumnType("integer"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("CsharpEnumId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpEnumMembers"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEtcEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("DeclaratorNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("EtcEntityType") - .HasColumnType("integer"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.Property("QualifiedType") - .HasColumnType("text"); - - b.Property("TypeHash") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpEtcEntitys"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpMethod", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("MethodType") - .HasColumnType("integer"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.Property("QualifiedType") - .HasColumnType("text"); - - b.Property("TypeHash") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpMethods"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpNamespace", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpNamespaces"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpStruct", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("CsharpNamespaceId") - .HasColumnType("bigint"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("CsharpNamespaceId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpStructs"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpVariable", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.Property("QualifiedType") - .HasColumnType("text"); - - b.Property("TypeHash") - .HasColumnType("bigint"); - - b.Property("VariableType") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpVariables"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpClass", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpNamespace", "CsharpNamespace") - .WithMany() - .HasForeignKey("CsharpNamespaceId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("CsharpNamespace"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEnum", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpNamespace", "CsharpNamespace") - .WithMany() - .HasForeignKey("CsharpNamespaceId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("CsharpNamespace"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEnumMember", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpEnum", null) - .WithMany("CsharpEnumMembers") - .HasForeignKey("CsharpEnumId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEtcEntity", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpMethod", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpNamespace", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpStruct", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpNamespace", "CsharpNamespace") - .WithMany() - .HasForeignKey("CsharpNamespaceId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("CsharpNamespace"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpVariable", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEnum", b => - { - b.Navigation("CsharpEnumMembers"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/plugins/csharp/migrations/20220518134047_Initial.cs b/plugins/csharp/migrations/20220518134047_Initial.cs deleted file mode 100644 index e643a7a6a..000000000 --- a/plugins/csharp/migrations/20220518134047_Initial.cs +++ /dev/null @@ -1,443 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -namespace CSharpParser.Migrations -{ - public partial class Initial : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "CsharpAstNodes", - columns: table => new - { - Id = table.Column(type: "numeric(20,0)", nullable: false), - AstValue = table.Column(type: "text", nullable: true), - AstSymbolType = table.Column(type: "integer", nullable: false), - AstType = table.Column(type: "integer", nullable: false), - Accessibility = table.Column(type: "integer", nullable: false), - Location_range_start_line = table.Column(type: "bigint", nullable: false), - Location_range_start_column = table.Column(type: "bigint", nullable: false), - Location_range_end_line = table.Column(type: "bigint", nullable: false), - Location_range_end_column = table.Column(type: "bigint", nullable: false), - Path = table.Column(type: "text", nullable: true), - EntityHash = table.Column(type: "bigint", nullable: false), - RawKind = table.Column(type: "integer", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_CsharpAstNodes", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "CsharpEtcEntitys", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - EtcEntityType = table.Column(type: "integer", nullable: false), - DeclaratorNodeId = table.Column(type: "numeric(20,0)", nullable: false), - AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), - ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), - EntityHash = table.Column(type: "bigint", nullable: false), - Name = table.Column(type: "text", nullable: true), - QualifiedName = table.Column(type: "text", nullable: true), - DocumentationCommentXML = table.Column(type: "text", nullable: true), - TypeHash = table.Column(type: "bigint", nullable: false), - QualifiedType = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_CsharpEtcEntitys", x => x.Id); - table.ForeignKey( - name: "FK_CsharpEtcEntitys_CsharpAstNodes_AstNodeId", - column: x => x.AstNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_CsharpEtcEntitys_CsharpAstNodes_ParentNodeId", - column: x => x.ParentNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "CsharpMethods", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - MethodType = table.Column(type: "integer", nullable: false), - AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), - ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), - EntityHash = table.Column(type: "bigint", nullable: false), - Name = table.Column(type: "text", nullable: true), - QualifiedName = table.Column(type: "text", nullable: true), - DocumentationCommentXML = table.Column(type: "text", nullable: true), - TypeHash = table.Column(type: "bigint", nullable: false), - QualifiedType = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_CsharpMethods", x => x.Id); - table.ForeignKey( - name: "FK_CsharpMethods_CsharpAstNodes_AstNodeId", - column: x => x.AstNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_CsharpMethods_CsharpAstNodes_ParentNodeId", - column: x => x.ParentNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "CsharpNamespaces", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), - ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), - EntityHash = table.Column(type: "bigint", nullable: false), - Name = table.Column(type: "text", nullable: true), - QualifiedName = table.Column(type: "text", nullable: true), - DocumentationCommentXML = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_CsharpNamespaces", x => x.Id); - table.ForeignKey( - name: "FK_CsharpNamespaces_CsharpAstNodes_AstNodeId", - column: x => x.AstNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_CsharpNamespaces_CsharpAstNodes_ParentNodeId", - column: x => x.ParentNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "CsharpVariables", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - VariableType = table.Column(type: "integer", nullable: false), - AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), - ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), - EntityHash = table.Column(type: "bigint", nullable: false), - Name = table.Column(type: "text", nullable: true), - QualifiedName = table.Column(type: "text", nullable: true), - DocumentationCommentXML = table.Column(type: "text", nullable: true), - TypeHash = table.Column(type: "bigint", nullable: false), - QualifiedType = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_CsharpVariables", x => x.Id); - table.ForeignKey( - name: "FK_CsharpVariables_CsharpAstNodes_AstNodeId", - column: x => x.AstNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_CsharpVariables_CsharpAstNodes_ParentNodeId", - column: x => x.ParentNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "CsharpClasses", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - ClassType = table.Column(type: "integer", nullable: false), - CsharpNamespaceId = table.Column(type: "bigint", nullable: true), - AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), - ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), - EntityHash = table.Column(type: "bigint", nullable: false), - Name = table.Column(type: "text", nullable: true), - QualifiedName = table.Column(type: "text", nullable: true), - DocumentationCommentXML = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_CsharpClasses", x => x.Id); - table.ForeignKey( - name: "FK_CsharpClasses_CsharpAstNodes_AstNodeId", - column: x => x.AstNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_CsharpClasses_CsharpAstNodes_ParentNodeId", - column: x => x.ParentNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_CsharpClasses_CsharpNamespaces_CsharpNamespaceId", - column: x => x.CsharpNamespaceId, - principalTable: "CsharpNamespaces", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "CsharpEnums", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - CsharpNamespaceId = table.Column(type: "bigint", nullable: true), - AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), - ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), - EntityHash = table.Column(type: "bigint", nullable: false), - Name = table.Column(type: "text", nullable: true), - QualifiedName = table.Column(type: "text", nullable: true), - DocumentationCommentXML = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_CsharpEnums", x => x.Id); - table.ForeignKey( - name: "FK_CsharpEnums_CsharpAstNodes_AstNodeId", - column: x => x.AstNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_CsharpEnums_CsharpAstNodes_ParentNodeId", - column: x => x.ParentNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_CsharpEnums_CsharpNamespaces_CsharpNamespaceId", - column: x => x.CsharpNamespaceId, - principalTable: "CsharpNamespaces", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "CsharpStructs", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - CsharpNamespaceId = table.Column(type: "bigint", nullable: true), - AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), - ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), - EntityHash = table.Column(type: "bigint", nullable: false), - Name = table.Column(type: "text", nullable: true), - QualifiedName = table.Column(type: "text", nullable: true), - DocumentationCommentXML = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_CsharpStructs", x => x.Id); - table.ForeignKey( - name: "FK_CsharpStructs_CsharpAstNodes_AstNodeId", - column: x => x.AstNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_CsharpStructs_CsharpAstNodes_ParentNodeId", - column: x => x.ParentNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_CsharpStructs_CsharpNamespaces_CsharpNamespaceId", - column: x => x.CsharpNamespaceId, - principalTable: "CsharpNamespaces", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "CsharpEnumMembers", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - EqualsValue = table.Column(type: "integer", nullable: false), - CsharpEnumId = table.Column(type: "bigint", nullable: true), - AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), - ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), - EntityHash = table.Column(type: "bigint", nullable: false), - Name = table.Column(type: "text", nullable: true), - QualifiedName = table.Column(type: "text", nullable: true), - DocumentationCommentXML = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_CsharpEnumMembers", x => x.Id); - table.ForeignKey( - name: "FK_CsharpEnumMembers_CsharpAstNodes_AstNodeId", - column: x => x.AstNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_CsharpEnumMembers_CsharpAstNodes_ParentNodeId", - column: x => x.ParentNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_CsharpEnumMembers_CsharpEnums_CsharpEnumId", - column: x => x.CsharpEnumId, - principalTable: "CsharpEnums", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateIndex( - name: "IX_CsharpClasses_AstNodeId", - table: "CsharpClasses", - column: "AstNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpClasses_CsharpNamespaceId", - table: "CsharpClasses", - column: "CsharpNamespaceId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpClasses_ParentNodeId", - table: "CsharpClasses", - column: "ParentNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpEnumMembers_AstNodeId", - table: "CsharpEnumMembers", - column: "AstNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpEnumMembers_CsharpEnumId", - table: "CsharpEnumMembers", - column: "CsharpEnumId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpEnumMembers_ParentNodeId", - table: "CsharpEnumMembers", - column: "ParentNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpEnums_AstNodeId", - table: "CsharpEnums", - column: "AstNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpEnums_CsharpNamespaceId", - table: "CsharpEnums", - column: "CsharpNamespaceId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpEnums_ParentNodeId", - table: "CsharpEnums", - column: "ParentNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpEtcEntitys_AstNodeId", - table: "CsharpEtcEntitys", - column: "AstNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpEtcEntitys_ParentNodeId", - table: "CsharpEtcEntitys", - column: "ParentNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpMethods_AstNodeId", - table: "CsharpMethods", - column: "AstNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpMethods_ParentNodeId", - table: "CsharpMethods", - column: "ParentNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpNamespaces_AstNodeId", - table: "CsharpNamespaces", - column: "AstNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpNamespaces_ParentNodeId", - table: "CsharpNamespaces", - column: "ParentNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpStructs_AstNodeId", - table: "CsharpStructs", - column: "AstNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpStructs_CsharpNamespaceId", - table: "CsharpStructs", - column: "CsharpNamespaceId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpStructs_ParentNodeId", - table: "CsharpStructs", - column: "ParentNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpVariables_AstNodeId", - table: "CsharpVariables", - column: "AstNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpVariables_ParentNodeId", - table: "CsharpVariables", - column: "ParentNodeId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "CsharpClasses"); - - migrationBuilder.DropTable( - name: "CsharpEnumMembers"); - - migrationBuilder.DropTable( - name: "CsharpEtcEntitys"); - - migrationBuilder.DropTable( - name: "CsharpMethods"); - - migrationBuilder.DropTable( - name: "CsharpStructs"); - - migrationBuilder.DropTable( - name: "CsharpVariables"); - - migrationBuilder.DropTable( - name: "CsharpEnums"); - - migrationBuilder.DropTable( - name: "CsharpNamespaces"); - - migrationBuilder.DropTable( - name: "CsharpAstNodes"); - } - } -} diff --git a/plugins/csharp/migrations/CsharpDbContextModelSnapshot.cs b/plugins/csharp/migrations/CsharpDbContextModelSnapshot.cs deleted file mode 100644 index 20ebbc516..000000000 --- a/plugins/csharp/migrations/CsharpDbContextModelSnapshot.cs +++ /dev/null @@ -1,543 +0,0 @@ -// -using System; -using CSharpParser.model; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -namespace CSharpParser.Migrations -{ - [DbContext(typeof(CsharpDbContext))] - partial class CsharpDbContextModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:MaxIdentifierLength", 63) - .HasAnnotation("ProductVersion", "5.0.10") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - modelBuilder.Entity("CSharpParser.model.CsharpAstNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("numeric(20,0)"); - - b.Property("Accessibility") - .HasColumnType("integer"); - - b.Property("AstSymbolType") - .HasColumnType("integer"); - - b.Property("AstType") - .HasColumnType("integer"); - - b.Property("AstValue") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("Location_range_end_column") - .HasColumnType("bigint"); - - b.Property("Location_range_end_line") - .HasColumnType("bigint"); - - b.Property("Location_range_start_column") - .HasColumnType("bigint"); - - b.Property("Location_range_start_line") - .HasColumnType("bigint"); - - b.Property("Path") - .HasColumnType("text"); - - b.Property("RawKind") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.ToTable("CsharpAstNodes"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpClass", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("ClassType") - .HasColumnType("integer"); - - b.Property("CsharpNamespaceId") - .HasColumnType("bigint"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("CsharpNamespaceId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpClasses"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEnum", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("CsharpNamespaceId") - .HasColumnType("bigint"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("CsharpNamespaceId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpEnums"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEnumMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("CsharpEnumId") - .HasColumnType("bigint"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("EqualsValue") - .HasColumnType("integer"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("CsharpEnumId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpEnumMembers"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEtcEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("DeclaratorNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("EtcEntityType") - .HasColumnType("integer"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.Property("QualifiedType") - .HasColumnType("text"); - - b.Property("TypeHash") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpEtcEntitys"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpMethod", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("MethodType") - .HasColumnType("integer"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.Property("QualifiedType") - .HasColumnType("text"); - - b.Property("TypeHash") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpMethods"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpNamespace", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpNamespaces"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpStruct", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("CsharpNamespaceId") - .HasColumnType("bigint"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("CsharpNamespaceId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpStructs"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpVariable", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.Property("QualifiedType") - .HasColumnType("text"); - - b.Property("TypeHash") - .HasColumnType("bigint"); - - b.Property("VariableType") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpVariables"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpClass", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpNamespace", "CsharpNamespace") - .WithMany() - .HasForeignKey("CsharpNamespaceId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("CsharpNamespace"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEnum", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpNamespace", "CsharpNamespace") - .WithMany() - .HasForeignKey("CsharpNamespaceId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("CsharpNamespace"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEnumMember", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpEnum", null) - .WithMany("CsharpEnumMembers") - .HasForeignKey("CsharpEnumId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEtcEntity", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpMethod", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpNamespace", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpStruct", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpNamespace", "CsharpNamespace") - .WithMany() - .HasForeignKey("CsharpNamespaceId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("CsharpNamespace"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpVariable", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEnum", b => - { - b.Navigation("CsharpEnumMembers"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/plugins/csharp/model/CsharpDbContext.cs b/plugins/csharp/model/CsharpDbContext.cs deleted file mode 100644 index eaef779d1..000000000 --- a/plugins/csharp/model/CsharpDbContext.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Text; -using Microsoft.EntityFrameworkCore; - -namespace CSharpParser.model -{ - class CsharpDbContext : DbContext - { - public CsharpDbContext(DbContextOptions options) : base(options) { } - - public DbSet CsharpAstNodes { get; set; } - public DbSet CsharpNamespaces { get; set; } - public DbSet CsharpClasses { get; set; } - public DbSet CsharpMethods { get; set; } - public DbSet CsharpVariables { get; set; } - public DbSet CsharpStructs { get; set; } - public DbSet CsharpEnums { get; set; } - public DbSet CsharpEnumMembers { get; set; } - public DbSet CsharpEtcEntitys { get; set; } - - - } - -} diff --git a/plugins/csharp/model/CsharpEntity.cs b/plugins/csharp/model/CsharpEntity.cs deleted file mode 100644 index c7c85b7c7..000000000 --- a/plugins/csharp/model/CsharpEntity.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; - -namespace CSharpParser.model -{ - class CsharpEntity - { - public long Id { get; set; } - public CsharpAstNode AstNode { get; set; } - public CsharpAstNode ParentNode{ get; set; } - public long EntityHash { get; set; } - public String Name { get; set; } = " "; - public String QualifiedName { get; set; } = " "; - public string DocumentationCommentXML { get; set; } = " "; - } - - class CsharpTypedEntity : CsharpEntity - { - public long TypeHash { get; set; } - public String QualifiedType { get; set; } = " "; - } - - enum EtcEntityTypeEnum - { - Event, - Invocation, - ForeachExpr - } - class CsharpEtcEntity : CsharpTypedEntity - { - public EtcEntityTypeEnum EtcEntityType { get; set; } - public ulong DeclaratorNodeId { get; set; } - } -} diff --git a/plugins/csharp/parser/src_csharp/AstVisitor.cs b/plugins/csharp/parser/src_csharp/AstVisitor.cs index 722804bf9..75a7f9c07 100644 --- a/plugins/csharp/parser/src_csharp/AstVisitor.cs +++ b/plugins/csharp/parser/src_csharp/AstVisitor.cs @@ -4,7 +4,7 @@ using static System.Console; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; -using CSharpParser.model; +using DbModel; using Microsoft.CodeAnalysis; namespace CSharpParser @@ -24,7 +24,7 @@ public AstVisitor(CsharpDbContext context, SemanticModel model, SyntaxTree tree) this.Tree = tree; } - private ulong createIdentifier(CsharpAstNode astNode){ + private ulong CreateIdentifier(CsharpAstNode astNode){ string[] properties = { astNode.AstValue,":", @@ -67,7 +67,7 @@ private ulong getAstNodeId(SyntaxNode node){ AstType = AstTypeEnum.Declaration }; astNode.SetLocation(node.SyntaxTree.GetLineSpan(node.Span)); - var ret = createIdentifier(astNode); + var ret = CreateIdentifier(astNode); return ret; } @@ -92,7 +92,7 @@ private CsharpAstNode AstNode(SyntaxNode node, AstSymbolTypeEnum type, AstTypeEn Accessibility = acc }; astNode.SetLocation(Tree.GetLineSpan(node.Span)); - astNode.Id = createIdentifier(astNode); + astNode.Id = CreateIdentifier(astNode); if (DbContext.CsharpAstNodes.Find(astNode.Id) == null) { diff --git a/plugins/csharp/parser/src_csharp/CSharpParser.csproj b/plugins/csharp/parser/src_csharp/CSharpParser.csproj index ee513d5b9..1bddf6461 100644 --- a/plugins/csharp/parser/src_csharp/CSharpParser.csproj +++ b/plugins/csharp/parser/src_csharp/CSharpParser.csproj @@ -6,8 +6,9 @@ - - + + + @@ -16,6 +17,11 @@ + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/plugins/csharp/parser/src_csharp/Program.cs b/plugins/csharp/parser/src_csharp/Program.cs index a9b2b23a5..136eee8cf 100644 --- a/plugins/csharp/parser/src_csharp/Program.cs +++ b/plugins/csharp/parser/src_csharp/Program.cs @@ -8,283 +8,260 @@ using System.Collections; using System.Collections.Generic; using System.Threading.Tasks; -using CSharpParser.model; +using DbModel; namespace CSharpParser { - class Program + class Program + { + private static List _rootDir; + private static string _buildDir = ""; + private static string _buildDirBase = ""; + private static string _connectionString = ""; + private static string _dbSystem = ""; + + static int Main(string[] args) { - //private readonly CsharpDbContext _context; - private static List _rootDir; - private static string _buildDir = ""; - private static string _buildDirBase = ""; - private static string _connectionString = ""; + _rootDir = new List(); + int threadNum = 4; + + try + { + _connectionString = args[0].Replace("'", ""); + _buildDir = args[1].Replace("'", ""); + _buildDirBase = args[2].Replace("'", ""); + threadNum = int.Parse(args[3]); - static int Main(string[] args) + for (int i = 4; i < args.Length; ++i) { - _rootDir = new List(); - int threadNum = 4; + _rootDir.Add(args[i].Replace("'", "")); + } + } + catch (Exception e) + { + WriteLine("Error in parsing command!"); + return 1; + } - try - { - _connectionString = args[0].Replace("'", ""); - _buildDir = args[1].Replace("'", ""); - _buildDirBase = args[2].Replace("'", ""); - threadNum = int.Parse(args[3]); + _dbSystem = _connectionString.Substring(0, _connectionString.IndexOf(':')).ToLower(); + //Converting the connectionstring into entiy framwork style connectionstring + string csharpConnectionString = TransformConnectionString(); + if (csharpConnectionString == null) + { + WriteLine("Error: invalid database system in connection string!"); + return 1; + } - for (int i = 4; i < args.Length; ++i) - { - _rootDir.Add(args[i].Replace("'", "")); - } - } - catch (Exception e) - { - WriteLine("Error in parsing command!"); - return 1; - } - /*if (args.Length < 3) - { - WriteLine("Missing command-line arguments in CSharpParser!"); - return 1; - } - else if (args.Length == 3) - { - _connectionString = args[0].Replace("'", ""); - _rootDir = args[1].Replace("'", ""); - _buildDir = args[2].Replace("'", ""); - } - else if (args.Length == 4) - { - _connectionString = args[0].Replace("'", ""); - _rootDir = args[1].Replace("'", ""); - _buildDir = args[2].Replace("'", ""); - bool success = int.TryParse(args[3], out threadNum); - if (!success){ - WriteLine("Invalid threadnumber argument! Multithreaded parsing disabled!"); - } - } - else if (args.Length == 5) - { - _connectionString = args[0].Replace("'", ""); - _rootDir = args[1].Replace("'", ""); - _buildDir = args[2].Replace("'", ""); - _buildDirBase = args[3].Replace("'", ""); - bool success = int.TryParse(args[4], out threadNum); - if (!success) - { - WriteLine("Invalid threadnumber argument! Multithreaded parsing disabled!"); - } - } - else if (args.Length > 5) - { - WriteLine("Too many command-line arguments in CSharpParser!"); - return 1; - }*/ + CsharpDbContext context = new CsharpDbContext(_dbSystem, csharpConnectionString); + context.Database.Migrate(); - //Converting the connectionstring into entiy framwork style connectionstring - string csharpConnectionString = transformConnectionString(); + List allFiles = new List(); + foreach (var p in _rootDir) + { + Console.WriteLine(p); + allFiles.AddRange(GetSourceFilesFromDir(p, ".cs")); + } - var options = new DbContextOptionsBuilder() - .UseNpgsql(csharpConnectionString) - .Options; + foreach (var f in allFiles) + { + WriteLine(f); + } + IEnumerable assemblies = GetSourceFilesFromDir(_buildDir, ".dll"); + IEnumerable assemblies_base = assemblies; + if (args.Length == 5) + assemblies_base = GetSourceFilesFromDir(_buildDirBase, ".dll"); - CsharpDbContext _context = new CsharpDbContext(options); - _context.Database.Migrate(); + List trees = new List(); + foreach (string file in allFiles) + { + string programText = File.ReadAllText(file); + SyntaxTree tree = CSharpSyntaxTree.ParseText(programText, null, file); + trees.Add(tree); + } + Write(trees.Count); - List allFiles = new List(); - foreach (var p in _rootDir) - { - Console.WriteLine(p); - allFiles.AddRange(GetSourceFilesFromDir(p, ".cs")); - } + CSharpCompilation compilation = CSharpCompilation.Create("CSharpCompilation") + .AddReferences(MetadataReference.CreateFromFile(typeof(object).Assembly.Location)) + .AddSyntaxTrees(trees); - foreach (var f in allFiles) - { - WriteLine(f); - } - IEnumerable assemblies = GetSourceFilesFromDir(_buildDir, ".dll"); - IEnumerable assemblies_base = assemblies; - if (args.Length == 5) - assemblies_base = GetSourceFilesFromDir(_buildDirBase, ".dll"); + foreach (string file in assemblies_base) + { + compilation = compilation.AddReferences(MetadataReference.CreateFromFile(file)); + } + foreach (string file in assemblies) + { + compilation = compilation.AddReferences(MetadataReference.CreateFromFile(file)); + } - List trees = new List(); - foreach (string file in allFiles) - { - string programText = File.ReadAllText(file); - SyntaxTree tree = CSharpSyntaxTree.ParseText(programText, null, file); - trees.Add(tree); - } - Write(trees.Count); + var runtask = ParalellRun(csharpConnectionString, threadNum, trees, compilation); + int ret = runtask.Result; - CSharpCompilation compilation = CSharpCompilation.Create("CSharpCompilation") - .AddReferences(MetadataReference.CreateFromFile(typeof(object).Assembly.Location)) - .AddSyntaxTrees(trees); - - foreach (string file in assemblies_base) - { - compilation = compilation.AddReferences(MetadataReference.CreateFromFile(file)); - } - foreach (string file in assemblies) - { - compilation = compilation.AddReferences(MetadataReference.CreateFromFile(file)); - } + return 0; + } - var runtask = ParalellRun(csharpConnectionString, threadNum, trees, compilation); - int ret = runtask.Result; - - return 0; - } + private static async Task ParalellRun(string csharpConnectionString, int threadNum, + List trees, CSharpCompilation compilation) + { + + CsharpDbContext dbContext = new CsharpDbContext(_dbSystem, csharpConnectionString); + var contextList = new List(); + contextList.Add(dbContext); + for (int i = 1; i < threadNum; i++) + { + CsharpDbContext dbContextInstance = new CsharpDbContext(_dbSystem, csharpConnectionString); + contextList.Add(dbContextInstance); + } + + var ParsingTasks = new List>(); + int maxThread = threadNum < trees.Count() ? threadNum : trees.Count(); + WriteLine(threadNum); + for (int i = 0; i < maxThread; i++) + { + ParsingTasks.Add(ParseTree(contextList[i], trees[i], compilation, i)); + } + + int nextTreeIndex = maxThread; + while (ParsingTasks.Count > 0) + { + var finshedTask = await Task.WhenAny(ParsingTasks); + int nextContextIndex = await finshedTask; - private static async Task ParalellRun(string csharpConnectionString, int threadNum, - List trees, CSharpCompilation compilation) + ParsingTasks.Remove(finshedTask); + if (nextTreeIndex < trees.Count) { - var options = new DbContextOptionsBuilder() - .UseNpgsql(csharpConnectionString) - .Options; - CsharpDbContext dbContext = new CsharpDbContext(options); + ParsingTasks.Add(ParseTree(contextList[nextContextIndex], + trees[nextTreeIndex], compilation, nextContextIndex)); + ++nextTreeIndex; + } + } - var contextList = new List(); - contextList.Add(dbContext); - for (int i = 1; i < threadNum; i++) - { - CsharpDbContext dbContextInstance = new CsharpDbContext(options); - contextList.Add(dbContextInstance); - } + foreach (var ctx in contextList) + { + ctx.SaveChanges(); + } - var ParsingTasks = new List>(); - int maxThread = threadNum < trees.Count() ? threadNum : trees.Count(); - WriteLine(threadNum); - for (int i = 0; i < maxThread; i++) - { - ParsingTasks.Add(ParseTree(contextList[i],trees[i],compilation,i)); - } + return 0; + } - int nextTreeIndex = maxThread; - while (ParsingTasks.Count > 0) - { - var finshedTask = await Task.WhenAny(ParsingTasks); - int nextContextIndex = await finshedTask; + private static async Task ParseTree(CsharpDbContext context, + SyntaxTree tree, CSharpCompilation compilation, int index) + { + var ParsingTask = Task.Run(() => + { + WriteLine("ParallelRun " + tree.FilePath); + SemanticModel model = compilation.GetSemanticModel(tree); + var visitor = new AstVisitor(context, model, tree); + visitor.Visit(tree.GetCompilationUnitRoot()); + WriteLine((visitor.FullyParsed ? "+" : "-") + tree.FilePath); + return index; + }); + return await ParsingTask; + } - ParsingTasks.Remove(finshedTask); - if (nextTreeIndex < trees.Count) - { - ParsingTasks.Add(ParseTree(contextList[nextContextIndex], - trees[nextTreeIndex],compilation,nextContextIndex)); - ++nextTreeIndex; - } - } + public static IEnumerable GetSourceFilesFromDir(string root, string extension) + { + IEnumerable allFiles = new string[] { }; + // Data structure to hold names of subfolders. + ArrayList dirs = new ArrayList(); - foreach (var ctx in contextList) - { - ctx.SaveChanges(); - } + if (!System.IO.Directory.Exists(root)) + { + throw new ArgumentException(); + } + dirs.Add(root); - return 0; + while (dirs.Count > 0) + { + string currentDir = dirs[0].ToString(); + dirs.RemoveAt(0); + string[] subDirs; + try + { + subDirs = System.IO.Directory.GetDirectories(currentDir); } - - private static async Task ParseTree(CsharpDbContext context, - SyntaxTree tree, CSharpCompilation compilation, int index) + catch (UnauthorizedAccessException e) { - var ParsingTask = Task.Run(() => - { - WriteLine("ParallelRun " + tree.FilePath); - SemanticModel model = compilation.GetSemanticModel(tree); - var visitor = new AstVisitor(context, model, tree); - visitor.Visit(tree.GetCompilationUnitRoot()); - WriteLine((visitor.FullyParsed ? "+" : "-") + tree.FilePath); - return index; - }); - return await ParsingTask; + WriteLine(e.Message); + continue; } - - public static IEnumerable GetSourceFilesFromDir(string root, string extension) + catch (System.IO.DirectoryNotFoundException e) { - IEnumerable allFiles = new string[]{}; - // Data structure to hold names of subfolders. - ArrayList dirs = new ArrayList(); - - if (!System.IO.Directory.Exists(root)) - { - throw new ArgumentException(); - } - dirs.Add(root); - - while (dirs.Count > 0) - { - string currentDir = dirs[0].ToString(); - dirs.RemoveAt(0); - string[] subDirs; - try - { - subDirs = System.IO.Directory.GetDirectories(currentDir); - } - catch (UnauthorizedAccessException e) - { - WriteLine(e.Message); - continue; - } - catch (System.IO.DirectoryNotFoundException e) - { - WriteLine(e.Message); - continue; - } - - // Add the subdirectories for traversal. - dirs.AddRange(subDirs); + WriteLine(e.Message); + continue; + } - string[] files = null; - try - { - files = System.IO.Directory.GetFiles(currentDir); - } - catch (UnauthorizedAccessException e) - { - Console.WriteLine(e.Message); - continue; - } - catch (System.IO.DirectoryNotFoundException e) - { - Console.WriteLine(e.Message); - continue; - } + // Add the subdirectories for traversal. + dirs.AddRange(subDirs); - foreach (string file in files) - { - try - { - System.IO.FileInfo fi = new System.IO.FileInfo(file); - if (fi.Extension == extension) { - allFiles = allFiles.Append(file); - } - } - catch (System.IO.FileNotFoundException e) - { - // If file was deleted by a separate application - Console.WriteLine(e.Message); - } - } - } - - return allFiles; + string[] files = null; + try + { + files = System.IO.Directory.GetFiles(currentDir); + } + catch (UnauthorizedAccessException e) + { + Console.WriteLine(e.Message); + continue; + } + catch (System.IO.DirectoryNotFoundException e) + { + Console.WriteLine(e.Message); + continue; } - private static string transformConnectionString() + foreach (string file in files) { - _connectionString = _connectionString.Substring(_connectionString.IndexOf(':')+1); - _connectionString = _connectionString.Replace("user", "username"); - string [] properties = _connectionString.Split(';'); - string csharpConnectionString = ""; - for (int i = 0; i < properties.Length; ++i) + try + { + System.IO.FileInfo fi = new System.IO.FileInfo(file); + if (fi.Extension == extension) { - csharpConnectionString += properties[i].Substring(0,1).ToUpper() - + properties[i].Substring(1); - if (i < properties.Length-1) - { - csharpConnectionString += ";"; - } + allFiles = allFiles.Append(file); } + } + catch (System.IO.FileNotFoundException e) + { + // If file was deleted by a separate application + Console.WriteLine(e.Message); + } + } + } + + return allFiles; + } + + private static string TransformConnectionString() + { + string csharpConnectionString = ""; + if (_dbSystem == "pgsql") + { + _connectionString = _connectionString.Substring(_connectionString.IndexOf(':') + 1); + _connectionString = _connectionString.Replace("user", "username"); + string[] properties = _connectionString.Split(';'); - return csharpConnectionString; + for (int i = 0; i < properties.Length; ++i) + { + csharpConnectionString += properties[i].Substring(0, 1).ToUpper() + + properties[i].Substring(1); + if (i < properties.Length - 1) + { + csharpConnectionString += ";"; + } } + } + else if(_dbSystem == "sqlite") + { + // "sqlite:database=" needs to be removed from the connection string. + _connectionString = _connectionString.Substring(_connectionString.IndexOf(':') + 10); + csharpConnectionString = "Data Source=" + _connectionString; + } + else + { + csharpConnectionString = null; + } + + return csharpConnectionString; } + + } } diff --git a/plugins/csharp/service/src_csharp/CSharpQueryHandler.cs b/plugins/csharp/service/src_csharp/CSharpQueryHandler.cs index a221b65b9..b90e24d6b 100644 --- a/plugins/csharp/service/src_csharp/CSharpQueryHandler.cs +++ b/plugins/csharp/service/src_csharp/CSharpQueryHandler.cs @@ -15,35 +15,26 @@ using System.Diagnostics; using language; using cc.service.csharp; -using CSharpParser.model; +using DbModel; public class CSharpQueryHandler : CsharpService.IAsync { private CsharpDbContext dbContext; - public CSharpQueryHandler(string connenctionString) + public CSharpQueryHandler(string connectionString) { - // Converting the connectionstring into Entity Framework style connection string - connenctionString = connenctionString.Substring(connenctionString.IndexOf(':')+1); - connenctionString = connenctionString.Replace("user", "username"); - string[] properties = connenctionString.Split(';'); - string csharpConnenctionString = ""; - for (int i = 0; i < properties.Length; ++i) + string dbSystem = connectionString.Substring(0, connectionString.IndexOf(':')).ToLower(); + //Converting the connectionstring into entiy framwork style connectionstring + string csharpConnectionString = TransformConnectionString(dbSystem, connectionString); + + if(csharpConnectionString == null) { - csharpConnenctionString += properties[i].Substring(0,1).ToUpper() - + properties[i].Substring(1); - if (i < properties.Length-1) - { - csharpConnenctionString += ";"; - } + throw new NotSupportedException($"Unsupported database system:{dbSystem}"); } - var options = new DbContextOptionsBuilder() - .UseNpgsql(csharpConnenctionString) - .Options; - dbContext = new CsharpDbContext(options); + dbContext = new CsharpDbContext(dbSystem, csharpConnectionString); } - private language.AstNodeInfo createAstNodeInfo(CsharpAstNode node) + private language.AstNodeInfo CreateAstNodeInfo(CsharpAstNode node) { language.AstNodeInfo ret = new language.AstNodeInfo(); ret.Id = node.Id.ToString(); @@ -60,12 +51,12 @@ private language.AstNodeInfo createAstNodeInfo(CsharpAstNode node) return ret; } - private List createAstNodeInfoList(List nodeList) + private List CreateAstNodeInfoList(List nodeList) { var ret = new List(); foreach (var node in nodeList) { - var astNodeInfo = createAstNodeInfo(node); + var astNodeInfo = CreateAstNodeInfo(node); ret.Add(astNodeInfo); } @@ -99,13 +90,14 @@ private FileRange getFileRange(CsharpAstNode node) return fileRange; } - private CsharpAstNode queryCsharpAstNode(string astNodeId) + private CsharpAstNode QueryCsharpAstNode(string astNodeId) { CsharpAstNode ret; try { + ulong nodeId = ulong.Parse(astNodeId); ret = dbContext.CsharpAstNodes - .Where(a => a.Id.ToString()==astNodeId) + .Where(a => a.Id==nodeId) .First(); } catch (InvalidOperationException e) @@ -114,10 +106,16 @@ private CsharpAstNode queryCsharpAstNode(string astNodeId) ret = new CsharpAstNode(); ret.Id = 0; } + catch (FormatException e) + { + System.Console.WriteLine($"[CSharpService error] Invalid AstNode ID format:{astNodeId}"); + ret = new CsharpAstNode(); + ret.Id = 0; + } return ret; } - private List queryInvocations(CsharpAstNode astNode) + private List QueryInvocations(CsharpAstNode astNode) { var ret = dbContext.CsharpEtcEntitys .Where(e => e.DeclaratorNodeId == astNode.Id) @@ -126,7 +124,7 @@ private List queryInvocations(CsharpAstNode astNode) return ret; } - private List queryDeclarators(CsharpAstNode astNode) + private List QueryDeclarators(CsharpAstNode astNode) { var ids = dbContext.CsharpEtcEntitys .Where(e => e.AstNode.Id == astNode.Id) @@ -139,11 +137,11 @@ private List queryDeclarators(CsharpAstNode astNode) } else { - return ids.Select(id => queryCsharpAstNode(id)).ToList(); + return ids.Select(id => QueryCsharpAstNode(id)).ToList(); } } - private List queryEvals(CsharpAstNode astNode) + private List QueryEvals(CsharpAstNode astNode) { var ret = from invoc in dbContext.CsharpEtcEntitys @@ -157,7 +155,7 @@ on invoc.DeclaratorNodeId equals variable.AstNode.Id return ret.ToList(); } - private List queryParams(CsharpAstNode astNode) + private List QueryParams(CsharpAstNode astNode) { var ret = dbContext.CsharpVariables .Where(e => e.ParentNode.Id == astNode.Id @@ -167,7 +165,7 @@ private List queryParams(CsharpAstNode astNode) return ret; } - private List queryLocals(CsharpAstNode astNode){ + private List QueryLocals(CsharpAstNode astNode){ var ret = dbContext.CsharpVariables .Where(e => e.ParentNode.Id == astNode.Id && e.VariableType == VariableTypeEnum.Variable) @@ -176,7 +174,7 @@ private List queryLocals(CsharpAstNode astNode){ return ret; } - private List queryProperties(CsharpAstNode astNode) + private List QueryProperties(CsharpAstNode astNode) { var ret = dbContext.CsharpVariables .Where(e => e.ParentNode.Id == astNode.Id @@ -186,7 +184,7 @@ private List queryProperties(CsharpAstNode astNode) return ret; } - private List queryCalls(CsharpAstNode astNode) + private List QueryCalls(CsharpAstNode astNode) { var ret = from invoc in dbContext.CsharpEtcEntitys @@ -200,7 +198,7 @@ on invoc.DeclaratorNodeId equals node.Id return ret.ToList(); } - private List queryCallees(CsharpAstNode astNode) + private List QueryCallees(CsharpAstNode astNode) { var ret = from invoc in dbContext.CsharpEtcEntitys @@ -214,7 +212,7 @@ on invoc.DeclaratorNodeId equals node.Id return ret.Distinct().ToList(); } - private List queryCallers(CsharpAstNode astNode) + private List QueryCallers(CsharpAstNode astNode) { var invocations = dbContext.CsharpEtcEntitys .Where(e => e.DeclaratorNodeId == astNode.Id) @@ -230,7 +228,7 @@ on invoc.Path equals node.Path return ret.Distinct().ToList(); } - private List queryEnumConsts(CsharpAstNode astNode) + private List QueryEnumConsts(CsharpAstNode astNode) { var ret = new List(); if (astNode.AstSymbolType == AstSymbolTypeEnum.Enum) @@ -255,7 +253,7 @@ private List queryEnumConsts(CsharpAstNode astNode) return ret; } - private List queryMethods(CsharpAstNode astNode) + private List QueryMethods(CsharpAstNode astNode) { var ret = dbContext.CsharpMethods .Where(e => e.ParentNode.Id == astNode.Id) @@ -264,7 +262,7 @@ private List queryMethods(CsharpAstNode astNode) return ret; } - private List queryMethodType(CsharpAstNode astNode, MethodTypeEnum type) + private List QueryMethodType(CsharpAstNode astNode, MethodTypeEnum type) { var ret = dbContext.CsharpMethods .Where(e => e.ParentNode.Id == astNode.Id @@ -274,7 +272,7 @@ private List queryMethodType(CsharpAstNode astNode, MethodTypeEnu return ret; } - private List queryEvents(CsharpAstNode astNode) + private List QueryEvents(CsharpAstNode astNode) { var ret = dbContext.CsharpEtcEntitys .Where(e => e.ParentNode.Id == astNode.Id @@ -318,14 +316,14 @@ private List queryEvents(CsharpAstNode astNode) minNode = node; } - return await Task.FromResult(createAstNodeInfo(minNode)); + return await Task.FromResult(CreateAstNodeInfo(minNode)); } public async Task> getProperties(string astNodeIds, CancellationToken cancellationToken = default(CancellationToken)) { Dictionary ret = new Dictionary(); - CsharpAstNode node = queryCsharpAstNode(astNodeIds); + CsharpAstNode node = QueryCsharpAstNode(astNodeIds); ret.Add("AstNode Type", node.RawKind.ToString()); ret.Add("Accessibility", node.Accessibility.ToString()); switch(node.AstSymbolType){ @@ -415,20 +413,20 @@ public async Task getDocumentation(string astNodeId, CancellationToken cancellationToken = default(CancellationToken)) { System.Console.WriteLine("[CSharpService] getDocumentationAsync"); - CsharpAstNode node = queryCsharpAstNode(astNodeId); + CsharpAstNode node = QueryCsharpAstNode(astNodeId); return await Task.FromResult("Documentation"); } public async Task getFileRange(string astNodeId, CancellationToken cancellationToken = default(CancellationToken)) { - return await Task.FromResult(getFileRange(queryCsharpAstNode(astNodeId))); + return await Task.FromResult(getFileRange(QueryCsharpAstNode(astNodeId))); } public async Task> getReferenceTypes(string astNodeId, CancellationToken cancellationToken = default(CancellationToken)) { - var node = queryCsharpAstNode(astNodeId); + var node = QueryCsharpAstNode(astNodeId); Dictionary ret = new Dictionary(); ret.Add("Definition", (int)ReferenceType.DEFINITION); ret.Add("Declaration", (int)ReferenceType.DECLARATION); @@ -506,61 +504,61 @@ public async Task> getReferenceTypes(string astNodeId, public async Task getReferenceCount(string astNodeId, int referenceId, CancellationToken cancellationToken = default(CancellationToken)) { - var node = queryCsharpAstNode(astNodeId); + var node = QueryCsharpAstNode(astNodeId); int ret = 0; switch ((ReferenceType)referenceId) { case ReferenceType.USAGE: - ret = queryInvocations(node).Count(); + ret = QueryInvocations(node).Count(); break; case ReferenceType.DEFINITION: case ReferenceType.DECLARATION: - ret = queryDeclarators(node).Count(); + ret = QueryDeclarators(node).Count(); break; case ReferenceType.EVALUATION: - ret = queryEvals(node).Count(); + ret = QueryEvals(node).Count(); break; case ReferenceType.PARAMETER: - ret = queryParams(node).Count(); + ret = QueryParams(node).Count(); break; case ReferenceType.LOCAL_VAR: - ret = queryLocals(node).Count(); + ret = QueryLocals(node).Count(); break; case ReferenceType.DATA_MEMBER: - ret = queryProperties(node).Count(); + ret = QueryProperties(node).Count(); break; case ReferenceType.THIS_CALLS: - ret = queryCalls(node).Count(); + ret = QueryCalls(node).Count(); break; case ReferenceType.CALLEE: - ret = queryCallees(node).Count(); + ret = QueryCallees(node).Count(); break; case ReferenceType.CALLER: - ret = queryCallers(node).Count(); + ret = QueryCallers(node).Count(); break; case ReferenceType.ENUM_CONSTANTS: - ret = queryEnumConsts(node).Count(); + ret = QueryEnumConsts(node).Count(); break; case ReferenceType.METHOD: - ret = queryMethods(node).Count(); + ret = QueryMethods(node).Count(); break; case ReferenceType.CONSTRUCTOR: - ret = queryMethodType(node, MethodTypeEnum.Constructor).Count(); + ret = QueryMethodType(node, MethodTypeEnum.Constructor).Count(); break; case ReferenceType.DESTRUCTOR: - ret = queryMethodType(node, MethodTypeEnum.Destuctor).Count(); + ret = QueryMethodType(node, MethodTypeEnum.Destuctor).Count(); break; case ReferenceType.OPERATOR: - ret = queryMethodType(node, MethodTypeEnum.Operator).Count(); + ret = QueryMethodType(node, MethodTypeEnum.Operator).Count(); break; case ReferenceType.ACCESSOR: - ret = queryMethodType(node, MethodTypeEnum.Accessor).Count(); + ret = QueryMethodType(node, MethodTypeEnum.Accessor).Count(); break; case ReferenceType.DELEGATE: - ret = queryMethodType(node, MethodTypeEnum.Delegate).Count(); + ret = QueryMethodType(node, MethodTypeEnum.Delegate).Count(); break; case ReferenceType.EVENT: - ret = queryEvents(node).Count(); + ret = QueryEvents(node).Count(); break; default: System.Console.WriteLine($"[CSharpService] {(ReferenceType)referenceId}"+ @@ -574,61 +572,61 @@ public async Task getReferenceCount(string astNodeId, int referenceId, int referenceId, List tags, CancellationToken cancellationToken = default(CancellationToken)) { - var node = queryCsharpAstNode(astNodeId); + var node = QueryCsharpAstNode(astNodeId); var ret = new List(); switch ((ReferenceType)referenceId) { case ReferenceType.USAGE: - ret = createAstNodeInfoList(queryInvocations(node)); + ret = CreateAstNodeInfoList(QueryInvocations(node)); break; case ReferenceType.DEFINITION: case ReferenceType.DECLARATION: - ret = createAstNodeInfoList(queryDeclarators(node)); + ret = CreateAstNodeInfoList(QueryDeclarators(node)); break; case ReferenceType.EVALUATION: - ret = createAstNodeInfoList(queryEvals(node)); + ret = CreateAstNodeInfoList(QueryEvals(node)); break; case ReferenceType.PARAMETER: - ret = createAstNodeInfoList(queryParams(node)); + ret = CreateAstNodeInfoList(QueryParams(node)); break; case ReferenceType.LOCAL_VAR: - ret = createAstNodeInfoList(queryLocals(node)); + ret = CreateAstNodeInfoList(QueryLocals(node)); break; case ReferenceType.DATA_MEMBER: - ret = createAstNodeInfoList(queryProperties(node)); + ret = CreateAstNodeInfoList(QueryProperties(node)); break; case ReferenceType.THIS_CALLS: - ret = createAstNodeInfoList(queryCalls(node)); + ret = CreateAstNodeInfoList(QueryCalls(node)); break; case ReferenceType.CALLEE: - ret = createAstNodeInfoList(queryCallees(node)); + ret = CreateAstNodeInfoList(QueryCallees(node)); break; case ReferenceType.CALLER: - ret = createAstNodeInfoList(queryCallers(node)); + ret = CreateAstNodeInfoList(QueryCallers(node)); break; case ReferenceType.ENUM_CONSTANTS: - ret = createAstNodeInfoList(queryEnumConsts(node)); + ret = CreateAstNodeInfoList(QueryEnumConsts(node)); break; case ReferenceType.METHOD: - ret = createAstNodeInfoList(queryMethods(node)); + ret = CreateAstNodeInfoList(QueryMethods(node)); break; case ReferenceType.CONSTRUCTOR: - ret = createAstNodeInfoList(queryMethodType(node, MethodTypeEnum.Constructor)); + ret = CreateAstNodeInfoList(QueryMethodType(node, MethodTypeEnum.Constructor)); break; case ReferenceType.DESTRUCTOR: - ret = createAstNodeInfoList(queryMethodType(node, MethodTypeEnum.Destuctor)); + ret = CreateAstNodeInfoList(QueryMethodType(node, MethodTypeEnum.Destuctor)); break; case ReferenceType.OPERATOR: - ret = createAstNodeInfoList(queryMethodType(node, MethodTypeEnum.Operator)); + ret = CreateAstNodeInfoList(QueryMethodType(node, MethodTypeEnum.Operator)); break; case ReferenceType.ACCESSOR: - ret = createAstNodeInfoList(queryMethodType(node, MethodTypeEnum.Accessor)); + ret = CreateAstNodeInfoList(QueryMethodType(node, MethodTypeEnum.Accessor)); break; case ReferenceType.DELEGATE: - ret = createAstNodeInfoList(queryMethodType(node, MethodTypeEnum.Delegate)); + ret = CreateAstNodeInfoList(QueryMethodType(node, MethodTypeEnum.Delegate)); break; case ReferenceType.EVENT: - ret = createAstNodeInfoList(queryEvents(node)); + ret = CreateAstNodeInfoList(QueryEvents(node)); break; default: System.Console.WriteLine($"[CSharpService] {(ReferenceType)referenceId}"+ @@ -680,5 +678,37 @@ public async Task getDiagram(string astNodeId, int diagramId, return await Task.FromResult(new List()); } + private static string TransformConnectionString(string dbSystem, string connectionString) + { + string csharpConnectionString = ""; + if (dbSystem == "pgsql") + { + connectionString = connectionString.Substring(connectionString.IndexOf(':') + 1); + connectionString = connectionString.Replace("user", "username"); + string[] properties = connectionString.Split(';'); + + for (int i = 0; i < properties.Length; ++i) + { + csharpConnectionString += properties[i].Substring(0, 1).ToUpper() + + properties[i].Substring(1); + if (i < properties.Length - 1) + { + csharpConnectionString += ";"; + } + } + } + else if(dbSystem == "sqlite") + { + // "sqlite:database=" needs to be removed from the connection string. + connectionString = connectionString.Substring(connectionString.IndexOf(':') + 10); + csharpConnectionString = "Data Source=" + connectionString; + } + else + { + csharpConnectionString = null; + } + + return csharpConnectionString; + } } \ No newline at end of file diff --git a/plugins/csharp/service/src_csharp/CSharpQueryServer.cs b/plugins/csharp/service/src_csharp/CSharpQueryServer.cs index 955de23a1..ec9adbd8f 100644 --- a/plugins/csharp/service/src_csharp/CSharpQueryServer.cs +++ b/plugins/csharp/service/src_csharp/CSharpQueryServer.cs @@ -19,7 +19,7 @@ using System.Diagnostics; using language; using cc.service.csharp; -using CSharpParser.model; +using DbModel; namespace Server { @@ -73,8 +73,17 @@ private static async Task RunAsync(CancellationToken cancellationToken, string c TTransportFactory transportFactory = new TBufferedTransport.Factory(); TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); - var handler = new CSharpQueryHandler(connenctionString); - ITAsyncProcessor processor = new CsharpService.AsyncProcessor(handler); + ITAsyncProcessor processor = null; + try + { + var handler = new CSharpQueryHandler(connenctionString); + processor = new CsharpService.AsyncProcessor(handler); + } + catch (Exception x) + { + Logger.LogInformation("{x}",x); + } + try { diff --git a/plugins/csharp/service/src_csharp/csharpservice.csproj b/plugins/csharp/service/src_csharp/csharpservice.csproj index 091a93f6c..62f6a927f 100644 --- a/plugins/csharp/service/src_csharp/csharpservice.csproj +++ b/plugins/csharp/service/src_csharp/csharpservice.csproj @@ -5,12 +5,9 @@ net8.0 - - - - + @@ -18,6 +15,7 @@ + all runtime; build; native; contentfiles; analyzers; buildtransitive