### Install FluentCommand NuGet Package Source: https://loresoft.com/FluentCommand/index.html Use this command in the Package Manager Console to install the FluentCommand library. ```powershell PM> Install-Package FluentCommand __ ``` -------------------------------- ### Appsettings.json Connection String Example Source: https://loresoft.com/FluentCommand/guide/configuration.html Example JSON structure for defining connection strings in appsettings.json. Ensure the 'Tracker' key matches the name used in your configuration. ```json { "ConnectionStrings": { "Tracker": "Data Source=(local);Initial Catalog=TrackerTest;Integrated Security=True;TrustServerCertificate=True;" } } ``` -------------------------------- ### Start Bulk Copy with Table Name - C# Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Bulk.DataBulkCopyExtensions.html Use this method to start a bulk copy operation by specifying the data session and the destination table name. It returns an IDataBulkCopy instance for further configuration. ```csharp public static IDataBulkCopy BulkCopy(this IDataSession session, string destinationTable) ``` -------------------------------- ### AddService Method Source: https://loresoft.com/FluentCommand/reference/FluentCommand.DataConfigurationBuilder.html Registers services using a configuration setup action. ```csharp public DataConfigurationBuilder AddService(Action setupAction) ``` -------------------------------- ### Sql Source: https://loresoft.com/FluentCommand/reference/FluentCommand.DataSession.html Starts a data command with the specified SQL statement. ```APIDOC ## Sql(string) ### Description Starts a data command with the specified SQL statement. ### Method POST ### Endpoint /websites/loresoft_fluentcommand/sql ### Parameters #### Query Parameters - **sql** (string) - Required - The SQL statement. ### Response #### Success Response (200) - **IDataCommand** (IDataCommand) - A fluent interface to a data command. ### Request Example ```json { "sql": "SELECT * FROM users" } ``` ### Response Example ```json { "IDataCommand": "" } ``` ``` -------------------------------- ### Statement Method Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.QueryBuilder.html Starts a new raw SQL statement builder. ```csharp public StatementBuilder Statement()__ ``` -------------------------------- ### Configure Temporal Query From Start to End Time Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.TemporalBuilder.html Configures the query to retrieve rows active from a start UTC time to an end UTC time using `FOR SYSTEM_TIME FROM ... AND ...`. Returns the builder for chaining. ```csharp public TemporalBuilder FromTo(DateTime utcStart, DateTime utcEnd) ``` -------------------------------- ### BeginTransactionAsync - Start Database Transaction Source: https://loresoft.com/FluentCommand/reference/FluentCommand.DataSession.html Starts a database transaction with a specified isolation level. Use IsolationLevel.Unspecified for default behavior. Requires a CancellationToken for asynchronous operations. ```csharp public Task BeginTransactionAsync(IsolationLevel isolationLevel = IsolationLevel.Unspecified, CancellationToken cancellationToken = default)__ ``` -------------------------------- ### BeginTransaction Method Source: https://loresoft.com/FluentCommand/reference/FluentCommand.DataSession.html Starts a database transaction with a specified isolation level. ```csharp public DbTransaction BeginTransaction(IsolationLevel isolationLevel = IsolationLevel.Unspecified)__ ``` -------------------------------- ### Select Statement Builders Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.QueryBuilder.html Methods to start building SELECT statements. ```csharp public SelectBuilder Select()__ ``` ```csharp public SelectEntityBuilder Select() where TEntity : class__ ``` -------------------------------- ### Transaction Management Methods Source: https://loresoft.com/FluentCommand/reference/FluentCommand.IDataSession.html Methods for starting database transactions synchronously or asynchronously. ```csharp DbTransaction BeginTransaction(IsolationLevel isolationLevel)__ ``` ```csharp Task BeginTransactionAsync(IsolationLevel isolationLevel = IsolationLevel.Unspecified, CancellationToken cancellationToken = default)__ ``` -------------------------------- ### BeginTransactionAsync Source: https://loresoft.com/FluentCommand/reference/FluentCommand.DataSession.html Starts a database transaction with the specified isolation level. ```APIDOC ## BeginTransactionAsync(IsolationLevel, CancellationToken) ### Description Starts a database transaction with the specified isolation level. ### Method POST ### Endpoint /websites/loresoft_fluentcommand ### Parameters #### Query Parameters - **isolationLevel** (IsolationLevel) - Optional - Specifies the isolation level for the transaction. - **cancellationToken** (CancellationToken) - Optional - The cancellation instruction. ### Response #### Success Response (200) - **DbTransaction** (DbTransaction) - A DbTransaction representing the new transaction. ### Request Example ```json { "isolationLevel": "ReadCommitted", "cancellationToken": null } ``` ### Response Example ```json { "DbTransaction": "" } ``` ``` -------------------------------- ### Get Source: https://loresoft.com/FluentCommand/reference/FluentCommand.IDataCache.html Retrieves a cache entry synchronously. ```APIDOC ## Get ### Description Gets the specified cache entry from the cache as an object. ### Parameters - **key** (string) - Required - A unique identifier for the cache entry. ### Response - **Success** (bool) - True if the key was found; otherwise false. - **Value** (T) - The cache entry that is identified by key. ``` -------------------------------- ### Sql - Construct SQL Command Source: https://loresoft.com/FluentCommand/reference/FluentCommand.DataSession.html Starts building a data command using a raw SQL statement. Returns an IDataCommand for fluent interface chaining. ```csharp public IDataCommand Sql(string sql)__ ``` -------------------------------- ### StoredProcedure Source: https://loresoft.com/FluentCommand/reference/FluentCommand.DataSession.html Starts a data command with the specified stored procedure name. ```APIDOC ## StoredProcedure(string) ### Description Starts a data command with the specified stored procedure name. ### Method POST ### Endpoint /websites/loresoft_fluentcommand/stored-procedure ### Parameters #### Query Parameters - **storedProcedureName** (string) - Required - Name of the stored procedure. ### Response #### Success Response (200) - **IDataCommand** (IDataCommand) - A fluent interface to a data command. ### Request Example ```json { "storedProcedureName": "GetUserById" } ``` ### Response Example ```json { "IDataCommand": "" } ``` ``` -------------------------------- ### Start Bulk Copy by Entity Type - C# Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Bulk.DataBulkCopyExtensions.html Initiates a bulk copy operation using the data session. The destination table is inferred from the entity type TEntity. Returns an IDataBulkCopy instance for configuration. ```csharp public static IDataBulkCopy BulkCopy(this IDataSession session) ``` -------------------------------- ### GetGuid and GetGuidNull Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Extensions.DataRecordExtensions.html Retrieves a Guid value from a specified field. GetGuidNull returns a nullable Guid. ```APIDOC ## GetGuid(IDataRecord, string) ### Description Gets the Guid value of the specified field. ### Method GET (Conceptual - Extension Method) ### Endpoint N/A (Extension Method) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **Guid** - The Guid value of the specified field. #### Response Example ```json "00000000-0000-0000-0000-000000000000" ``` ## GetGuidNull(IDataRecord, string) ### Description Gets the nullable Guid value of the specified field. ### Method GET (Conceptual - Extension Method) ### Endpoint N/A (Extension Method) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **Guid?** - The nullable Guid value of the specified field. #### Response Example ```json "00000000-0000-0000-0000-000000000000" ``` ``` -------------------------------- ### Insert Statement Builders Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.QueryBuilder.html Methods to start building INSERT statements. ```csharp public InsertBuilder Insert()__ ``` ```csharp public InsertEntityBuilder Insert() where TEntity : class__ ``` -------------------------------- ### Initialize DataConfiguration Source: https://loresoft.com/FluentCommand/reference/FluentCommand.DataConfiguration.html Constructor for setting up the database provider, connection string, and optional infrastructure components like cache and loggers. ```csharp public DataConfiguration(DbProviderFactory providerFactory, string connectionString, IDataCache? cache = null, IQueryGenerator? queryGenerator = null, IDataQueryLogger? queryLogger = null, IEnumerable? interceptors = null)__ ``` -------------------------------- ### Get and Set Property Values Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Reflection.PropertyAccessor.html Methods for performing dynamic get and set operations on an object instance. ```csharp public override object? GetValue(object instance)__ ``` ```csharp public override void SetValue(object instance, object? value)__ ``` -------------------------------- ### Get SqlDbType for a Type Source: https://loresoft.com/FluentCommand/reference/FluentCommand.SqlTypeMapping.html Use DbType(Type) to get the SQL Server SqlDbType for a given .NET Type. Returns NVarChar if the type is not explicitly mapped. ```csharp public static SqlDbType DbType(Type type)__ ``` -------------------------------- ### ImportProcessContext Constructor Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Import.ImportProcessContext.html Initializes a new instance with the required service provider, import definition, data, and user identity. ```csharp public ImportProcessContext(IServiceProvider serviceProvider, ImportDefinition definition, ImportData importData, string userName)__ ``` -------------------------------- ### BulkCopy(IDataSession, string) Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Bulk.DataBulkCopyExtensions.html Starts a bulk copy operation to a specified SQL Server table. ```APIDOC ## BulkCopy(IDataSession, string) ### Description Starts a bulk copy operation using the specified data session and destination table name. ### Method POST ### Endpoint /api/bulkcopy ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **session** (IDataSession) - Required - The IDataSession to use for the bulk copy operation. - **destinationTable** (string) - Required - The name of the destination table on the SQL Server. ### Request Example ```json { "session": "", "destinationTable": "YourTableName" } ``` ### Response #### Success Response (200) - **IDataBulkCopy** (IDataBulkCopy) - An IDataBulkCopy instance for configuring and executing the bulk copy operation. #### Response Example ```json { "dataBulkCopyInstance": "" } ``` ``` -------------------------------- ### QuerySingle Method Source: https://loresoft.com/FluentCommand/reference/FluentCommand.IDataQuery.html Executes a query and maps the first row to a TEntity object. ```csharp TEntity? QuerySingle(Func factory, CommandBehavior commandBehavior = CommandBehavior.SingleResult | CommandBehavior.SingleRow)__ ``` -------------------------------- ### Get SqlDbType for a Generic Type Source: https://loresoft.com/FluentCommand/reference/FluentCommand.SqlTypeMapping.html Use DbType() to get the SQL Server SqlDbType for a generic .NET type T. Returns NVarChar if the type is not explicitly mapped. ```csharp public static SqlDbType DbType()__ ``` -------------------------------- ### Create new instances Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Reflection.TypeAccessor.html Method to instantiate the type using the default constructor. ```csharp public object Create()__ ``` -------------------------------- ### Get Default Value for a Type Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Extensions.TypeExtensions.html Use this extension method to get the default value for a specified type. This is useful when you need a default instance of a type without explicitly knowing its default value. ```csharp public static object? Default(this Type type)__ ``` -------------------------------- ### Create database connections and sessions Source: https://loresoft.com/FluentCommand/reference/FluentCommand.DataConfiguration.html Methods for instantiating database connections or data sessions based on the current configuration. ```csharp public virtual DbConnection CreateConnection(string? connectionString = null)__ ``` ```csharp public IDataSession CreateSession(DbTransaction transaction)__ ``` ```csharp public virtual IDataSession CreateSession(string? connectionString = null)__ ``` -------------------------------- ### Initialize DataConfigurationBuilder Source: https://loresoft.com/FluentCommand/reference/FluentCommand.DataConfigurationBuilder.html Creates a new instance of the builder using the provided service collection. ```csharp public DataConfigurationBuilder(IServiceCollection services)__ ``` -------------------------------- ### BeginTransaction Source: https://loresoft.com/FluentCommand/reference/FluentCommand.DataSession.html Starts a new database transaction for the current session with an optional isolation level. ```APIDOC ## POST /DataSession/BeginTransaction ### Description Starts a database transaction with the specified isolation level. ### Method POST ### Parameters #### Query Parameters - **isolationLevel** (IsolationLevel) - Optional - Specifies the isolation level for the transaction (default: IsolationLevel.Unspecified). ### Response #### Success Response (200) - **transaction** (DbTransaction) - A DbTransaction representing the new transaction. ``` -------------------------------- ### MethodAccessor.Name Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Reflection.MethodAccessor.html Gets the name of the method. ```csharp public string Name { get; } ``` -------------------------------- ### Query Method Source: https://loresoft.com/FluentCommand/reference/FluentCommand.DataCommand.html Executes a command and converts results into a collection of TEntity objects using a factory delegate. ```csharp public IEnumerable Query(Func factory, CommandBehavior commandBehavior = CommandBehavior.SingleResult)__ ``` -------------------------------- ### Query Method Source: https://loresoft.com/FluentCommand/reference/FluentCommand.IDataQuery.html Executes a command and returns an enumerable collection of TEntity objects. ```csharp IEnumerable Query(Func factory, CommandBehavior commandBehavior = CommandBehavior.SingleResult)__ ``` -------------------------------- ### Get Native SQL Server Type Name for a Generic Type Source: https://loresoft.com/FluentCommand/reference/FluentCommand.SqlTypeMapping.html Use NativeType() to get the SQL Server native type name as a string for a generic .NET type T. Returns `sql_variant` if the type is not explicitly mapped. ```csharp public static string NativeType()__ ``` -------------------------------- ### Initialize DataConfiguration constructor Source: https://loresoft.com/FluentCommand/reference/FluentCommand.DataConfiguration-1.html Constructor for initializing the configuration with provider factory, connection string, and optional dependencies. ```csharp public DataConfiguration(DbProviderFactory providerFactory, string connectionString, IDataCache? cache = null, IQueryGenerator? queryGenerator = null, IDataQueryLogger? queryLogger = null, IEnumerable? interceptors = null) ``` -------------------------------- ### MethodAccessor.MethodInfo Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Reflection.MethodAccessor.html Gets the MethodInfo associated with this accessor. ```csharp public MethodInfo MethodInfo { get; }__ ``` -------------------------------- ### TableExpression Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.Generators.DeleteStatement.html Gets or initializes the table from which records will be deleted. ```csharp public TableExpression TableExpression { get; init; } ``` -------------------------------- ### Register FluentCommand with Dependency Injection (Connection String) Source: https://loresoft.com/FluentCommand/guide/configuration.html Register FluentCommand with the service collection using a connection string and SQL Server provider. This is a common setup for web applications. ```csharp services.AddFluentCommand(builder => builder .UseConnectionString(ConnectionString) .UseSqlServer() ); ``` -------------------------------- ### Apply IgnorePropertyAttribute Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Attributes.IgnorePropertyAttribute.html Examples of applying the attribute to a property or a class. ```csharp [IgnoreProperty] public string InternalNotes { get; set; }__ ``` ```csharp [IgnoreProperty(nameof(Product.InternalNotes))] public class Product { ... }__ ``` -------------------------------- ### Basic select query Source: https://loresoft.com/FluentCommand/guide/sql.html Demonstrates a standard select operation with filtering, ordering, and pagination, mapping results to a User object. ```csharp await using var session = Services.GetRequiredService(); string email = "kara.thrace@battlestar.com"; var user = await session .Sql(builder => builder .Select() .Where(p => p.EmailAddress, email) .OrderBy(p => p.EmailAddress) .Limit(0, 10) ) .QuerySingleAsync(r => new User { Id = r.GetGuid("Id"), EmailAddress = r.GetString("EmailAddress"), IsEmailAddressConfirmed = r.GetBoolean("IsEmailAddressConfirmed"), DisplayName = r.GetString("DisplayName"), PasswordHash = r.GetString("PasswordHash"), ResetHash = r.GetString("ResetHash"), InviteHash = r.GetString("InviteHash"), AccessFailedCount = r.GetInt32("AccessFailedCount"), LockoutEnabled = r.GetBoolean("LockoutEnabled"), LockoutEnd = r.GetDateTimeOffsetNull("LockoutEnd"), LastLogin = r.GetDateTimeOffsetNull("LastLogin"), IsDeleted = r.GetBoolean("IsDeleted"), Created = r.GetDateTimeOffset("Created"), CreatedBy = r.GetString("CreatedBy"), Updated = r.GetDateTimeOffset("Updated"), UpdatedBy = r.GetString("UpdatedBy"), RowVersion = r.GetBytes("RowVersion"), }); ``` ```sql SELECT * FROM [User] WHERE ([EmailAddress] = @p0000) ORDER BY [EmailAddress] ASC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY; ``` -------------------------------- ### Initialize DataCommand Source: https://loresoft.com/FluentCommand/reference/FluentCommand.DataCommand.html Constructor for creating a new instance of DataCommand with a session, optional transaction, and optional interceptors. ```csharp public DataCommand(IDataSession dataSession, DbTransaction? transaction, IDataCommandInterceptor[]? commandInterceptors = null)__ ``` -------------------------------- ### Get Member Name Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Reflection.MemberAccessor.html Retrieves the name of the member as defined in the entity. ```csharp public abstract string Name { get; } ``` -------------------------------- ### DataConfiguration Constructor Source: https://loresoft.com/FluentCommand/reference/FluentCommand.DataConfiguration.html Initializes a new instance of the DataConfiguration class with the required database provider and configuration settings. ```APIDOC ## Constructor: DataConfiguration ### Description Initializes a new instance of the DataConfiguration class. ### Parameters - **providerFactory** (DbProviderFactory) - Required - The database provider factory. - **connectionString** (string) - Required - The database connection string. - **cache** (IDataCache) - Optional - The data cache manager. - **queryGenerator** (IQueryGenerator) - Optional - The query generator. - **queryLogger** (IDataQueryLogger) - Optional - The data command query logger. - **interceptors** (IEnumerable) - Optional - The interceptors to apply to each session created from this configuration. ### Exceptions - **ArgumentNullException** - Thrown if providerFactory is null. ``` -------------------------------- ### Get MemberType of Member Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Reflection.MemberAccessor.html Retrieves the Type of the member (property or field). ```csharp public abstract Type MemberType { get; } ``` -------------------------------- ### Statement Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.StatementBuilder.html Gets or sets the SQL query statement string. ```csharp protected string Statement { get; set; }__ ``` -------------------------------- ### Initialize JoinEntityBuilder Constructor Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.JoinEntityBuilder-2.html Initializes a new instance of the JoinEntityBuilder class with a query generator and a list of query parameters. ```csharp public JoinEntityBuilder(IQueryGenerator queryGenerator, List parameters) ``` -------------------------------- ### See Also Source: https://loresoft.com/FluentCommand/reference/FluentCommand.DataSession-1.html Related classes and interfaces for further reference. ```APIDOC ## See Also * DisposableBase * IDataSession ``` -------------------------------- ### Get hash code Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.Generators.SelectStatement.html Returns the hash code for the current instance. ```csharp public override int GetHashCode()__ ``` -------------------------------- ### SortDirection Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.Generators.SortExpression.html Gets or sets the direction for sorting (Ascending or Descending). ```csharp public SortDirections SortDirection { get; init; } ``` -------------------------------- ### Read Method Source: https://loresoft.com/FluentCommand/reference/FluentCommand.IDataQuery.html Executes a command and processes the IDataReader via a provided action delegate. ```csharp void Read(Action readAction, CommandBehavior commandBehavior = CommandBehavior.Default)__ ``` -------------------------------- ### Initialize LogicalEntityBuilder Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.LogicalEntityBuilder-1.html Constructor for initializing a new instance of the builder with a query generator, parameter list, and default logical operator. ```csharp public LogicalEntityBuilder(IQueryGenerator queryGenerator, List parameters, LogicalOperators logicalOperator = LogicalOperators.And) ``` -------------------------------- ### EqualityContract Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.Generators.DeleteStatement.html Gets the type that represents the contract for equality comparisons. ```csharp protected virtual Type EqualityContract { get; } ``` -------------------------------- ### ListDataReader FieldCount Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.ListDataReader-1.html Gets the number of fields in the current row. ```csharp public override int FieldCount { get; }__ ``` -------------------------------- ### Create Data Session with Connection String Source: https://loresoft.com/FluentCommand/reference/FluentCommand.IDataSessionFactory.html Creates a new data session using a provided connection string. If no connection string is provided, a default one may be used. ```csharp IDataSession CreateSession(string? connectionString = null)__ ``` -------------------------------- ### Implement ConnectionOpened Method Source: https://loresoft.com/FluentCommand/reference/FluentCommand.IDataConnectionInterceptor.html Implement this method to execute logic immediately after a database connection is opened synchronously. For example, setting SQL Server session context. ```csharp void ConnectionOpened(DbConnection connection, IDataSession session) ``` -------------------------------- ### PropertyName Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Attributes.IgnorePropertyAttribute.html Gets or sets the name of the property or field to ignore. ```csharp public string? PropertyName { get; set; }__ ``` -------------------------------- ### Configure SQL Server Data Access Source: https://loresoft.com/FluentCommand/guide/configuration.html Instantiate DataConfiguration for SQL Server using a connection string. Ensure you have the necessarySqlClientFactory and ConnectionString defined. ```csharp var dataConfiguration = new DataConfiguration( SqlClientFactory.Instance, ConnectionString ); ``` -------------------------------- ### Update Statement Builders Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.QueryBuilder.html Methods to start building UPDATE statements. ```csharp public UpdateBuilder Update()__ ``` ```csharp public UpdateEntityBuilder Update() where TEntity : class__ ``` -------------------------------- ### Initialize LogicalBuilder Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.LogicalBuilder-1.html Constructor for initializing a new instance of the LogicalBuilder class with a query generator and parameters. ```csharp protected LogicalBuilder(IQueryGenerator queryGenerator, List parameters, LogicalOperators logicalOperator = LogicalOperators.And)__ ``` -------------------------------- ### JoinEntityBuilder Constructor Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.JoinEntityBuilder-2.html Initializes a new instance of the JoinEntityBuilder class. ```APIDOC ## JoinEntityBuilder Constructor ### Description Initializes a new instance of the JoinEntityBuilder class. ### Parameters - **queryGenerator** (IQueryGenerator) - Required - The IQueryGenerator used to generate SQL expressions. - **parameters** (List) - Required - The list of QueryParameter objects for the query. ``` -------------------------------- ### Implement ConcurrencyToken Methods Source: https://loresoft.com/FluentCommand/reference/FluentCommand.ConcurrencyToken.html Standard methods for equality, hashing, and string representation. ```csharp public bool Equals(ConcurrencyToken other)__ ``` ```csharp public override bool Equals(object? obj)__ ``` ```csharp public override int GetHashCode()__ ``` ```csharp public override string ToString()__ ``` -------------------------------- ### Delete Statement Builders Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.QueryBuilder.html Methods to start building DELETE statements. ```csharp public DeleteBuilder Delete()__ ``` ```csharp public DeleteEntityBuilder Delete() where TEntity : class__ ``` -------------------------------- ### QuerySingle Methods Source: https://loresoft.com/FluentCommand/reference/FluentCommand.DataQueryExtensions.html Methods for executing queries and retrieving the first row of the result set. ```APIDOC ## QuerySingle(IDataQuery) ### Description Executes the query and returns the first row in the result as a dynamic object. ### Parameters - **dataQuery** (IDataQuery) - Required - The IDataQuery for this extension method. ### Response - **Returns** (dynamic) - A instance of a dynamic object if row exists; otherwise null. ## QuerySingleAsync(IDataQueryAsync, CancellationToken) ### Description Executes the query and returns the first row in the result as a dynamic object asynchronously. ### Parameters - **dataQuery** (IDataQueryAsync) - Required - The IDataQueryAsync for this extension method. - **cancellationToken** (CancellationToken) - Optional - The cancellation instruction. ### Response - **Returns** (Task) - A instance of a dynamic object if row exists; otherwise null. ## QuerySingleAsync(IDataQueryAsync, Func, CancellationToken) ### Description Executes the query and returns the first row in the result as a TEntity object asynchronously. ### Parameters - **dataQuery** (IDataQueryAsync) - Required - The IDataQuery for this extension method. - **factory** (Func) - Required - The delegate factory to convert the IDataReader to TEntity. - **cancellationToken** (CancellationToken) - Optional - The cancellation instruction. ### Response - **Returns** (Task) - A instance of TEntity if row exists; otherwise null. ### Exceptions - **ArgumentNullException** - factory is null ``` -------------------------------- ### PostgreSqlGenerator Constructor Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.Generators.PostgreSqlGenerator.html Initializes a new instance of the PostgreSqlGenerator class. ```csharp public PostgreSqlGenerator() ``` -------------------------------- ### Initialize StatementBuilder Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.StatementBuilder-1.html Constructor for initializing the builder with a query generator and parameter list. ```csharp protected StatementBuilder(IQueryGenerator queryGenerator, List parameters)__ ``` -------------------------------- ### Initialize ChangeTableBuilder Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.ChangeTableBuilder.html Initializes a new instance of the ChangeTableBuilder class. Requires an IQueryGenerator and a list of QueryParameter objects. ```csharp public ChangeTableBuilder(IQueryGenerator queryGenerator, List parameters) ``` -------------------------------- ### Initialize DataMergeColumnMapping Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Merge.DataMergeColumnMapping.html Use this constructor to create a new instance of DataMergeColumnMapping, providing the DataMergeColumn to be configured. ```csharp public DataMergeColumnMapping(DataMergeColumn mergeColumn) ``` -------------------------------- ### Get Method Name from IMethodAccessor Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Reflection.IMethodAccessor.html Retrieves the name of the method represented by the accessor. ```csharp string Name { get; }__ ``` -------------------------------- ### Get MethodInfo from IMethodAccessor Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Reflection.IMethodAccessor.html Retrieves the MethodInfo object associated with the method accessor. ```csharp MethodInfo MethodInfo { get; }__ ``` -------------------------------- ### From Method Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.UpdateEntityBuilder-1.html Configures the target table for the UPDATE statement, optionally specifying schema and alias. ```csharp public override UpdateEntityBuilder From(string? tableName = null, string? tableSchema = null, string? tableAlias = null)__ ``` -------------------------------- ### Access Parameters property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.StatementBuilder-1.html Gets the list of QueryParameter objects used in the query. ```csharp protected List Parameters { get; }__ ``` -------------------------------- ### Register FluentCommand with Dependency Injection (Connection Name) Source: https://loresoft.com/FluentCommand/guide/configuration.html Register FluentCommand using a connection name defined in appsettings.json. This promotes configuration management. ```csharp services.AddFluentCommand(builder => builder .UseConnectionName("Tracker") .UseSqlServer() ); ``` -------------------------------- ### InsertBuilder TableExpression Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.InsertBuilder-1.html Gets the target table expression for the INSERT statement. ```csharp protected TableExpression? TableExpression { get; } ``` -------------------------------- ### PostgreSqlGenerator Constructor Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.Generators.PostgreSqlGenerator.html Initializes a new instance of the PostgreSqlGenerator class. ```APIDOC ## PostgreSqlGenerator() ### Description Initializes a new instance of the PostgreSqlGenerator class. ### Method CONSTRUCTOR ### Endpoint N/A ### Parameters None ### Request Example None ### Response None ``` -------------------------------- ### InsertBuilder ColumnExpressions Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.InsertBuilder-1.html Gets the collection of column expressions for the INSERT statement. ```csharp protected HashSet ColumnExpressions { get; } ``` -------------------------------- ### JoinExpression RightTableSchema Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.Generators.JoinExpression.html Gets or sets the schema of the right table, which is optional. ```csharp public string? RightTableSchema { get; init; } ``` -------------------------------- ### JoinExpression RightTableName Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.Generators.JoinExpression.html Gets or sets the name of the right table in the join. ```csharp public string RightTableName { get; init; } ``` -------------------------------- ### Initialize OrderEntityBuilder Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.OrderEntityBuilder-1.html Initializes a new instance of the OrderEntityBuilder class. Requires an IQueryGenerator and a list of QueryParameter objects. ```csharp public OrderEntityBuilder(IQueryGenerator queryGenerator, List parameters) ``` -------------------------------- ### JoinExpression RightTableAlias Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.Generators.JoinExpression.html Gets or sets the alias of the right table in the join. ```csharp public string RightTableAlias { get; init; } ``` -------------------------------- ### JoinExpression LeftTableAlias Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.Generators.JoinExpression.html Gets or sets the alias of the left table in the join. ```csharp public string LeftTableAlias { get; init; } ``` -------------------------------- ### IDataCommand Methods Source: https://loresoft.com/FluentCommand/reference/FluentCommand.IDataCommand.html Documentation for the methods available on the IDataCommand interface, including execution, parameter management, and caching. ```APIDOC ## Methods ### CommandTimeout(int) Sets the wait time (in seconds) before terminating the attempt to execute the command and generating an error. ```csharp IDataCommand CommandTimeout(int timeout) ``` #### Parameters - **timeout** (`int`) - The time in seconds to wait for the command to execute. #### Returns `IDataCommand` - A fluent interface to the data command. ### Execute() Executes the command against a connection. ```csharp int Execute() ``` #### Returns `int` - The number of rows affected. ### ExecuteAsync(CancellationToken) Executes the command against a connection asynchronously. ```csharp Task ExecuteAsync(CancellationToken cancellationToken = default) ``` #### Parameters - **cancellationToken** (`CancellationToken`) #### Returns `Task` - The number of rows affected. ### ExpireCache() Expires cached items that have been cached using the current DataCommand. ```csharp IDataCommand ExpireCache() ``` #### Type Parameters - **TEntity** - The type of the entity. #### Remarks Cached keys are created using the current DataCommand state. When any Query operation is executed with a cache policy, the results are cached. Use this method with the same parameters to expire the cached item. #### Returns `IDataCommand` - A fluent interface to the data command. ### LogState(object?) Use to pass a state to the IDataQueryLogger. ```csharp IDataCommand LogState(object? state) ``` #### Parameters - **state** (`object?`) - The state to pass to the logger. #### Remarks Use the state to help control what is logged. #### Returns `IDataCommand` - A fluent interface to the data command. ### Parameter(DbParameter) Adds the parameter to the underlying command. ```csharp IDataCommand Parameter(DbParameter parameter) ``` #### Parameters - **parameter** (`DbParameter`) #### Returns `IDataCommand` - A fluent interface to the data command. ### QueryMultiple(Action) Executes the command against the connection and sends the resulting IDataQuery for reading multiple results sets. ```csharp void QueryMultiple(Action queryAction) ``` ``` -------------------------------- ### WhereExpressions Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.Generators.DeleteStatement.html Gets or initializes the collection of WHERE clause conditions for the DELETE statement. ```csharp public IReadOnlyCollection WhereExpressions { get; init; } ``` -------------------------------- ### DataBulkCopy Constructor Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Bulk.DataBulkCopy.html Initializes a new instance with a data session and destination table name. ```csharp public DataBulkCopy(IDataSession dataSession, string destinationTable)__ ``` -------------------------------- ### Initialize ImportDefinitionBuilder Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Import.ImportDefinitionBuilder-1.html Initializes a new instance of the ImportDefinitionBuilder class using a provided ImportDefinition. ```csharp public ImportDefinitionBuilder(ImportDefinition importDefinition) ``` -------------------------------- ### JoinExpressions Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.Generators.DeleteStatement.html Gets or initializes the collection of join expressions for the DELETE statement. ```csharp public IReadOnlyCollection JoinExpressions { get; init; } ``` -------------------------------- ### DataCommand Constructors Source: https://loresoft.com/FluentCommand/reference/FluentCommand.DataCommand.html Initializes a new instance of the DataCommand class. ```APIDOC ## DataCommand Constructor ### Description Initializes a new instance of the DataCommand class. ### Method DataCommand ### Parameters #### Path Parameters - **dataSession** (IDataSession) - Required - The data session. - **transaction** (DbTransaction) - Optional - The DbTransaction for this DataCommand. - **commandInterceptors** (IDataCommandInterceptor[]) - Optional - Pre-filtered command interceptors from the owning session. ``` -------------------------------- ### FromExpressions Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.Generators.DeleteStatement.html Gets or initializes the collection of tables for the FROM clause in the DELETE statement. ```csharp public IReadOnlyCollection FromExpressions { get; init; } ``` -------------------------------- ### Initialize UpdateBuilder Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.UpdateBuilder-1.html Constructor for initializing the builder with a query generator and parameters. ```csharp protected UpdateBuilder(IQueryGenerator queryGenerator, List parameters, LogicalOperators logicalOperator = LogicalOperators.And) ``` -------------------------------- ### Get string representation Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Merge.DataMergeColumn.html Returns a string that represents the current DataMergeColumn instance. ```csharp public override string ToString()__ ``` -------------------------------- ### UseSqlServer Extension Method Source: https://loresoft.com/FluentCommand/reference/FluentCommand.DataConfigurationBuilderExtensions.html Configures the DataConfigurationBuilder to use SQL Server as the database provider, registering the SqlClientFactory and adding the SQL Server query generator. ```APIDOC ## UseSqlServer ### Description Configures the DataConfigurationBuilder to use SQL Server as the database provider. Registers the SqlClientFactory and adds the SQL Server query generator. ### Method Extension Method (static) ### Endpoint N/A (Extension Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```csharp // Assuming builder is an instance of DataConfigurationBuilder builder.UseSqlServer(); ``` ### Response #### Success Response Returns the same DataConfigurationBuilder instance to allow for method chaining. #### Response Example ```csharp // The method returns the builder instance var configuredBuilder = builder.UseSqlServer(); ``` ``` -------------------------------- ### IMemberAccessor Methods Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Reflection.MemberAccessor.html Methods for comparing accessors and getting or setting values on object instances. ```APIDOC ## Methods ### Equals(IMemberAccessor?) - **Description**: Determines whether the specified IMemberAccessor is equal to this instance. - **Parameters**: - **other** (IMemberAccessor) - Required - **Returns**: bool ### GetValue(object) - **Description**: Returns the value of the member for the specified object instance. - **Parameters**: - **instance** (object) - Required - **Returns**: object ### SetValue(object, object?) - **Description**: Sets the value of the member for the specified object instance. - **Parameters**: - **instance** (object) - Required - **value** (object) - Optional ``` -------------------------------- ### Initialize DeleteBuilder Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.DeleteBuilder-1.html Constructor for initializing a new instance of the DeleteBuilder class. ```csharp protected DeleteBuilder(IQueryGenerator queryGenerator, List parameters, LogicalOperators logicalOperator = LogicalOperators.And) ``` -------------------------------- ### Configure SQL command with Sql method Source: https://loresoft.com/FluentCommand/reference/FluentCommand.QueryBuilderExtensions.html Configures an IDataCommand using a fluent QueryBuilder action on an IDataSession. ```csharp public static IDataCommand Sql(this IDataSession dataSession, Action builder)__ ``` -------------------------------- ### Get MemberInfo for Accessor Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Reflection.MemberAccessor.html Retrieves the MemberInfo instance for the accessor, which provides reflection metadata. ```csharp public MemberInfo MemberInfo { get; } ``` -------------------------------- ### Initialize LogicalBuilder Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.LogicalBuilder.html Initializes a new instance of the LogicalBuilder class with a query generator, parameters, and an optional logical operator. ```csharp public LogicalBuilder(IQueryGenerator queryGenerator, List parameters, LogicalOperators logicalOperator = LogicalOperators.And) ``` -------------------------------- ### Get Member Name - IMemberInformation Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Reflection.IMemberInformation.html Retrieves the name of the member as defined in the entity class. ```csharp string Name { get; } ``` -------------------------------- ### Access QueryGenerator property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.StatementBuilder-1.html Gets the IQueryGenerator instance used for SQL expression generation. ```csharp protected IQueryGenerator QueryGenerator { get; }__ ``` -------------------------------- ### Data Command Execution Methods Source: https://loresoft.com/FluentCommand/reference/FluentCommand.IDataSession.html Methods to initiate data commands using raw SQL or stored procedures. ```csharp IDataCommand Sql(string sql)__ ``` ```csharp IDataCommand StoredProcedure(string storedProcedureName)__ ``` -------------------------------- ### Access CommentExpressions property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.StatementBuilder-1.html Gets or sets the list of comment expressions to be included in the query. ```csharp protected List CommentExpressions { get; set; }__ ``` -------------------------------- ### Read Methods Source: https://loresoft.com/FluentCommand/reference/FluentCommand.DataCommand.html Executes a command and processes the IDataReader via a delegate. Includes both synchronous and asynchronous variants. ```csharp public void Read(Action readAction, CommandBehavior commandBehavior = CommandBehavior.Default)__ ``` ```csharp public Task ReadAsync(Func readAction, CommandBehavior commandBehavior = CommandBehavior.Default, CancellationToken cancellationToken = default)__ ``` -------------------------------- ### InsertBuilder OutputExpressions Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.InsertBuilder-1.html Gets the collection of output column expressions for the INSERT statement. ```csharp protected HashSet OutputExpressions { get; } ``` -------------------------------- ### Right Method for JoinBuilder Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.JoinBuilder-1.html Specifies the right column and table to join on, including column name, table name, schema, and alias. Returns the builder instance for chaining. ```csharp public TBuilder Right(string columnName, string tableName, string? tableSchema, string? tableAlias) ``` -------------------------------- ### WriteToServer(IEnumerable) Method Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Bulk.DataBulkCopy.html Copies an enumerable collection of entities to the destination table. ```csharp public void WriteToServer(IEnumerable data) where TEntity : class__ ``` -------------------------------- ### WhereExpression FilterOperator Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.Generators.WhereExpression.html Gets or initializes the filter operator used in the WHERE clause condition. ```csharp public FilterOperators FilterOperator { get; init; } ``` -------------------------------- ### Initialize QueryParameter Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.QueryParameter.html Constructor for creating a new instance of QueryParameter with name, value, and type. ```csharp public QueryParameter(string name, object? value, Type type)__ ``` -------------------------------- ### UpdateExpression ParameterName Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.Generators.UpdateExpression.html Gets or initializes the parameter name for the value to be assigned in the update. ```csharp public string ParameterName { get; init; } ``` -------------------------------- ### Initialize TemporalBuilder Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.TemporalBuilder.html Initializes a new instance of the TemporalBuilder class. Requires an IQueryGenerator and a list of QueryParameter. ```csharp public TemporalBuilder(IQueryGenerator queryGenerator, List parameters) ``` -------------------------------- ### JoinExpression RightColumnName Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.Generators.JoinExpression.html Gets or sets the column name from the right table to join on. ```csharp public string RightColumnName { get; init; } ``` -------------------------------- ### JoinExpression LeftColumnName Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.Generators.JoinExpression.html Gets or sets the column name from the left table to join on. ```csharp public string LeftColumnName { get; init; } ``` -------------------------------- ### UseCache Methods Source: https://loresoft.com/FluentCommand/reference/FluentCommand.DataCommand.html Configures command caching with either absolute or sliding expiration. Commands with output or return parameters cannot be cached. ```csharp public IDataCommand UseCache(DateTimeOffset absoluteExpiration)__ ``` ```csharp public IDataCommand UseCache(TimeSpan slidingExpiration)__ ``` -------------------------------- ### Initialize DataMergeDefinition Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Merge.DataMergeDefinition.html Creates a new instance with default settings including empty columns and Auto mode. ```csharp public DataMergeDefinition()__ ``` -------------------------------- ### OutputExpressions Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.Generators.DeleteStatement.html Gets or initializes the collection of columns to be returned or output after the delete operation. ```csharp public IReadOnlyCollection OutputExpressions { get; init; } ``` -------------------------------- ### JoinBuilder Constructor Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.JoinBuilder.html Initializes a new instance of the JoinBuilder class. ```APIDOC ## JoinBuilder Constructor ### Description Initializes a new instance of the JoinBuilder class. ### Method Constructor ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ### Constructor Parameters - **queryGenerator** (IQueryGenerator) - Required - The IQueryGenerator used to generate SQL expressions. - **parameters** (List) - Required - The list of QueryParameter objects for the query. ``` -------------------------------- ### RecordsAffected Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.ListDataReader-1.html Gets the number of rows affected by the command. Always returns 0. ```csharp public override int RecordsAffected { get; } ``` -------------------------------- ### DataMergeOutputRow Columns Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Merge.DataMergeOutputRow.html Gets or sets the collection of columns that were affected by the merge operation. ```csharp public List Columns { get; set; } ``` -------------------------------- ### Initialize PropertyAccessor Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Reflection.PropertyAccessor.html Constructor for creating a new instance of PropertyAccessor. ```csharp public PropertyAccessor(PropertyInfo propertyInfo)__ ``` -------------------------------- ### HashCode Seed Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Internal.HashCode.html Gets the initial seed value for combining hash codes. ```csharp public static HashCode Seed { get; }__ ``` -------------------------------- ### Get ConcurrencyTokenHandler Value Type Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Handlers.ConcurrencyTokenHandler.html Retrieves the data type handled by this parameter handler. ```csharp public Type ValueType { get; } ``` -------------------------------- ### Add FluentCommand with Configuration Action Source: https://loresoft.com/FluentCommand/reference/FluentCommand.ServiceCollectionExtensions.html Use this method to add FluentCommand services and configure them using a DataConfigurationBuilder action. It returns the IServiceCollection for chaining. ```csharp public static IServiceCollection AddFluentCommand(this IServiceCollection services, Action builder) ``` -------------------------------- ### MergeData Methods Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Merge.DataMergeExtensions.html Methods to start a data merge operation using various configurations. ```APIDOC ## MergeData(IDataSession, DataMergeDefinition) ### Description Starts a data merge operation using the specified DataMergeDefinition. ### Parameters - **session** (IDataSession) - Required - The IDataSession to use for the merge operation. - **mergeDefinition** (DataMergeDefinition) - Required - The DataMergeDefinition that defines the merge configuration. ### Returns - **IDataMerge** - An IDataMerge instance for configuring and executing the merge operation. ## MergeData(IDataSession, string) ### Description Starts a data merge operation using the specified destination table name. ### Parameters - **session** (IDataSession) - Required - The IDataSession to use for the merge operation. - **destinationTable** (string) - Required - The name of the destination table on the server. ### Returns - **IDataMerge** - An IDataMerge instance for configuring and executing the merge operation. ## MergeData(IDataSession) ### Description Starts a data merge operation using the specified entity type TEntity. The target table and columns are automatically mapped from the entity type. ### Parameters - **session** (IDataSession) - Required - The IDataSession to use for the merge operation. ### Returns - **IDataMerge** - An IDataMerge instance for configuring and executing the merge operation. ``` -------------------------------- ### FluentCommand Namespace Overview Source: https://loresoft.com/FluentCommand/reference/FluentCommand.html This section outlines the main components within the FluentCommand namespace, including classes, structs, and interfaces. ```APIDOC ## Namespace FluentCommand ### Classes - **ConcurrencyTokenJsonConverter**: Json Converter for ConcurrencyToken. - **DataCommand**: A fluent class to build a data command. - **DataCommandExtensions**: Extension methods for IDataCommand. - **DataConfiguration**: The database configuration. - **DataConfigurationBuilder**: A configuration builder class. - **DataConfigurationBuilderExtensions**: Extension methods for configuring DataConfigurationBuilder to use SQL Server. - **DataConfiguration**: The database configuration by discriminator. Used to register multiple instances of IDataConfiguration. - **DataFieldConverterAttribute**: Attribute to enable source generation of data reader factory. - **DataFieldConverterAttribute**: Attribute to enable source generation of data reader factory. - **DataMapping**: A class for mapping data types. - **DataParameterHandlers**: Provides a registry for associating .NET types with custom data parameter handlers used to set database parameter values and types. - **DataParameter**: A fluent class to build a data parameter. - **DataQueryExtensions**: Extension methods for IDataQuery. - **DataQueryFormatter**: A class to format an IDbCommand for logging. - **DataQueryLogger**: A class for logging queries. - **DataReaderExtensions**: Extension methods for IDataReader. - **DataSession**: A fluent class for a data session. - **DataSession**: A fluent class for a data session by discriminator. Used to register multiple instances of IDataSession. - **DisposableBase**: Provides a base implementation of the IDisposable pattern, including support for asynchronous disposal on supported platforms. - **ImportServiceCollectionExtensions**: Provides extension methods for registering FluentCommand import services with an IServiceCollection. - **JsonCommandExtensions**: Extension methods for IDataCommand. - **ListDataReader**: Read a list of items using a DbDataReader. - **QueryBuilderExtensions**: Provides extension methods for building SQL queries using a QueryBuilder within a data session. - **ServiceCollectionExtensions**: Extension methods for IServiceCollection. - **SqlCommandExtensions**: Extension methods for IDataCommand specific to SQL Server. - **SqlDataRecordAdapter**: Adapts an IEnumerable to an IEnumerable for use as a SQL Server table-valued parameter. Reuses a single SqlDataRecord per row for minimal allocation. Caches SqlMetaData per type for efficiency. - **SqlTypeMapping**: Provides mapping between .NET types and their corresponding SQL Server native types. ### Structs - **ConcurrencyToken**: A structure to hold concurrency token. ### Interfaces - **IDataCache**: An interface for data cache. - **IDataCommand**: An interface defining a data command. - **IDataCommandInterceptor**: An interface for intercepting database command execution events. - **IDataConfiguration**: An interface for database configuration. - **IDataConfiguration**: The database configuration by discriminator. Used to register multiple instances of IDataConfiguration. - **IDataConnectionInterceptor**: An interface for intercepting database connection lifecycle events. - **IDataFieldConverter**: Interface defining how to read a field value. - **IDataInterceptor**: A marker interface for FluentCommand interceptors. - **IDataParameterHandler**: An interface defining parameter type handling. - **IDataParameter**: An interface for data parameter. - **IDataQuery**: An interface defining a data query operations. - **IDataQueryAsync**: An interface defining a data query operations asynchronously. - **IDataQueryFormatter**: A interface for formatting an IDbCommand for logging. - **IDataQueryLogger**: An interface for logging queries. - **IDataSession**: An interface for data sessions. - **IDataSessionFactory**: An interface for creating IDataSession instances. - **IDataSessionFactory**: The data session factory by discriminator. Used to register multiple instances of IDataSessionFactory. - **IDataSession**: A fluent interface for a data session by discriminator. Used to register multiple instances of IDataSession. ``` -------------------------------- ### ImportProcessor Constructor Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Import.ImportProcessor.html Initializes a new instance of the ImportProcessor class with specified IDataSession and IServiceScopeFactory. ```csharp public ImportProcessor(IDataSession dataSession, IServiceScopeFactory serviceScopeFactory)__ ``` -------------------------------- ### BulkCopy(IDataSession) Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Bulk.DataBulkCopyExtensions.html Starts a bulk copy operation for a specific entity type. ```APIDOC ## BulkCopy(IDataSession) ### Description Starts a bulk copy operation using the specified data session, inferring the destination table name from the entity type. ### Method POST ### Endpoint /api/bulkcopy/{entityType} ### Parameters #### Path Parameters - **entityType** (string) - Required - The name of the entity type to be copied. #### Query Parameters None #### Request Body - **session** (IDataSession) - Required - The IDataSession to use for the bulk copy operation. ### Request Example ```json { "session": "" } ``` ### Response #### Success Response (200) - **IDataBulkCopy** (IDataBulkCopy) - An IDataBulkCopy instance for configuring and executing the bulk copy operation. #### Response Example ```json { "dataBulkCopyInstance": "" } ``` ``` -------------------------------- ### WhereExpressions Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.WhereBuilder-1.html Gets the collection of WHERE expressions for the query. This property is protected and stores expressions in a HashSet. ```csharp protected HashSet WhereExpressions { get; } ``` -------------------------------- ### POST /api/users Source: https://loresoft.com/FluentCommand/reference/FluentCommand.QueryBuilderExtensions.html Configures and sets the SQL command for the specified IDataSession using a fluent QueryBuilder. ```APIDOC ## Sql(IDataSession, Action) ### Description Configures and sets the SQL command for the specified IDataSession using a fluent QueryBuilder. ### Method POST ### Endpoint /api/users ### Parameters #### Path Parameters - **dataSession** (IDataSession) - Required - The data session used to execute the query. - **builder** (Action) - Required - An action that configures the QueryBuilder to build the desired SQL statement and parameters. ### Request Example { "example": "request body" } ### Response #### Success Response (200) - **IDataCommand** (IDataCommand) - An IDataCommand representing the configured SQL command, ready for execution or further configuration. #### Response Example { "example": "response body" } ``` -------------------------------- ### InsertBuilder ValueExpressions Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.InsertBuilder-1.html Gets the collection of value expressions (parameter names) for the INSERT statement. ```csharp protected HashSet ValueExpressions { get; } ``` -------------------------------- ### Bulk Copy Configuration Methods Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Bulk.IDataBulkCopy.html Methods for configuring the behavior of bulk copy operations. ```APIDOC ## NotifyAfter(int) ### Description Sets the number of rows to be processed before generating a notification event. ### Method IDataBulkCopy ### Endpoint NotifyAfter(int value) ### Parameters #### Path Parameters - **value** (int) - Required - The number of rows to process before notification. A value of zero disables notification. ### Response #### Success Response (200) - **IDataBulkCopy** - The same IDataBulkCopy instance for fluent chaining. ## TableLock(bool) ### Description Obtains a bulk update lock for the duration of the bulk copy operation. When not specified, row locks are used. ### Method IDataBulkCopy ### Endpoint TableLock(bool value = true) ### Parameters #### Path Parameters - **value** (bool) - Optional - `true` to obtain a bulk update lock; otherwise, `false`. The default is `true`. ### Response #### Success Response (200) - **IDataBulkCopy** - The same IDataBulkCopy instance for fluent chaining. ## UseInternalTransaction(bool) ### Description Specifies that each batch of the bulk-copy operation will occur within a transaction. ### Method IDataBulkCopy ### Endpoint UseInternalTransaction(bool value = true) ### Parameters #### Path Parameters - **value** (bool) - Optional - `true` to use an internal transaction for each batch; otherwise, `false`. The default is `true`. ### Response #### Success Response (200) - **IDataBulkCopy** - The same IDataBulkCopy instance for fluent chaining. ``` -------------------------------- ### WhereExpression ParameterName Property Source: https://loresoft.com/FluentCommand/reference/FluentCommand.Query.Generators.WhereExpression.html Gets or initializes the parameter name for the value to compare against the column. This is optional. ```csharp public string? ParameterName { get; init; } ```