SmartQueryAdapter
Namespace: Wisej.AI.Adapters
Assembly: Wisej.AI
Represents an adapter that generates a data set from a database schema and a user-provided description.
- C#
- VB.NET
public class SmartQueryAdapter : SmartAdapter
Public Class SmartQueryAdapter
Inherits SmartAdapter
The SmartQueryAdapter class is designed to interact with a database schema and generate SQL queries based on user input. It utilizes a SmartPrompt to facilitate the query generation process.
Constructors
SmartQueryAdapter()
Initializes a new instance of the SmartQueryAdapter class.
Properties
Connection
IDbConnection: Gets or sets the database connection used to execute the query.
DataSource
BindingSource: Gets or sets the data source binding for the query results.
Query
String: Gets or sets the query description provided by the user.
When the AutoRun property is set to true, setting this property will automatically execute the query asynchronously.
Schema
DataTable: Gets or sets the database schema used to generate the query.
ServerType
String: Gets or sets the type of the database server. (Default: "Microsoft Sql Server")
SQL
String: Gets the SQL statement generated from the query description.
Methods
GetSQL(message)
Returns the JSON string returned in the message by stripping the enclosing markers (sql and ) if present.
| Parameter | Type | Description |
|---|---|---|
| message | Message | Message with the response text that may be a JSON string. |
Returns: String. JSON string.
RunAsyncCore(control)
Asynchronously runs the core logic to generate and execute the SQL query.
| Parameter | Type | Description |
|---|---|---|
| control | Control | The control associated with the operation, if any. |
Returns: Task<Message>. A task representing the asynchronous operation, with a Message result containing the query execution details.
Implements
| Name | Description |
|---|---|
| IToolProvider | Represents a provider that supplies tools. |