2using System.Collections.Generic;
4using System.Data.SqlClient;
5using System.Threading.Tasks;
17 private readonly Dictionary<string, MsSqlStoredProcedure> procedures =
new Dictionary<string, MsSqlStoredProcedure>();
19 private SqlConnection connection;
28 this.connection = Connection;
36 this.connection?.Close();
37 this.connection?.Dispose();
38 this.connection =
null;
48 using (SqlCommand Command = this.connection.CreateCommand())
50 Command.CommandType = CommandType.Text;
51 Command.CommandText = Statement;
52 SqlDataReader Reader = await Command.ExecuteReaderAsync();
54 return await Reader.ParseAndClose();
64 public override Task<IElement>
GetSchema(
string Name)
66 DataTable Table = this.connection.GetSchema(Name);
67 return Task.FromResult<
IElement>(Table.ToMatrix());
75 public override async Task<ILambdaExpression>
GetProcedure(
string Name)
77 await this.synchObject.BeginWrite();
83 SqlCommand Command = this.connection.CreateCommand();
84 Command.CommandType = CommandType.StoredProcedure;
85 Command.CommandText = this.connection.Database +
"." + Name;
87 SqlCommandBuilder.DeriveParameters(Command);
90 this.procedures[Name] = Result;
96 await this.synchObject.EndWrite();
Represents an object that allows single concurrent writers but multiple concurrent readers....
Abstract base class for external databases
Manages a Microsoft SQL Server connection
override async Task< ILambdaExpression > GetProcedure(string Name)
Creates a lambda expression for accessing a stored procedure.
override Task< IElement > GetSchema(string Name)
Gets a Schema table, given its collection name. For a list of collections: https://mysqlconnector....
MsSqlDatabase(SqlConnection Connection)
Manages a Microsoft SQL Server connection
override async Task< IElement > ExecuteSqlStatement(string Statement)
Executes an SQL Statement on the database.
override void Dispose()
IDisposable.Dispose
Represents a stored precedure in a MS SQL Database.
Basic interface for all types of elements.