Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Schema not refreshed upon alteration of connected database. #12

Closed
mitchellsullivan opened this issue Jul 11, 2016 · 11 comments

Comments

@mitchellsullivan
Copy link

This is a re-post of an issue from the main VisualFSharp GitHub site upon recommendation from @dsyme. Original here: dotnet/fsharp#1301

Description

If the schema of a database to which there is a connection via type providers SqlDataConnection or SqlEntityConnection is altered, the changes are not accessible within Visual Studio and are not represented by IntelliSense.

However, changing the connection string in some "insignificant" way, such as adding white space, will force the refresh of the schema. Restarting Visual Studio will also refresh the schema.

This is okay when working with an established, production database, but when developing a database and making frequent changes to it, this becomes very annoying.

Repro steps

Connect to a database via an SQL type provider. Add and/or drop tables from database (other changes not tested). Try to refer to the new tables within code.

Expected behavior

That changes to database schema be immediately reflected in IntelliSense and usable in code.

Actual behavior

Old schema still present in IntelliSense, e.g., no newly added tables are accessible, and dropped tables are still listed. Even turning off "Statement Completion" doesn't help. Reference to a new table shows as an error.

There is no background process to detect changes to database structure and update the schema upon which F# is operating.

Known workarounds

Add white space to connection string which doesn't affect the functionality. Example:

"Data Source=(localdb)\ProjectsV13;Initial Catalog=db" can be changed to "Data Source =(localdb)\ProjectsV13; Initial Catalog = db" (spacing placed around equals and semicolon)

Related information

All versions of F# and Visual Studio to-date.

Feature Request

Response from @dsyme: "Presumably that would work by a regular background task polling the database to look for schema changes."

I have no way of knowing if this is feasible, but it would be WONDERFUL if it were fixed. I assume that the issue revolves around the IDE.

@cmeeren
Copy link

cmeeren commented Oct 14, 2017

Will this ever get fixed? It's been like this since at least 2011 according to an SO question I saw.

@mrunks
Copy link

mrunks commented Feb 17, 2018

I do not remember this problem when recompiling in Visual Studio 2015. Are you also referring to recompiling ? In visual studio 2017 when I recompile I do not see any changes reflected.

@tumypv
Copy link

tumypv commented Apr 7, 2018

Unload/Reload project seems to help in VS 2017

@brunodefrancavalli
Copy link

brunodefrancavalli commented Oct 4, 2019

Problem seem to still exist in VS 2019, is there a way to force an update?
Unloading and Reloading project did not seem to work.

@brikken
Copy link

brikken commented Dec 12, 2019

Unload and reload appears to work in VS 2019 16.4.0

About the issue, I understand that it's probably difficult to receive push messages from the database about schema changes. However, the schema should at least be reloaded on (re)build, which is not the current behaviour.

@dsyme
Copy link
Contributor

dsyme commented Nov 20, 2021

Note this is a very old collection of type providers that are Windows-specific and .NET Framework-specific. For up-to-date type providers see https://fsharp.org/guides/data-access/

For WSDL see https://github.com/fsprojects/FSharp.Data.WsdlProvider for a more recent provider, also https://github.com/fsprojects/SwaggerProvider

@dsyme dsyme closed this as completed Nov 20, 2021
@cmeeren
Copy link

cmeeren commented Nov 20, 2021

@dsyme Where's the source for https://fsharp.org/guides/data-access? Could Facil be added to it?

@dsyme
Copy link
Contributor

dsyme commented Nov 20, 2021

@cmeeren Click "edit this page" at the bottom of the page :)

Could Facil be added to it?

Absolutely

@dsyme
Copy link
Contributor

dsyme commented Nov 20, 2021

Would you like to move "Facil" to fsprojects? Open invitation. Policies are here: https://github.com/fsprojects/fsprojects-admin

@cmeeren
Copy link

cmeeren commented Nov 20, 2021

Thanks for the offer, but it's not a good fit for fsprojects the way I understand the policies. For one thing, it's been at 1.x and fairly stable for a good while now, so it's not really incubating. I therefore respectfully decline the invitation to move it to fsprojects.

@cmeeren

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants