using System.Runtime.CompilerServices;
using Elsa.Expressions.Models;
using Elsa.Extensions;
using Elsa.Sql.Contracts;
using Elsa.Sql.UIHints;
using Elsa.Workflows;
using Elsa.Workflows.Attributes;
using Elsa.Workflows.Models;
using Elsa.Workflows.UIHints;
namespace Elsa.Sql.Activities;
///
/// Execute given SQL command and return a single result.
///
[Activity("Elsa", "SQL", "Execute given SQL command and return a single result.", DisplayName = "SQL Single Value", Kind = ActivityKind.Task)]
public class SqlSingleValue : Activity
{
///
///
///
public SqlSingleValue([CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) : base(source, line)
{
}
///
/// Database client to connect with.
///
[Input(
Description = "Database client.",
UIHint = InputUIHints.DropDown,
UIHandler = typeof(SqlClientsDropDownProvider))]
public Input Client { get; set; } = null!;
///
/// Connection string.
///
[Input(
Description = "Connection string.",
CanContainSecrets = true)]
public Input ConnectionString { get; set; } = null!;
///
/// Command to run against the database.
///
[Input(
Description = "Query to run against the database.",
DefaultSyntax = "Sql",
UIHint = InputUIHints.CodeEditor,
UIHandler = typeof(SqlCodeOptionsProvider)
)]
public Input Command { get; set; } = null!;
///
/// Command result.
///
[Output(
Description = "Command result.")]
public Output