We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents dabf2cb + 0a6c64b commit 2ef6c06Copy full SHA for 2ef6c06
3 files changed
src/SqlClient.DesignTime/SqlClientExtensions.fs
@@ -106,12 +106,12 @@ let internal providerTypes =
106
"time", (SqlDbType.Time, "System.TimeSpan", true)
107
108
// character strings
109
- "char", (SqlDbType.Char, "System.String", true)
+ "char", (SqlDbType.Char, "System.String", false)
110
"text", (SqlDbType.Text, "System.String", false)
111
"varchar", (SqlDbType.VarChar, "System.String", false)
112
113
// unicode character strings
114
- "nchar", (SqlDbType.NChar, "System.String", true)
+ "nchar", (SqlDbType.NChar, "System.String", false)
115
"ntext", (SqlDbType.NText, "System.String", false)
116
"nvarchar", (SqlDbType.NVarChar, "System.String", false)
117
"sysname", (SqlDbType.NVarChar, "System.String", false)
tests/SqlClient.Tests/TVPTests.fs
@@ -165,3 +165,23 @@ let UsingMappedTVPInQuery() =
165
|> Seq.toList
166
167
Assert.Equal<_ list>(expected, actual)
168
+
169
+type MappedTVPFixed =
170
+ SqlCommandProvider<"
171
+ SELECT myId, myName from @input
172
+ ", ConnectionStrings.AdventureWorksLiteral, TableVarMapping = "@input=dbo.MyTableTypeFixed">
173
+[<Fact>]
174
+let UsingMappedTVPFixedInQuery() =
175
+ printfn "%s" ConnectionStrings.AdventureWorksLiteral
176
+ use cmd = new MappedTVPFixed(ConnectionStrings.AdventureWorksLiteral)
177
+ let expected = [
178
+ 1, Some "monkey"
179
+ 2, Some "donkey"
180
+ ]
181
182
+ let actual =
183
+ cmd.Execute(input = [ for id, name in expected -> MappedTVPFixed.MyTableTypeFixed(id, name) ])
184
+ |> Seq.map(fun x -> x.myId, x.myName |> Option.map (fun s -> s.Trim()))
185
+ |> Seq.toList
186
187
+ Assert.Equal<_ list>(expected, actual)
tests/SqlClient.Tests/extensions.sql
@@ -90,6 +90,9 @@ GO
90
IF TYPE_ID(N'Person.MyTableType') IS NOT NULL
91
DROP TYPE Person.MyTableType
92
GO
93
+IF TYPE_ID(N'dbo.MyTableTypeFixed') IS NOT NULL
94
+ DROP TYPE dbo.MyTableTypeFixed
95
+GO
96
IF TYPE_ID(N'dbo.u_int64') IS NOT NULL
97
DROP TYPE dbo.u_int64
98
@@ -112,6 +115,9 @@ GO
CREATE TYPE Person.MyTableType AS TABLE (myId int not null, myName nvarchar(30) null)
118
+CREATE TYPE dbo.MyTableTypeFixed AS TABLE (myId int not null, myName nchar(30) null)
119
120
121
CREATE TYPE dbo.SingleElementType AS TABLE (myId int not null)
122
123
0 commit comments