internal static void Set(IDbDataParameter parameter, DataTable table, string typeName) { parameter.Value = SqlMapper.SanitizeParameterValue(table); if (string.IsNullOrEmpty(typeName) && table != null) { typeName = SqlMapper.GetTypeName(table); } if (!string.IsNullOrEmpty(typeName)) { var sqlParam = parameter as System.Data.SqlClient.SqlParameter; if (sqlParam != null) { if (setTypeName != null) { setTypeName(sqlParam, typeName); } sqlParam.SqlDbType = SqlDbType.Structured; } } }