### Pack and Push AdoNetCore.AseClient Package Source: https://github.com/dataaction/adonetcore.aseclient/wiki/Publishing-to-NuGet This snippet shows how to pack the AdoNetCore.AseClient project and push the resulting NuGet package to the official NuGet repository. Replace x.y.z with the actual version number and with your NuGet API key. ```bash cd src\AdoNetCore.AseClient dotnet pack -c Release dotnet nuget push bin\Release\AdoNetCore.AseClient.x.y.z.nupkg -s https://api.nuget.org/v3/index.json -k ``` -------------------------------- ### Pack and Push AdoNetCore.AseClient.StrongName Package Source: https://github.com/dataaction/adonetcore.aseclient/wiki/Publishing-to-NuGet This snippet demonstrates how to pack the strong-named version of the AdoNetCore.AseClient project and push it to NuGet. Ensure you replace x.y.z with the correct version and with your NuGet API key. ```bash cd src\AdoNetCore.AseClient.StrongName dotnet pack -c Release dotnet nuget push bin\Release\AdoNetCore.AseClient.StrongName.x.y.z.nupkg -s https://api.nuget.org/v3/index.json -k ``` -------------------------------- ### Use Input, Output, and Return Parameters with Stored Procedure Source: https://github.com/dataaction/adonetcore.aseclient/blob/master/Examples.md Demonstrates how to execute a stored procedure that utilizes input, output, and return parameters. Ensure the connection string is correctly configured for your ASE server. ```C# var connectionString = "Data Source=myASEserver;Port=5000;Database=myDataBase;Uid=myUsername;Pwd=myPassword;"; using (var connection = new AseConnection(connectionString)) { connection.Open(); using (var command = connection.CreateCommand()) { command.CommandText = "GetCustomerFirstName"; command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@lastName", "Rubble"); var outputParameter = command.Parameters.Add("@firstName", AseDbType.VarChar); outputParameter.Direction = ParameterDirection.Output; var returnParameter = command.Parameters.Add("@returnValue", AseDbType.Integer); returnParameter.Direction = ParameterDirection.ReturnValue; command.ExecuteNonQuery(); //Do something with outputParameter.Value and returnParameter.Value... } } ``` -------------------------------- ### Create and Configure Test Database Source: https://github.com/dataaction/adonetcore.aseclient/wiki/Test-environment-setup This script creates a new test database named 'your_test_db', sets its size, and configures several server options including user connections, unicode normalization, and heap memory. Ensure the server character encoding is set to 'utf8' for some tests. ```sql use master if exists (select 1 from master..sysdatabases where name = 'your_test_db') begin drop database your_test_db end create database your_test_db on default = '512M' go use your_test_db exec sp_configure 'number of user connections', 100 exec sp_configure 'enable unicode normalization', 0 exec sp_configure 'heap memory per user', 65535 go ``` -------------------------------- ### Running Benchmark Executables Source: https://github.com/dataaction/adonetcore.aseclient/wiki/Running-the-benchmarks Execute benchmark executables for different .NET runtimes and configurations. Ensure you have configured the connection details in Benchmarks.cs before running. ```bash cd [repo]\AdoNetCore.AseClient\test\AdoNetCore.AseClient.Benchmark\bin\Release dotnet netcoreapp1.1\AdoNetCore.AseClient.Benchmark.dll corefx dotnet netcoreapp2.0\AdoNetCore.AseClient.Benchmark.dll corefx net4.6\AdoNetCore.AseClient.Benchmark.exe corefx net4.6\AdoNetCore.AseClient.Benchmark.exe sap ``` -------------------------------- ### ASE Server Connection Details Configuration Source: https://github.com/dataaction/adonetcore.aseclient/wiki/Running-the-integration-tests Define connection parameters for your ASE server in this JSON file. Ensure the user has sufficient permissions for database operations. ```json { "Server": "a", "Port": "b", "Database": "c", "User": "d", "Pass": "e" } ``` -------------------------------- ### Open ASE Database Connection Source: https://github.com/dataaction/adonetcore.aseclient/blob/master/Examples.md Establishes a connection to an ASE database using a provided connection string. Ensure the connection string contains valid server, port, database, username, and password details. ```C# var connectionString = "Data Source=myASEserver;Port=5000;Database=myDataBase;Uid=myUsername;Pwd=myPassword;"; using(var connection = new AseConnection(connectionString)) { connection.Open(); // use the connection... } ``` -------------------------------- ### Running Integration Tests via CLI Source: https://github.com/dataaction/adonetcore.aseclient/wiki/Running-the-integration-tests Execute integration tests using the dotnet CLI. The `--filter` flag allows selective test execution based on categories. ```bash dotnet test --no-build --no-restore --verbosity quiet --filter "TestCategory=quick | TestCategory=basic | TestCategory=extra" ``` -------------------------------- ### Execute Stored Procedure and Read Response Data with Dapper Source: https://github.com/dataaction/adonetcore.aseclient/blob/master/Examples.md Shows how to execute a stored procedure and map the results to a strongly-typed object using the Dapper micro-ORM. This is useful for simplifying data retrieval from stored procedures. ```C# var connectionString = "Data Source=myASEserver;Port=5000;Database=myDataBase;Uid=myUsername;Pwd=myPassword;"; using (var connection = new AseConnection(connectionString)) { connection.Open(); var barneyRubble = connection.Query("GetCustomer", new {lastName = "Rubble"}, commandType: CommandType.StoredProcedure).First(); // Do something with the result... } ``` -------------------------------- ### Extend EncodingProvider for Custom Charset Source: https://github.com/dataaction/adonetcore.aseclient/wiki/Add-custom-charset-support Implement a custom EncodingProvider to map a specific charset name (e.g., 'cp850') to an existing Encoding. This is useful when ASE uses charsets not natively supported by .NET Core. ```csharp public class MyEncodingProvider : EncodingProvider { public override Encoding GetEncoding(int codepage) { return null; // we're only matching on name, not codepage } public override Encoding GetEncoding(string name) { if(string.Equals("cp850", name, StringComparison.OrdinalIgnoreCase)) { return Encoding.GetEncoding(850); // this will load an encoding from the CodePagesEncodingProvider } return null; } } ``` -------------------------------- ### Register Encoding Providers Source: https://github.com/dataaction/adonetcore.aseclient/wiki/Add-custom-charset-support Register both the CodePagesEncodingProvider and your custom EncodingProvider instance with the .NET runtime. This makes your custom charset support available to the driver. ```csharp Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); Encoding.RegisterProvider(new MyEncodingProvider()); ``` -------------------------------- ### Use Input Parameters with SQL Query Source: https://github.com/dataaction/adonetcore.aseclient/blob/master/Examples.md Executes a SQL query that uses input parameters. Parameters help prevent SQL injection and improve query performance. Note that ASE has specific limitations on parameter types for non-stored procedures. ```C# var connectionString = "Data Source=myASEserver;Port=5000;Database=myDataBase;Uid=myUsername;Pwd=myPassword;"; using (var connection = new AseConnection(connectionString) { connection.Open(); using (var command = connection.CreateCommand()) { command.CommandText = "SELECT TOP 1 FirstName FROM Customer WHERE LastName = @lastName"; command.Parameters.AddWithValue("@lastName", "Rubble"); var result = command.ExecuteScalar(); } } ``` -------------------------------- ### Execute SQL and Read Response Data Source: https://github.com/dataaction/adonetcore.aseclient/blob/master/Examples.md Executes a SQL SELECT statement and iterates through the returned rows using a data reader. This is suitable for retrieving multiple records. ```C# var connectionString = "Data Source=myASEserver;Port=5000;Database=myDataBase;Uid=myUsername;Pwd=myPassword;"; using (var connection = new AseConnection(connectionString)) { connection.Open(); using (var command = connection.CreateCommand()) { command.CommandText = "SELECT FirstName, LastName FROM Customer"; using (var reader = command.ExecuteReader()) { // Get the results. while (reader.Read()) { var firstName = reader.GetString(0); var lastName = reader.GetString(1); // Do something with the data... } } } } ``` -------------------------------- ### Execute SQL Statement Returning No Results Source: https://github.com/dataaction/adonetcore.aseclient/blob/master/Examples.md Executes a SQL statement such as INSERT, UPDATE, or DELETE that does not return a result set. The number of records modified is returned. ```C# var connectionString = "Data Source=myASEserver;Port=5000;Database=myDataBase;Uid=myUsername;Pwd=myPassword;"; using (var connection = new AseConnection(connectionString)) { connection.Open(); using (var command = connection.CreateCommand()) { command.CommandText = "INSERT INTO Customer (FirstName, LastName) VALUES ('Fred', 'Flintstone')"; var recordsModified = command.ExecuteNonQuery(); } } ``` -------------------------------- ### Execute Stored Procedure and Read Response Data Source: https://github.com/dataaction/adonetcore.aseclient/blob/master/Examples.md Executes a stored procedure and reads the results using a data reader. This is useful when stored procedures return result sets. ```C# var connectionString = "Data Source=myASEserver;Port=5000;Database=myDataBase;Uid=myUsername;Pwd=myPassword;"; using (var connection = new AseConnection(connectionString) { connection.Open(); using (var command = connection.CreateCommand()) { command.CommandText = "GetCustomer"; command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@lastName", "Rubble"); using (var reader = command.ExecuteReader()) { // Get the results. while (reader.Read()) { var firstName = reader.GetString(0); var lastName = reader.GetString(1); // Do something with the data... } } } } ``` -------------------------------- ### Execute Stored Procedure Returning No Results Source: https://github.com/dataaction/adonetcore.aseclient/blob/master/Examples.md Executes a stored procedure that does not return a result set, such as one that performs an INSERT or UPDATE operation. Use ExecuteNonQuery for this. ```C# var connectionString = "Data Source=myASEserver;Port=5000;Database=myDataBase;Uid=myUsername;Pwd=myPassword;"; using (var connection = new AseConnection(connectionString)) { connection.Open(); using (var command = connection.CreateCommand()) { command.CommandText = "CreateCustomer"; command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@firstName", "Fred"); command.Parameters.AddWithValue("@lastName", "Flintstone"); command.ExecuteNonQuery(); } } ``` -------------------------------- ### Execute SQL Statement Returning Scalar Value Source: https://github.com/dataaction/adonetcore.aseclient/blob/master/Examples.md Executes a SQL statement that returns a single value, such as a count or an aggregate. Use ExecuteScalar for this purpose. ```C# var connectionString = "Data Source=myASEserver;Port=5000;Database=myDataBase;Uid=myUsername;Pwd=myPassword;"; using (var connection = new AseConnection(connectionString)) { connection.Open(); using (var command = connection.CreateCommand()) { command.CommandText = "SELECT COUNT(*) FROM Customer"; var result = command.ExecuteScalar(); } } ``` -------------------------------- ### Execute Stored Procedure Returning Scalar Value Source: https://github.com/dataaction/adonetcore.aseclient/blob/master/Examples.md Executes a stored procedure that returns a single scalar value. Use ExecuteScalar for this purpose. ```C# var connectionString = "Data Source=myASEserver;Port=5000;Database=myDataBase;Uid=myUsername;Pwd=myPassword;"; using (var connection = new AseConnection(connectionString)) { connection.Open(); using (var command = connection.CreateCommand()) { command.CommandText = "CountCustomer"; command.CommandType = CommandType.StoredProcedure; var result = command.ExecuteScalar(); } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.