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
564 stars 144 forks source link

Name Collision #685

Open davidtme opened 4 years ago

davidtme commented 4 years ago

I’m trying to use the sql provider with our production ms sql database schema however I’ve found a problem which I can’t seem to work around. One of our table is badly constructed meaning with have ended up with the following:

CREATE TABLE [Account](
    [Id] [int] IDENTITY(1,1),
    [Billing_Address] [varchar](max) NULL,
    [BillingAddress] [varchar](max) NULL,
)

When the provider runs it is cleaning the underscore out of the the first Billing_Address and the provided throws an error:

The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: GetMethodImpl. not support overloads, name = 'get_BillingAddress', methods - '[|Method get_BillingAddress; Method get_BillingAddress|]', callstack = '" at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)

Sadly, I can’t change the production database so are there any options to disable the name clean up?

Thorium commented 4 years ago

There is a metrhod avoidNameClashBy which should add ' to another of the column names to avoid collision. Obviously for some reason it's not working in your case.

Edit: It seems that method is used only in stored procedures.

Thorium commented 4 years ago

As a workaround, can you create a view where is only one of those columns?

davidtme commented 4 years ago

@Thorium Thank you so much for the fast response. I wish I could change the database as it’s such a mess but sadly it’s beyond the scope of the project I’m working so I can’t.