Class TvpMapper
This class adds the ability to map model properties to SQL table-valued parameters.
Inheritance
System.Object
TvpMapper
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: ArgentSea.Sql
Assembly: ArgentSea.Sql.dll
Syntax
public static class TvpMapper
Methods
| Improve this Doc View SourceToTvpRecord<TModel>(TModel, ILogger)
Converts an object instance to a SqlMetaData instance. To convert an object list to an table-value input parameter, use: var prm = lst.ConvertAll(x => MapToTableParameterRecord(x));
Declaration
public static SqlDataRecord ToTvpRecord<TModel>(TModel model, ILogger logger)
where TModel : class, new()
Parameters
Type | Name | Description |
---|---|---|
TModel | model | An object model instance. The property values are provided as table row values. |
Microsoft.Extensions.Logging.ILogger | logger |
Returns
Type | Description |
---|---|
Microsoft.SqlServer.Server.SqlDataRecord | A SqlMetaData object. A list of these can be used as a Sql table-valued parameter. |
Type Parameters
Name | Description |
---|---|
TModel | The type of the model object. The "MapTo" attributes are used to create the Sql metadata and columns. The object property order become the column order. |
ToTvpRecord<TModel>(TModel, IList<String>, ILogger)
Declaration
public static SqlDataRecord ToTvpRecord<TModel>(TModel model, IList<string> columnList, ILogger logger)
where TModel : class, new()
Parameters
Type | Name | Description |
---|---|---|
TModel | model | |
System.Collections.Generic.IList<System.String> | columnList | |
Microsoft.Extensions.Logging.ILogger | logger |
Returns
Type | Description |
---|---|
Microsoft.SqlServer.Server.SqlDataRecord |
Type Parameters
Name | Description |
---|---|
TModel |