Skip to content

Added Microsoft.Data.SqlClient support + ReportViewer 15#273

Merged
PiJoCoder merged 8 commits intomasterfrom
moraja_add_environment_variables
Jan 4, 2024
Merged

Added Microsoft.Data.SqlClient support + ReportViewer 15#273
PiJoCoder merged 8 commits intomasterfrom
moraja_add_environment_variables

Conversation

@moraja
Copy link
Contributor

@moraja moraja commented Dec 18, 2023

Fixes #140 and #273
Moved sql calls to user Microsoft.Data.SqlClient
Added Encryption and Trust Certificate options to login screen
Removed deprecated calls
Added ReportViewer support from Nuget packages.

1. Use Microsoft.Data.SqlClient
2. Added checkbox to trust server certificate
3. Updated credentials manager to trust server certificate
4. Added About label to show ReportViewerVersion
5. added option to use encrypt connections for SqlClient
@PiJoCoder
Copy link
Collaborator

This is awesome work, @moraja! I have started review and will be testing today and this week also.
Could you upgrade to using the latest version of Azure.Identity in this PR to avoid vulnerabilities? See smiliar request in #269

@PiJoCoder
Copy link
Collaborator

@moraja I have several admin things that I'd like to ask you about.

  • This seems to be an old branch from your previous PR that contains commits that we have already included in the previous PR, also the branch name doesn't match the work. I see you have created a new branch moraja_reportviewer_Microsoft_data that you probably intended to use for this; could you switch to using that new branch and transfer all the changes to that branch?
  • Also, could you please associate the each commit message with a Github issue by using the #IssueID syntax. That way we can track which commit resolved what issue and it's easier to see code changes in the future. You will find it very useful yourself in the future as well as it will help others.
  • Could you provide in the PR description section instructions on
    • how to test the PR
    • what to install/configure for the PR (in this case, I assume we need instructions on which version of Nuget ReportViewer Control and Microsoft.Data.SQLCLient to install. You can provide the command or screenshots. These will also come in handy in the future when other developers need to know how to upgrade their packages. Please note that there are 94 forks of this repo and it would behoove us to assist the developers in those forks.

Thank you

@PiJoCoder
Copy link
Collaborator

I like that you have added the encryption logic on the Connect screen - great improvement!
Could we change the default checkboxes so the connection works by default?
Right now with Encrypt checked and Trust Server Certificate unchecked, it would fail on all servers that don't have SSL enabled.

image

Could we either have both unchecked or both checked (preferrable) in which case connecting will work off the bat.

@PiJoCoder
Copy link
Collaborator

Tested functionality and examined DLLs loaded in the process - things work well.
The only downside is that we now have a much larger SQLNexus folder full of binaries, but we knew that we will get this as a result of this work. The up-side is that users won't have to install 2 of the prerequisites any longer - ReportViewer control and the SQLClrTypes.
Great work.

@moraja
Copy link
Contributor Author

moraja commented Dec 19, 2023

I like that you have added the encryption logic on the Connect screen - great improvement! Could we change the default checkboxes so the connection works by default? Right now with Encrypt checked and Trust Server Certificate unchecked, it would fail on all servers that don't have SSL enabled.

image

Could we either have both unchecked or both checked (preferrable) in which case connecting will work off the bat.

The default behavior I used was to enable Trust Certificate by default, but then I remembered that SqlNexus is a public tool and trusting the certificate is a security risk that only the end user should be responsible for.

if a corporate certificate was truly compromised, we don't want to automatically accept that. that is my logic for making it non-default

@moraja
Copy link
Contributor Author

moraja commented Dec 19, 2023

Tested functionality and examined DLLs loaded in the process - things work well. The only downside is that we now have a much larger SQLNexus folder full of binaries, but we knew that we will get this as a result of this work. The up-side is that users won't have to install 2 of the prerequisites any longer - ReportViewer control and the SQLClrTypes. Great work.

I'm hoping that one day we will upgrade RML utilities to an easy to compile environment and directly ship needed modules with Nexus without having to install anything separately... but one can only live on hope :)

Thanks for the great feedback :)

@PiJoCoder
Copy link
Collaborator

I like that you have added the encryption logic on the Connect screen - great improvement! Could we change the default checkboxes so the connection works by default? Right now with Encrypt checked and Trust Server Certificate unchecked, it would fail on all servers that don't have SSL enabled.
![image]
Could we either have both unchecked or both checked (preferrable) in which case connecting will work off the bat.

The default behavior I used was to enable Trust Certificate by default, but then I remembered that SqlNexus is a public tool and trusting the certificate is a security risk that only the end user should be responsible for.

if a corporate certificate was truly compromised, we don't want to automatically accept that. that is my logic for making it non-default

Yes, I think it's up to the user's admins of environment to ensure proper back-end security for SQL Server - thus trusting a certificate is up to the end user. Howver, having Encrypt Connection by default without trust server certificate will fail in most cases by default if no SSL. To have to uncheck the box every time would be annoying for me as a user and with these current defaults (and largest user base is SQL engineers), I'll have to do this every time I use SQL Nexus.
Possibly a good solution is to give users choice: for example if you would like to keep that configuration as default with encryption always enabled, we could consider saving these settings and preserve them for the user. SQL Nexus doing that for multiple things including Import settings and Login settings and saving them in a user config file. See

Properties.Settings.Default.Save();

Properties.Settings.Default.Save();

Properties.Settings.Default.Save();

@PiJoCoder
Copy link
Collaborator

Tested functionality and examined DLLs loaded in the process - things work well. The only downside is that we now have a much larger SQLNexus folder full of binaries, but we knew that we will get this as a result of this work. The up-side is that users won't have to install 2 of the prerequisites any longer - ReportViewer control and the SQLClrTypes. Great work.

I'm hoping that one day we will upgrade RML utilities to an easy to compile environment and directly ship needed modules with Nexus without having to install anything separately... but one can only live on hope :)

Thanks for the great feedback :)

We can get it done sooner rather than later, but a lot of things before that need to take place

Updated the Properties to save TrustCertificate and EncryptConnection settings.
@moraja
Copy link
Contributor Author

moraja commented Dec 20, 2023

@moraja I have several admin things that I'd like to ask you about.

  • This seems to be an old branch from your previous PR that contains commits that we have already included in the previous PR, also the branch name doesn't match the work. I see you have created a new branch moraja_reportviewer_Microsoft_data that you probably intended to use for this; could you switch to using that new branch and transfer all the changes to that branch?

  • Also, could you please associate the each commit message with a Github issue by using the #IssueID syntax. That way we can track which commit resolved what issue and it's easier to see code changes in the future. You will find it very useful yourself in the future as well as it will help others.

  • Could you provide in the PR description section instructions on

    • how to test the PR
    • what to install/configure for the PR (in this case, I assume we need instructions on which version of Nuget ReportViewer Control and Microsoft.Data.SQLCLient to install. You can provide the command or screenshots. These will also come in handy in the future when other developers need to know how to upgrade their packages. Please note that there are 94 forks of this repo and it would behoove us to assist the developers in those forks.

Thank you

I did work on the wrong branch by mistake, Now I cherry picked everything into the right branch if this makes a difference... I can cancel this PR and create a new one.

Nuget packages should not need anything extra, they download with the project, so no special instructions there.

for testing the only area that may have needed special instructions is the login screen, otherwise the changes do not introduce anything, testing should be simply running full load and everything succeeds without hiccups.

I will try to add the commits to the tasks now

@moraja
Copy link
Contributor Author

moraja commented Dec 20, 2023

I like that you have added the encryption logic on the Connect screen - great improvement! Could we change the default checkboxes so the connection works by default? Right now with Encrypt checked and Trust Server Certificate unchecked, it would fail on all servers that don't have SSL enabled.
![image]
Could we either have both unchecked or both checked (preferrable) in which case connecting will work off the bat.

The default behavior I used was to enable Trust Certificate by default, but then I remembered that SqlNexus is a public tool and trusting the certificate is a security risk that only the end user should be responsible for.
if a corporate certificate was truly compromised, we don't want to automatically accept that. that is my logic for making it non-default

Yes, I think it's up to the user's admins of environment to ensure proper back-end security for SQL Server - thus trusting a certificate is up to the end user. Howver, having Encrypt Connection by default without trust server certificate will fail in most cases by default if no SSL. To have to uncheck the box every time would be annoying for me as a user and with these current defaults (and largest user base is SQL engineers), I'll have to do this every time I use SQL Nexus. Possibly a good solution is to give users choice: for example if you would like to keep that configuration as default with encryption always enabled, we could consider saving these settings and preserve them for the user. SQL Nexus doing that for multiple things including Import settings and Login settings and saving them in a user config file. See

Properties.Settings.Default.Save();

Properties.Settings.Default.Save();

Properties.Settings.Default.Save();

done :)

@PiJoCoder
Copy link
Collaborator

PiJoCoder commented Dec 20, 2023

@moraja I have several admin things that I'd like to ask you about.

  • This seems to be an old branch from your previous PR that contains commits that we have already included in the previous PR, also the branch name doesn't match the work. I see you have created a new branch moraja_reportviewer_Microsoft_data that you probably intended to use for this; could you switch to using that new branch and transfer all the changes to that branch?

  • Also, could you please associate the each commit message with a Github issue by using the #IssueID syntax. That way we can track which commit resolved what issue and it's easier to see code changes in the future. You will find it very useful yourself in the future as well as it will help others.

  • Could you provide in the PR description section instructions on

    • how to test the PR
    • what to install/configure for the PR (in this case, I assume we need instructions on which version of Nuget ReportViewer Control and Microsoft.Data.SQLCLient to install. You can provide the command or screenshots. These will also come in handy in the future when other developers need to know how to upgrade their packages. Please note that there are 94 forks of this repo and it would behoove us to assist the developers in those forks.

Thank you

I did work on the wrong branch by mistake, Now I cherry picked everything into the right branch if this makes a difference... I can cancel this PR and create a new one.

Nuget packages should not need anything extra, they download with the project, so no special instructions there.

for testing the only area that may have needed special instructions is the login screen, otherwise the changes do not introduce anything, testing should be simply running full load and everything succeeds without hiccups.

I will try to add the commits to the tasks now

Thanks. Let's keep it in this PR for now given the work you've done already.
The Nuget packages don't install for me automatically. Perhaps I don't know something. But for example, a build fails for me currently because it appears I don't have the x64 version of SQL spatial DLLs. I guess I have to track that down and install with Nuget?

image

Perhaps we can do a screen share and debug

This is an example of the commands I used for RVC Nuget package

NuGet\Install-Package Microsoft.ReportingServices.ReportViewerControl.Winforms -Version 150.1586.0

@PiJoCoder
Copy link
Collaborator

@moraja one more question - do all projects need the Azure.Identity and Azure.Core Nuget packages installed? I think perhaps the Rowset Editor and SQL Nexus only? Or are these getting installed by Microsoft.Data.SqlClient?

image

@PiJoCoder
Copy link
Collaborator

I like that you have added the encryption logic on the Connect screen - great improvement! Could we change the default checkboxes so the connection works by default? Right now with Encrypt checked and Trust Server Certificate unchecked, it would fail on all servers that don't have SSL enabled.
![image]
Could we either have both unchecked or both checked (preferrable) in which case connecting will work off the bat.

The default behavior I used was to enable Trust Certificate by default, but then I remembered that SqlNexus is a public tool and trusting the certificate is a security risk that only the end user should be responsible for.
if a corporate certificate was truly compromised, we don't want to automatically accept that. that is my logic for making it non-default

Yes, I think it's up to the user's admins of environment to ensure proper back-end security for SQL Server - thus trusting a certificate is up to the end user. Howver, having Encrypt Connection by default without trust server certificate will fail in most cases by default if no SSL. To have to uncheck the box every time would be annoying for me as a user and with these current defaults (and largest user base is SQL engineers), I'll have to do this every time I use SQL Nexus. Possibly a good solution is to give users choice: for example if you would like to keep that configuration as default with encryption always enabled, we could consider saving these settings and preserve them for the user. SQL Nexus doing that for multiple things including Import settings and Login settings and saving them in a user config file. See

Properties.Settings.Default.Save();

Properties.Settings.Default.Save();

Properties.Settings.Default.Save();

done :)

You are a machine! :) Thank you

….Preview" version="130.1700.305"

This WebForm control is not needed by SQL Nexus and was causing build failures
@moraja
Copy link
Contributor Author

moraja commented Dec 27, 2023

@moraja one more question - do all projects need the Azure.Identity and Azure.Core Nuget packages installed? I think perhaps the Rowset Editor and SQL Nexus only? Or are these getting installed by Microsoft.Data.SqlClient?

image

I tried to remove core-identity references, while I can do it form the project references and it won't impact anything, I still couldn't uninstall the nuget package because SqlClient still depends on it. I think we should keep it along with the references and add a task to include AAD login and AzureDB connectivity sometime in the future to SqlNexus as we modernize the product.

@PiJoCoder
Copy link
Collaborator

@hacitandogan, @asavioliMSFT do you guys want to test this before we merge?

@PiJoCoder PiJoCoder deleted the moraja_add_environment_variables branch January 17, 2024 22:35
@PiJoCoder PiJoCoder changed the title Added Microosft.Data.SqlClient support + ReportViewer 15 Added Microsft.Data.SqlClient support + ReportViewer 15 Sep 12, 2024
@PiJoCoder PiJoCoder changed the title Added Microsft.Data.SqlClient support + ReportViewer 15 Added Microsoft.Data.SqlClient support + ReportViewer 15 Sep 12, 2024
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

Successfully merging this pull request may close these issues.

Switch SQL Nexus to using the NuGet package and remove the installation prerequisite on ReportViewer

2 participants