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

Microsoft.Data.SqlClient with SSDT? #751

Open
2 of 6 tasks
NickDarvey opened this issue Oct 22, 2021 · 5 comments
Open
2 of 6 tasks

Microsoft.Data.SqlClient with SSDT? #751

NickDarvey opened this issue Oct 22, 2021 · 5 comments

Comments

@NickDarvey
Copy link

Description

I'm wanting to use Microsoft.Data.SqlClient with the SSDT Provider. The documentation say I need to use MSSQLSERVER_DYNAMIC, but is it possible with MSSQLSERVER_SSDT?

I've read the instructions in #645 and included the appropriate assemblies in a folder and set it as the resolutionPath. However, it fails trying to load System.Data.SqlClient.

Repro steps

[<Literal>]
let private Schema = __SOURCE_DIRECTORY__ + @"/../DatabaseProject/bin/Debug/DatabaseProject.dacpac"

type Schema = 
  SqlDataProvider<
    Common.DatabaseProviderTypes.MSSQLSERVER_SSDT, 
    SsdtPath = Schema,
    UseOptionTypes = true
  >

let create (connectionString: string) =
  Schema.GetDataContext(connectionString, resolutionPath = @"C:\testing\runtimes")

Expected behaviour

Please provide a description of the behaviour you expect.

Actual behaviour

System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Data.SqlClient, Version=4.6.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.'

Known workarounds

None.

Related information

  • Operating system
    • windows [19043.1288]
    • macOs [insert version]
    • linux [insert flavor/version here]
  • Platform
    • dotnet core [5.0.104]
    • dotnet full
    • mono
  • Branch or release version [1.2.10]
@ratsclub
Copy link

I'm currently facing the exact same issue. @NickDarvey did you find a solution for this?

@JordanMarr
Copy link
Contributor

JordanMarr commented Dec 13, 2022

The MSSQLSERVER_SSDT provider is hardwired to use System.Data.SqlClient. I'm pretty sure the resolutionPath is designed to work in conjunction with the MSSQLSERVER_DYNAMIC provider only.

AFAIK, the only way to use Microsoft.Data.SqlClient with MSSQLSERVER_SSDT would be to change the provider (or create a new one).

@NickDarvey
Copy link
Author

@NickDarvey did you find a solution for this?

I didn't, sorry @ratsclub

@Thorium
Copy link
Member

Thorium commented Dec 14, 2022

@JordanMarr I would rather create a new one than change MSSQLSERVER_SSDT or has some kind of parameter to combine these... Microsoft.Data.SqlClient brings a huge dependency network #724 (comment), and if you look inside of it, mostly what it does is forwarding types to the old System.Data.SqlClient.

@Thorium
Copy link
Member

Thorium commented Dec 20, 2022

The version 1.3.5 is now using Microsoft.Data.SqlClient on .Net6.0 and .NetStandard 2.1,
and the old System.Data.SqlClient on .Net 4.7.2 and .NetStandard 2.0.
This is initial trial via simple conditional compilation (because the base classes are the same) so please let me know if it works or not.

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

4 participants