94 lines
2.6 KiB
C#
94 lines
2.6 KiB
C#
using System;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using SDA.DataProvider.Core;
|
|
|
|
namespace SDA.DataProvider
|
|
{
|
|
/// <summary>
|
|
/// Egy konkrét táblára vonatkozó <c>DML</c> utasításokat generál.
|
|
/// </summary>
|
|
public class SDACommandBuilder : IDisposable
|
|
{
|
|
internal SDACommandBuilderWrapper CommandBuilder;
|
|
|
|
/// <summary>
|
|
/// Az osztály alapértelmezett konstruktora.
|
|
/// </summary>
|
|
public SDACommandBuilder()
|
|
{
|
|
CommandBuilder = SDAFactory.Instance.CreateCommandBuilder();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Az osztály konstruktora.
|
|
/// </summary>
|
|
/// <param name="dataAdapter"></param>
|
|
public SDACommandBuilder(SDADataAdapter dataAdapter)
|
|
{
|
|
if (dataAdapter == null)
|
|
{
|
|
throw new ArgumentNullException(nameof(dataAdapter));
|
|
}
|
|
|
|
CommandBuilder = SDAFactory.Instance.CreateCommandBuilder(dataAdapter.DataAdapter);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Paraméterek kötése.
|
|
/// </summary>
|
|
public void DeriveParameters(SDACommand command)
|
|
{
|
|
if (command == null)
|
|
{
|
|
throw new ArgumentNullException(nameof(command));
|
|
}
|
|
|
|
CommandBuilder.DeriveParameters(command.Command);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Visszaadja a törlő parancs objektumot.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
|
|
public SDACommand GetDeleteCommand()
|
|
{
|
|
return new SDACommand(CommandBuilder.GetDeleteCommand());
|
|
}
|
|
|
|
/// <summary>
|
|
/// Beszúrás parancs.
|
|
/// </summary>
|
|
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
|
|
public SDACommand GetInsertCommand()
|
|
{
|
|
return new SDACommand(CommandBuilder.GetInsertCommand());
|
|
}
|
|
|
|
/// <summary>
|
|
/// Módosítás parancs.
|
|
/// </summary>
|
|
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
|
|
public SDACommand GetUpdateCommand()
|
|
{
|
|
return new SDACommand(CommandBuilder.GetUpdateCommand());
|
|
}
|
|
|
|
/// <summary>
|
|
/// Séma frissítése.
|
|
/// </summary>
|
|
public void RefreshSchema()
|
|
{
|
|
CommandBuilder.RefreshSchema();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Eldobja az objektumot.
|
|
/// </summary>
|
|
public void Dispose()
|
|
{
|
|
CommandBuilder.Dispose();
|
|
CommandBuilder = null;
|
|
}
|
|
}
|
|
}
|