38 lines
1.0 KiB
C#
38 lines
1.0 KiB
C#
namespace LaaProductionWeb.Data
|
|
{
|
|
using LaaProductionWeb.Data.Interfaces;
|
|
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
|
|
public class ParameterCollection : IParameterCollection
|
|
{
|
|
private readonly SqlParameterCollection parameters;
|
|
|
|
private ParameterCollection(SqlParameterCollection parameters)
|
|
=> this.parameters = parameters;
|
|
|
|
public IParameterCollection Add(string name, object value)
|
|
{
|
|
this.parameters.Add(new SqlParameter(name, value));
|
|
|
|
return this;
|
|
}
|
|
|
|
public IParameterCollection AddFile(string name, byte[] fileContent)
|
|
{
|
|
var sqlParameter = new SqlParameter(name, SqlDbType.VarBinary)
|
|
{
|
|
Value = fileContent
|
|
};
|
|
|
|
this.parameters.Add(sqlParameter);
|
|
|
|
return this;
|
|
}
|
|
|
|
public static implicit operator ParameterCollection(SqlParameterCollection sqlParameterCollection)
|
|
=> new ParameterCollection(sqlParameterCollection);
|
|
}
|
|
}
|