-
Notifications
You must be signed in to change notification settings - Fork 114
Sqlite support added to C# plugin #854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/csharp_plugin
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ nbproject/ | |
| *.swp | ||
|
|
||
| ## Build folders | ||
| Build/ | ||
| build/ | ||
| build_*/ | ||
| install/ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| Microsoft Visual Studio Solution File, Format Version 12.00 | ||
| # Visual Studio Version 17 | ||
| VisualStudioVersion = 17.5.2.0 | ||
| MinimumVisualStudioVersion = 10.0.40219.1 | ||
| Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "plugins", "plugins", "{07D57EEB-2F50-60C4-C011-FE4FA775C9A8}" | ||
| EndProject | ||
| Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{DEE5DD87-39C1-BF34-B639-A387DCCF972B}" | ||
| EndProject | ||
| Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "csharp", "csharp", "{FDECB3EA-C235-0ECE-9066-0767EFECF65B}" | ||
| EndProject | ||
| Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "service", "service", "{7D914C01-75FA-9E92-82D4-3C039136171A}" | ||
| EndProject | ||
| Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src_csharp", "src_csharp", "{AF4D61C2-B71E-BE38-5950-782439CCE1D6}" | ||
| EndProject | ||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharpservice", "plugins\csharp\service\src_csharp\csharpservice.csproj", "{23D38B20-064C-A274-616B-A87E116A69E9}" | ||
| EndProject | ||
| Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "parser", "parser", "{F09082B5-68A8-D6A7-6A9C-0D853F4DF591}" | ||
| EndProject | ||
| Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src_csharp", "src_csharp", "{10CDF008-A431-7A23-2F79-7E7DC3CA6843}" | ||
| EndProject | ||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpParser", "plugins\csharp\parser\src_csharp\CSharpParser.csproj", "{63BF2A37-8F5E-CBA4-1720-68324B8B5516}" | ||
| EndProject | ||
| Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "plugins", "plugins", "{D2CF7D5B-42D7-6566-E13F-A0B3FA04C41C}" | ||
| EndProject | ||
| Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "csharp", "csharp", "{37A8322D-A38C-0C2D-0DCC-F2B38490041F}" | ||
| EndProject | ||
| Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "service", "service", "{584C7E52-C9BD-1FDF-01F6-05F93628661B}" | ||
| EndProject | ||
| Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src_csharp", "src_csharp", "{6E09C5FF-56B3-0BA1-5DB2-3B044FB72342}" | ||
| EndProject | ||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "gen-netstd", "Build\plugins\csharp\service\src_csharp\gen-netstd\gen-netstd.csproj", "{623C7EF0-7B76-A1DC-FA10-8A67D757C3AA}" | ||
| EndProject | ||
| Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "migrations", "migrations", "{4A738011-D202-4B48-9CAE-8B044943D997}" | ||
| EndProject | ||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sqliteMigrations", "plugins\csharp\migrations\sqliteMigrations\sqliteMigrations.csproj", "{4709E553-FC92-44D2-85CC-A1EFE918F70B}" | ||
| EndProject | ||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "pgsqlMigrations", "plugins\csharp\migrations\pgsqlMigrations\pgsqlMigrations.csproj", "{AB02187B-59AB-4E35-B1C8-B835F25B9692}" | ||
| EndProject | ||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "db_model", "plugins\csharp\db_model\db_model.csproj", "{B9532E7A-2CB8-4DEC-A0DA-672AF7D054E6}" | ||
| EndProject | ||
| Global | ||
| GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
| Debug|Any CPU = Debug|Any CPU | ||
| Release|Any CPU = Release|Any CPU | ||
| EndGlobalSection | ||
| GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
| {23D38B20-064C-A274-616B-A87E116A69E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {23D38B20-064C-A274-616B-A87E116A69E9}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {23D38B20-064C-A274-616B-A87E116A69E9}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {23D38B20-064C-A274-616B-A87E116A69E9}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {63BF2A37-8F5E-CBA4-1720-68324B8B5516}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {63BF2A37-8F5E-CBA4-1720-68324B8B5516}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {63BF2A37-8F5E-CBA4-1720-68324B8B5516}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {63BF2A37-8F5E-CBA4-1720-68324B8B5516}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {623C7EF0-7B76-A1DC-FA10-8A67D757C3AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {623C7EF0-7B76-A1DC-FA10-8A67D757C3AA}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {623C7EF0-7B76-A1DC-FA10-8A67D757C3AA}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {623C7EF0-7B76-A1DC-FA10-8A67D757C3AA}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {4709E553-FC92-44D2-85CC-A1EFE918F70B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {4709E553-FC92-44D2-85CC-A1EFE918F70B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {4709E553-FC92-44D2-85CC-A1EFE918F70B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {4709E553-FC92-44D2-85CC-A1EFE918F70B}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {AB02187B-59AB-4E35-B1C8-B835F25B9692}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {AB02187B-59AB-4E35-B1C8-B835F25B9692}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {AB02187B-59AB-4E35-B1C8-B835F25B9692}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {AB02187B-59AB-4E35-B1C8-B835F25B9692}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {B9532E7A-2CB8-4DEC-A0DA-672AF7D054E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {B9532E7A-2CB8-4DEC-A0DA-672AF7D054E6}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {B9532E7A-2CB8-4DEC-A0DA-672AF7D054E6}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {B9532E7A-2CB8-4DEC-A0DA-672AF7D054E6}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| EndGlobalSection | ||
| GlobalSection(SolutionProperties) = preSolution | ||
| HideSolutionNode = FALSE | ||
| EndGlobalSection | ||
| GlobalSection(NestedProjects) = preSolution | ||
| {FDECB3EA-C235-0ECE-9066-0767EFECF65B} = {07D57EEB-2F50-60C4-C011-FE4FA775C9A8} | ||
| {7D914C01-75FA-9E92-82D4-3C039136171A} = {FDECB3EA-C235-0ECE-9066-0767EFECF65B} | ||
| {AF4D61C2-B71E-BE38-5950-782439CCE1D6} = {7D914C01-75FA-9E92-82D4-3C039136171A} | ||
| {23D38B20-064C-A274-616B-A87E116A69E9} = {AF4D61C2-B71E-BE38-5950-782439CCE1D6} | ||
| {F09082B5-68A8-D6A7-6A9C-0D853F4DF591} = {FDECB3EA-C235-0ECE-9066-0767EFECF65B} | ||
| {10CDF008-A431-7A23-2F79-7E7DC3CA6843} = {F09082B5-68A8-D6A7-6A9C-0D853F4DF591} | ||
| {63BF2A37-8F5E-CBA4-1720-68324B8B5516} = {10CDF008-A431-7A23-2F79-7E7DC3CA6843} | ||
| {D2CF7D5B-42D7-6566-E13F-A0B3FA04C41C} = {DEE5DD87-39C1-BF34-B639-A387DCCF972B} | ||
| {37A8322D-A38C-0C2D-0DCC-F2B38490041F} = {D2CF7D5B-42D7-6566-E13F-A0B3FA04C41C} | ||
| {584C7E52-C9BD-1FDF-01F6-05F93628661B} = {37A8322D-A38C-0C2D-0DCC-F2B38490041F} | ||
| {6E09C5FF-56B3-0BA1-5DB2-3B044FB72342} = {584C7E52-C9BD-1FDF-01F6-05F93628661B} | ||
| {623C7EF0-7B76-A1DC-FA10-8A67D757C3AA} = {6E09C5FF-56B3-0BA1-5DB2-3B044FB72342} | ||
| {4A738011-D202-4B48-9CAE-8B044943D997} = {FDECB3EA-C235-0ECE-9066-0767EFECF65B} | ||
| {4709E553-FC92-44D2-85CC-A1EFE918F70B} = {4A738011-D202-4B48-9CAE-8B044943D997} | ||
| {AB02187B-59AB-4E35-B1C8-B835F25B9692} = {4A738011-D202-4B48-9CAE-8B044943D997} | ||
| {B9532E7A-2CB8-4DEC-A0DA-672AF7D054E6} = {FDECB3EA-C235-0ECE-9066-0767EFECF65B} | ||
| EndGlobalSection | ||
| GlobalSection(ExtensibilityGlobals) = postSolution | ||
| SolutionGuid = {4DD4E593-045A-4D66-97E2-C34DF688864A} | ||
| EndGlobalSection | ||
| EndGlobal | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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; } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -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<CsharpAstNode> CsharpAstNodes { get; set; } | ||||||||||||||||||||||
| public DbSet<CsharpNamespace> CsharpNamespaces { get; set; } | ||||||||||||||||||||||
| public DbSet<CsharpClass> CsharpClasses { get; set; } | ||||||||||||||||||||||
| public DbSet<CsharpMethod> CsharpMethods { get; set; } | ||||||||||||||||||||||
| public DbSet<CsharpVariable> CsharpVariables { get; set; } | ||||||||||||||||||||||
| public DbSet<CsharpStruct> CsharpStructs { get; set; } | ||||||||||||||||||||||
| public DbSet<CsharpEnum> CsharpEnums { get; set; } | ||||||||||||||||||||||
| public DbSet<CsharpEnumMember> CsharpEnumMembers { get; set; } | ||||||||||||||||||||||
| public DbSet<CsharpEtcEntity> 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")); | ||||||||||||||||||||||
|
Comment on lines
+35
to
+39
|
||||||||||||||||||||||
| x => x.MigrationsAssembly("pgsqlMigrations")); | |
| break; | |
| case "sqlite": | |
| optionsBuilder.UseSqlite(_connectionString, | |
| x => x.MigrationsAssembly("sqliteMigrations")); | |
| x => x.MigrationsAssembly("PgsqlMigrations")); | |
| break; | |
| case "sqlite": | |
| optionsBuilder.UseSqlite(_connectionString, | |
| x => x.MigrationsAssembly("SqliteMigrations")); |
Copilot
AI
Apr 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OnConfiguring silently does nothing for unknown _dbSystem values, leaving the DbContext potentially unusable and making misconfiguration hard to debug. Consider throwing an ArgumentException/InvalidOperationException with the supported values (or at least logging) in the default branch.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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; } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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; } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,27 @@ | ||||||||||||||||||||||||||
| <Project Sdk="Microsoft.NET.Sdk"> | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| <PropertyGroup> | ||||||||||||||||||||||||||
| <TargetFramework>net8.0</TargetFramework> | ||||||||||||||||||||||||||
| <ImplicitUsings>enable</ImplicitUsings> | ||||||||||||||||||||||||||
| <Nullable>enable</Nullable> | ||||||||||||||||||||||||||
| </PropertyGroup> | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| <ItemGroup> | ||||||||||||||||||||||||||
| <PackageReference Include="Microsoft.Build.Locator" Version="1.10.2" /> | ||||||||||||||||||||||||||
| <PackageReference Include="Microsoft.CodeAnalysis" Version="4.14.0" /> | ||||||||||||||||||||||||||
| <PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.14.0" /> | ||||||||||||||||||||||||||
| <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" /> | ||||||||||||||||||||||||||
| <PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.20" /> | ||||||||||||||||||||||||||
| <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.20"> | ||||||||||||||||||||||||||
| <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||||||||||||||||||||||||||
| <PrivateAssets>all</PrivateAssets> | ||||||||||||||||||||||||||
| </PackageReference> | ||||||||||||||||||||||||||
| <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.11" /> | ||||||||||||||||||||||||||
| <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.20"> | ||||||||||||||||||||||||||
| <PrivateAssets>all</PrivateAssets> | ||||||||||||||||||||||||||
| <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||||||||||||||||||||||||||
| </PackageReference> | ||||||||||||||||||||||||||
| <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.11" /> | ||||||||||||||||||||||||||
|
Comment on lines
+19
to
+24
|
||||||||||||||||||||||||||
| <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.11" /> | |
| <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.20"> | |
| <PrivateAssets>all</PrivateAssets> | |
| <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | |
| </PackageReference> | |
| <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.11" /> | |
| <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.20" /> | |
| <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.20"> | |
| <PrivateAssets>all</PrivateAssets> | |
| <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | |
| </PackageReference> | |
| <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.20" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The solution references csproj paths that don’t match the actual filenames’ casing (e.g., sqliteMigrations.csproj vs SqliteMigrations.csproj, db_model.csproj vs DbModel.csproj). This breaks loading/building the solution on case-sensitive filesystems. Update the paths to match the real on-disk filenames.