Search code examples
f#type-providers

Is F# Type Provider SQL loading all the Database in VS?


I am using FSharp.Data.Sql to access via the Type Provider to a MSSQL database. No problem with using it, however, I have the feeling that VS is loading all the database when I am typing code which make the visual studio process very heavy (2GB of RAM used compared to a few MB when I am not using it) and very slow.

I thought that

let [<Literal>] connectionString = """Data Source=XXXX;Initial Catalog=XXXX;User ID=XXX;Password=XX;"""

type sql = SqlDataProvider<ConnectionString = connectionString, DatabaseVendor = Common.DatabaseProviderTypes.MSSQLSERVER, IndividualsAmount = 1000, UseOptionTypes = true >

let ctx = sql.GetDataContext()    

Have you ever met the same issue? I did not find much in the official doc.

Thanks !


Solution

  • This is likely due to the following issues:

    https://github.com/Microsoft/visualfsharp/issues/5929

    https://github.com/Microsoft/visualfsharp/issues/5931

    https://github.com/Microsoft/visualfsharp/issues/5933

    Type Providers (both the SDK and the extensibility point in the compiler) were not implemented in a way that works particularly well for a long-running process such as the F# compiler service. It's ironic since they're useful mostly in editing scenarios, but it is what it is. When these are addressed you can expect most memory usage woes to go away.