Skip to content

Updated dbtool to support MTA files#485

Open
jschick04 wants to merge 2 commits intomainfrom
jschick/update_dbtool_mta
Open

Updated dbtool to support MTA files#485
jschick04 wants to merge 2 commits intomainfrom
jschick/update_dbtool_mta

Conversation

@jschick04
Copy link
Copy Markdown
Collaborator

No description provided.

@jschick04 jschick04 requested a review from a team as a code owner April 19, 2026 04:19
Copilot AI review requested due to automatic review settings April 19, 2026 04:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the EventDbTool CLI to treat provider data as coming from a “provider source” (local machine, .db, exported .evtx + sibling LocaleMetaData/*.MTA, or a folder containing these), enabling workflows that rely on MTA-only metadata rather than local registry/DLL resolution.

Changes:

  • Replaces showlocal/showdatabase with a unified show command that can read from .db, .evtx+LocaleMetaData, or folders.
  • Adds ProviderSource and MtaProviderSource helpers to discover/load providers from .db/.evtx/folders.
  • Extends create, merge, and diff to accept these broader provider sources.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/EventLogExpert.EventDbTool/ShowLocalCommand.cs Removed legacy local-only “show” command in favor of unified source handling.
src/EventLogExpert.EventDbTool/ShowDatabaseCommand.cs Removed legacy DB-only “show” command in favor of unified source handling.
src/EventLogExpert.EventDbTool/ShowCommand.cs New unified show command supporting local, .db, .evtx+MTA, and folders.
src/EventLogExpert.EventDbTool/ProviderSource.cs New abstraction for enumerating/loading provider details from .db/.evtx/folders.
src/EventLogExpert.EventDbTool/MtaProviderSource.cs New logic to discover provider names from .evtx and resolve via sibling LocaleMetaData/*.MTA only.
src/EventLogExpert.EventDbTool/Program.cs Switches root command registration to the new unified show command.
src/EventLogExpert.EventDbTool/MergeDatabaseCommand.cs Allows merging from any provider source; adds case-insensitive match/removal behavior.
src/EventLogExpert.EventDbTool/DiffDatabaseCommand.cs Allows diffing two provider sources and generating a .db containing providers only in the second source.
src/EventLogExpert.EventDbTool/DbToolCommand.cs Adds LoadLocalProviders helper and updates output to include Parameters count.
src/EventLogExpert.EventDbTool/CreateDatabaseCommand.cs Adds optional source argument and expands skip/filter logic to support non-DB inputs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/EventLogExpert.EventDbTool/CreateDatabaseCommand.cs Outdated
Comment thread src/EventLogExpert.EventDbTool/MergeDatabaseCommand.cs Outdated
Comment thread src/EventLogExpert.EventDbTool/MtaProviderSource.cs Outdated
Comment thread src/EventLogExpert.EventDbTool/DiffDatabaseCommand.cs Outdated
Comment thread src/EventLogExpert.EventDbTool/CreateDatabaseCommand.cs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/EventLogExpert.EventDbTool/ProviderSource.cs Outdated
Comment thread src/EventLogExpert.EventDbTool/ProviderSource.cs Outdated
Comment thread src/EventLogExpert.EventDbTool/MergeDatabaseCommand.cs Outdated
Comment thread src/EventLogExpert.EventDbTool/DiffDatabaseCommand.cs Outdated
Comment thread src/EventLogExpert.EventDbTool/MtaProviderSource.cs Outdated
Comment thread src/EventLogExpert.EventDbTool/MtaProviderSource.cs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/EventLogExpert.Eventing/EventProviderDatabase/EventProviderDbContext.cs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/EventLogExpert.EventDbTool/ProviderSource.cs Outdated
Comment thread src/EventLogExpert.EventDbTool/MtaProviderSource.cs Outdated
Comment thread src/EventLogExpert.EventDbTool/ShowCommand.cs Outdated
Comment thread src/EventLogExpert.EventDbTool/CreateDatabaseCommand.cs Outdated
Comment thread src/EventLogExpert.Eventing/EventProviderDatabase/EventProviderDbContext.cs Outdated
Comment thread src/EventLogExpert.EventDbTool/DbToolCommand.cs Outdated
bill-long
bill-long previously approved these changes Apr 19, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/EventLogExpert.Eventing/Readers/EventLogReader.cs
Comment thread src/EventLogExpert.EventDbTool/ProviderSource.cs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/EventLogExpert.EventDbTool/MergeDatabaseCommand.cs Outdated
@jschick04 jschick04 force-pushed the jschick/update_dbtool_mta branch 2 times, most recently from d36f50c to 7470e68 Compare April 19, 2026 15:13
@jschick04 jschick04 requested a review from Copilot April 19, 2026 15:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

src/EventLogExpert.EventDbTool/Program.cs:26

  • The CLI subcommands showlocal and showdatabase have been removed and replaced with show. This is a breaking change for any existing scripts/automation that call the old commands. Consider keeping showlocal/showdatabase as backward-compatible aliases (potentially hidden) that forward to show, or document the breaking change prominently in help/release notes.
        RootCommand rootCommand = new("Tool used to create and modify databases for use with EventLogExpert");

        rootCommand.Subcommands.Add(ShowCommand.GetCommand());
        rootCommand.Subcommands.Add(CreateDatabaseCommand.GetCommand());
        rootCommand.Subcommands.Add(MergeDatabaseCommand.GetCommand());
        rootCommand.Subcommands.Add(DiffDatabaseCommand.GetCommand());
        rootCommand.Subcommands.Add(UpgradeDatabaseCommand.GetCommand());

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/EventLogExpert.EventDbTool/ProviderSource.cs
Comment thread src/EventLogExpert.EventDbTool/ProviderSource.cs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/EventLogExpert.EventDbTool/CreateDatabaseCommand.cs Outdated
Comment thread src/EventLogExpert.EventDbTool/ShowCommand.cs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/EventLogExpert.EventDbTool/MergeDatabaseCommand.cs
Comment thread src/EventLogExpert.EventDbTool/ProviderSource.cs
Comment thread src/EventLogExpert.EventDbTool/ShowCommand.cs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/EventLogExpert.EventDbTool/CreateDatabaseCommand.cs Outdated
Comment thread src/EventLogExpert.EventDbTool/ShowCommand.cs
Comment thread src/EventLogExpert.Eventing.Tests/Readers/EventLogReaderTests.cs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/EventLogExpert.Eventing/EventProviderDatabase/EventProviderDbContext.cs Outdated
Comment thread src/EventLogExpert.Eventing/EventProviderDatabase/EventProviderDbContext.cs Outdated
Comment thread src/EventLogExpert.EventDbTool/MtaProviderSource.cs Outdated
Comment thread src/EventLogExpert.EventDbTool/ProviderSource.cs
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/EventLogExpert.EventDbTool/DiffDatabaseCommand.cs Outdated
Comment thread src/EventLogExpert.EventDbTool/ProviderSource.cs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/EventLogExpert.Eventing/EventProviderDatabase/EventProviderDbContext.cs Outdated
Comment thread src/EventLogExpert.EventDbTool/MergeDatabaseCommand.cs
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +70 to 71
var sourceProviders = ProviderSource.LoadProviders(source, Logger).ToList();

Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MergeDatabase eagerly materializes all ProviderDetails from the source (ProviderSource.LoadProviders(...).ToList()) before checking which provider names already exist in the target. When --overwrite is not set and the overlap is large (especially for .evtx+MTA sources where resolving a provider is expensive), this does unnecessary work and can significantly slow the command.

Consider loading only the source provider names first (ProviderSource.LoadProviderNames) to compute the overlap, then (when overwriteProviders is false) call ProviderSource.LoadProviders again with skipProviderNames set to the target overlap so skipped providers are never resolved.

Copilot uses AI. Check for mistakes.
@@ -19,8 +19,7 @@ private static async Task<int> Main(string[] args)
{
RootCommand rootCommand = new("Tool used to create and modify databases for use with EventLogExpert");
Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change removes the showlocal and showdatabase subcommands from the CLI and replaces them with a single show command. If users have scripts or docs referencing the old subcommands, this is a breaking change.

Consider keeping showlocal/showdatabase as deprecated aliases that forward to show (with/without a source argument), or at least add explicit migration guidance in the command descriptions/help output.

Suggested change
RootCommand rootCommand = new("Tool used to create and modify databases for use with EventLogExpert");
RootCommand rootCommand = new(
"Tool used to create and modify databases for use with EventLogExpert. " +
"Migration note: the previous 'showlocal' and 'showdatabase' commands have been replaced by 'show'. " +
"Update any scripts or documentation that still reference the old command names.");

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants