SqlParameterFactory<TParameter> Class
Abstract base class for SQL parameter factories that handles parameter-name prefixing.
public abstract class SqlParameterFactory<TParameter> : HAKOM.Persistence.Sql.Net.Api.ISqlParameterFactory<TParameter> where TParameter : HAKOM.Persistence.Sql.Net.Api.ISqlParameterType parameters
Section titled “Type parameters”TParameter
The SQL parameter type this factory produces.
Inheritance System.Object 🡒 SqlParameterFactory<TParameter>
Implements HAKOM.Persistence.Sql.Net.Api.ISqlParameterFactory<TParameter>
Remarks
Section titled “Remarks”Derived classes override Create<TValue>(string, TValue) to construct the provider-specific
parameter type. The ParameterPrefix defaults to @ and can be
overridden (e.g. Oracle uses :).
Properties
Section titled “Properties”SqlParameterFactory<TParameter>.ParameterPrefix Property
Section titled “SqlParameterFactory<TParameter>.ParameterPrefix Property”Gets the prefix character(s) prepended to parameter names (e.g. @ for
SQL Server/PostgreSQL or : for Oracle).
public virtual string ParameterPrefix { get; }Implements ParameterPrefix
Property Value
Section titled “Property Value”Methods
Section titled “Methods”SqlParameterFactory<TParameter>.AddPrefixToName(string) Method
Section titled “SqlParameterFactory<TParameter>.AddPrefixToName(string) Method”Ensures the parameter name starts with the ParameterPrefix. If it already does, the name is returned unchanged.
protected string AddPrefixToName(string name);Parameters
Section titled “Parameters”name System.String
The parameter name to prefix.
Returns
Section titled “Returns”System.String
The prefixed parameter name.
Exceptions
Section titled “Exceptions”System.ArgumentException
Thrown when name is null or whitespace.
SqlParameterFactory<TParameter>.Create<TValue>(string, TValue) Method
Section titled “SqlParameterFactory<TParameter>.Create<TValue>(string, TValue) Method”Creates a new SQL parameter with the given name and value.
public abstract TParameter Create<TValue>(string name, TValue value);Type parameters
Section titled “Type parameters”TValue
The CLR type of the parameter value.
Parameters
Section titled “Parameters”name System.String
The parameter name, with or without the provider-specific prefix.
value TValue
The value to bind to the parameter.
Implements Create<TValue>(string, TValue)
Returns
Section titled “Returns”TParameter
A new TParameter instance ready to be added to a command.