fsprojects / SQLProvider

A general F# SQL database erasing type provider, supporting LINQ queries, schema exploration, individuals, CRUD operations and much more besides.
https://fsprojects.github.io/SQLProvider
Other
572 stars 146 forks source link

Create row fails because of evil weirdo column name #583

Closed tobhofmann closed 2 years ago

tobhofmann commented 5 years ago

Description

Hello,

if you have a mssql table with evil weirdo column names creating a table row fails (my company likes to use "_$" notation for computed fields)

Repro steps

1.

CREATE TABLE [dbo].[sometable](
    [id] [int] IDENTITY(1,1) NOT NULL,
    [somecolumn] [int] NULL,
    [somecolumn_$] [int] NULL)

2.

[<Literal>]
let LocalConnStr = "Server=.\\SQLEXPRESS; initial catalog=somedb;Integrated Security=true"
type HR = SqlDataProvider<ConnectionString = LocalConnStr, DatabaseVendor = Common.DatabaseProviderTypes.MSSQLSERVER, UseOptionTypes = true>
let ctx = HR.GetDataContext LocalConnStr
let row = ctx.Dbo.Sometable.Create()

Expected behavior

A new row :-)

Actual behavior

The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: GetMethodImpl. not support overloads, name = 'get_Somecolumn', methods - '[|Method get_Somecolumn; Method get_Somecolumn|]', callstack = '"

Known workarounds

Create an SP for this insert?

Related information