Добавьте файлы проекта.
This commit is contained in:
11
SQLVision.Core/Interfaces/IExportHandler.cs
Normal file
11
SQLVision.Core/Interfaces/IExportHandler.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using SQLVision.Core.Models;
|
||||
using System.Data;
|
||||
|
||||
namespace SQLVision.Services.Exporters;
|
||||
|
||||
public interface IExportHandler
|
||||
{
|
||||
string FormatName { get; }
|
||||
Task ExportAsync(DataTable data, string filePath, ExportOptions options);
|
||||
Task<byte[]> ExportToMemoryAsync(DataTable data, ExportOptions options);
|
||||
}
|
||||
11
SQLVision.Core/Interfaces/IExportService.cs
Normal file
11
SQLVision.Core/Interfaces/IExportService.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using SQLVision.Core.Models;
|
||||
using System.Data;
|
||||
|
||||
namespace SQLVision.Core.Interfaces;
|
||||
|
||||
public interface IExportService
|
||||
{
|
||||
Task ExportAsync(DataTable data, string filePath, ExportOptions options);
|
||||
Task ExportAsync(DataSet dataSet, string filePath, ExportOptions options);
|
||||
Task<byte[]> ExportToMemoryAsync(DataTable data, ExportOptions options);
|
||||
}
|
||||
10
SQLVision.Core/Interfaces/IMemoryExportHandler.cs
Normal file
10
SQLVision.Core/Interfaces/IMemoryExportHandler.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using SQLVision.Core.Models;
|
||||
using System.Data;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SQLVision.Core.Interfaces;
|
||||
|
||||
public interface IMemoryExportHandler
|
||||
{
|
||||
Task<byte[]> ExportToMemoryAsync(DataTable data, ExportOptions options);
|
||||
}
|
||||
13
SQLVision.Core/Interfaces/IPluginContext.cs
Normal file
13
SQLVision.Core/Interfaces/IPluginContext.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SQLVision.Core.Enums;
|
||||
|
||||
namespace SQLVision.Core.Interfaces;
|
||||
|
||||
public interface IPluginContext
|
||||
{
|
||||
IServiceProvider ServiceProvider { get; }
|
||||
IConfiguration Configuration { get; }
|
||||
ILogger Logger { get; }
|
||||
Task ShowNotificationAsync(string message, NotificationType type);
|
||||
}
|
||||
13
SQLVision.Core/Interfaces/IPluginManager.cs
Normal file
13
SQLVision.Core/Interfaces/IPluginManager.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using SQLVision.Core.Models;
|
||||
|
||||
namespace SQLVision.Core.Interfaces;
|
||||
|
||||
public interface IPluginManager
|
||||
{
|
||||
void LoadPlugins(string pluginsDirectory);
|
||||
IEnumerable<ISqlVisionPlugin> GetPlugins();
|
||||
T? GetPlugin<T>() where T : ISqlVisionPlugin;
|
||||
|
||||
Task BeforeExecutionAsync(ScriptMetadata script, Dictionary<string, object> parameters);
|
||||
Task AfterExecutionAsync(ScriptMetadata script, ExecutionResult result);
|
||||
}
|
||||
38
SQLVision.Core/Interfaces/IScriptManager.cs
Normal file
38
SQLVision.Core/Interfaces/IScriptManager.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using SQLVision.Core.Enums;
|
||||
using SQLVision.Core.Models;
|
||||
|
||||
namespace SQLVision.Core.Interfaces;
|
||||
|
||||
public interface IScriptManager
|
||||
{
|
||||
Task<IEnumerable<ScriptMetadata>> LoadScriptsAsync(string? directory = null);
|
||||
Task<ScriptMetadata> ReloadScriptAsync(string filePath);
|
||||
void WatchDirectory(string directory, Action<string> onScriptChanged);
|
||||
|
||||
event EventHandler<ScriptChangedEventArgs> ScriptChanged;
|
||||
event EventHandler<ScriptsReloadedEventArgs> ScriptsReloaded;
|
||||
}
|
||||
|
||||
public class ScriptChangedEventArgs : EventArgs
|
||||
{
|
||||
public string FilePath { get; }
|
||||
public ScriptChangeType ChangeType { get; }
|
||||
public ScriptMetadata? Script { get; }
|
||||
|
||||
public ScriptChangedEventArgs(string filePath, ScriptChangeType changeType, ScriptMetadata? script = null)
|
||||
{
|
||||
FilePath = filePath;
|
||||
ChangeType = changeType;
|
||||
Script = script;
|
||||
}
|
||||
}
|
||||
|
||||
public class ScriptsReloadedEventArgs : EventArgs
|
||||
{
|
||||
public IEnumerable<ScriptMetadata> Scripts { get; }
|
||||
|
||||
public ScriptsReloadedEventArgs(IEnumerable<ScriptMetadata> scripts)
|
||||
{
|
||||
Scripts = scripts;
|
||||
}
|
||||
}
|
||||
30
SQLVision.Core/Interfaces/ISqlExecutionService.cs
Normal file
30
SQLVision.Core/Interfaces/ISqlExecutionService.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using SQLVision.Core.Enums;
|
||||
using SQLVision.Core.Models;
|
||||
using System.Data;
|
||||
|
||||
namespace SQLVision.Core.Interfaces;
|
||||
|
||||
public interface ISqlExecutionService
|
||||
{
|
||||
Task<ExecutionResult> ExecuteAsync(
|
||||
ScriptMetadata script,
|
||||
Dictionary<string, object> parameters,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
Task<ExecutionResult> ExecuteAsync(
|
||||
string sql,
|
||||
Dictionary<string, object> parameters,
|
||||
string connectionString,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
Task<bool> TestConnectionAsync(
|
||||
string connectionString,
|
||||
DatabaseProvider provider,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
Task<DataTable> LoadComboBoxDataAsync(
|
||||
string query,
|
||||
string connectionString,
|
||||
DatabaseProvider provider,
|
||||
CancellationToken cancellationToken = default);
|
||||
}
|
||||
9
SQLVision.Core/Interfaces/ISqlScriptParser.cs
Normal file
9
SQLVision.Core/Interfaces/ISqlScriptParser.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using SQLVision.Core.Models;
|
||||
|
||||
namespace SQLVision.Core.Interfaces;
|
||||
|
||||
public interface ISqlScriptParser
|
||||
{
|
||||
ScriptMetadata Parse(string filePath, string sqlContent);
|
||||
Task<ScriptMetadata> ParseAsync(string filePath, CancellationToken cancellationToken = default);
|
||||
}
|
||||
11
SQLVision.Core/Interfaces/ISqlVisionPlugin.cs
Normal file
11
SQLVision.Core/Interfaces/ISqlVisionPlugin.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace SQLVision.Core.Interfaces;
|
||||
|
||||
public interface ISqlVisionPlugin
|
||||
{
|
||||
string Name { get; }
|
||||
string Description { get; }
|
||||
Version Version { get; }
|
||||
|
||||
Task InitializeAsync(IPluginContext context);
|
||||
Task ShutdownAsync();
|
||||
}
|
||||
Reference in New Issue
Block a user