We recently upgraded our C# projects from .NET Framework 4.5.2 to .NET 6.0, and now the line
System.Data.Sql.SqlDataSourceEnumerator.Instance.GetDataSources()
no longer works. As far as I can tell, the class SqlDataSourceEnumerator is just not included in the System.Data assembly for .NET 6.0.
I've looked online for other ways to get available SQL Servers, but all of ones I've found either recommend using SqlDataSourceEnumerator, or SmoApplication.EnumAvailableSqlServers() which relies on it internally.
What other ways are there to get available SQL Servers in our C# code that are compatible with .NET 6.0? We need a solution that returns the same info as before (including Server, Name, Instance, Version, and IsLocal).
Related
The company I work for wants to integrate our system with another company's .NET SDK, however I have run into an issue where our system is .NET 7.0 and their SDK requires .NET Framework 4.8. This company will not share details about what parts of their SDK require .NET 4.8, so I can't just use reflection for those specific libraries/assemblies.
I've been trying to find a way to integrate with them and I learned about reflection. How exactly can I use reflection to load in an older version of .NET Framework and also have that SDK use it? I've seen a number of posts about using reflection to load in older versions of other libraries/assemblies, however I haven't seen any for .NET and the most similar ones to my case are very dated and for WPF. None of the questions involved having some external SDK use that specific assembly version either, so I'm not sure how to progress from here.
Usually a .NET version is equal accross all libraries, so it makes sense there is no additional information.
There's 3 solutions to incompatible versions:
Create an 'adapter' built in .NET 3.5 that fetches the required data and then outputs it in a format that your .NET 7.0 application can use.
Downgrade your own application to the supplier's version. This is actually preferred if you're just developing an extension or other limited-in-scope functionality.
Get the supplier to commit to a .NET upgrade, and close your ticket as 'won't fix'
I'm working on migrating a large code base of libraries in a direction to eventually support .NET Core. Currently, everything is based on .NET Framework. I have a set of library projects which are consumed by several web applications.
The plan is to convert the library projects over to .NET Standard 2.0 so that they can be consumed by both .NET Framework (version 4.7.1) based websites and by new .NET Core (version 2.0) websites. I've done some test solutions which proved that this can be done.
To convert the first library over to .NET Standard I had to leverage the Windows Compatibility Pack for some of the features that are not part of .NET Standard. Some features such as SqlClient and some System.Drawing tools had to be imported into the library. All of this worked but an issue turned up when trying to bring my library into code which was still targeting .NET Framework.
Even though the namespaces were the same, the consuming code could not see the objects (such as Image or SqlConnection) unless I added the same Windows Compatibility Pack libraries into the consuming project. If anything, I would have expected this to cause issues as I now have two identical classes (same namespace and object name) in different assemblies. Fortunately, it is working. At least the unit tests are still passing.
Is this the way the Windows Compatibility Pack libraries are supposed to work? I had hoped that they would provide the functionality in the .NET Standard or .NET Core code but allow the .NET Framework to still use its own implementation.
The compatibility package references a few of the assemblies that were brought back to increase the compatibility of .NET Core with .NET Framework.
The way the package works is that there is a meta-package (the one that you reference) and it has references to individual packages that actually contain the implementation. Those individual packages have different assets depending on the target framework.
Take for example System.IO.Ports. That package contains the following assets (and a few more things that are not directly relevant to this):
net461
netstandard2.0
The netstandard2.0 asset contains the code that implements the System.IO.Ports functionality. You will use this if you are building a .NET Core application.
The net461 asset type-forwards the types exposed by the System.IO.Ports namespace to the assemblies you will find in the .NET Framework installation. You will use these if you are building a .NET Framework application (like a console application of web site).
This means that when you are consuming your library on .NET Core, you are using the implementation that was ported and made to work on .NET Core.
When you are using your library on .NET Framework you will use the implementation that is part of .NET Framework.
I am using Sqlite ADO.NET provider 2.0 in my c# application .net framework 4.0.
Question1: Does this .dll come with a back up Database functionality?. If the suer wants to backup, looks like I have to get the source code and write my own backup feature.
Or is it already provided and I just need to use it?
Question2 :
I tried downloading a recent version of Sqlite ADO.NET provider(line 3.5/4.0)
from this website
http://www.sqlite.org/download.html/
sqlite-dll-win32-x64-3071300.zip
After attaching the dll as reference, it still says
Version v2.0.50727.
Description: ADO.NET 2.0 Data Provider for SQLite. Is this correct stable version or is there a recent one to be used.
Thank u
For Question 1: The ADO.NET provider isn't meant to have a backup capability. That's something the RDBMS software should have. ADO.NET is just a tool used to simplify communicating with the RDBMS.
- However, SQLLite backups are documented at http://www.sqllite.org/backup.html
For #2 I don't see a question - just a statement that you got a warning from Visual Studio. BUT based on what I'm seeing, you will get an error. You're trying to use an SqlLite provider for .NET 3.5 or above, and your .NET project is set to 2.0. Either upgrade your app to 3.5 or above, or look for an older .dll to download and use.
As a general rule of thumb, in a .NET project, you can use .dll files specified for an older version of the Framework, but not .dlls specified for newer versions.
I just want to make it sure that this ODP.NET is the native provider for oracle design for .net and since when exit's? because some of my partners say that it's pretty new and want to know when was the first release. This all discussion came because they chooses not used entity framework because oracle was not release a native provider for .net in the 2008 and want to check if it's true
Originally the Net Framework 1.1 provided a native Oracle ADO.NET provider in the namespace System.Data.OracleClient, but then Microsoft declared it obsolete and stated that these types are deprecated and will be removed in a future version of the .NET Framework. (But are still here in Net 4.0). In the meantime Oracle build ODP.NET and now this could be considered the official Oracle Net Provider.
You can download it for free here
It comes in 32bit and 64bit versions and, as stated by Oracle, it includes Entity Framework, LINQ, WCF Data Services, and implicit REF CURSOR parameter binding support.
At this link you could read numerous FAQ on this provider
Disappointingly, the members page for HtmlForm 2.0 is missing...
My research seems to indicate that HtmlForm.Action is a property that was added in .Net Framework 3.5. However, I'm using VS2005 and my reference to System.Web (the namespace HtmlForm is under) is to a .Net Framework 2.0 runtime version.
Further, my IIS status information also indicates I am using .Net Framework 2.0, when I force an error on my local IIS and read it. Despite this, I am able to use form1.Action successfully...but only on my local IIS.
When I try it on vms and external servers, I get [MissingMethodException: Method not found: 'System.String System.Web.UI.HtmlControls.HtmlForm.get_Action()'.] errors.
So, my question:
1) Why does it work on my local IIS? Does the fact that I have the 3.5 framework installed make a difference, here?
2) Why does it not work on other IIS? (I think this is because it's not part of .Net 2.0).
I guess I just figure that if something is running on .Net Framework 2.0, the presence of 3.5 should not make a difference. Or maybe there's some other cause for these results.
That's right in IIS you will see .NET Framework 2.0 even when you are using .NET 3.5. It happend because Microsoft .NET Framework 3.5 was built incrementally upon .NET Framework 2.0 and 3.0.
1) It doesn't work on the server because .NET 3.5 is not installed. You have created the .NET 3.5 project in the Visual Studio, so .NET 3.5 must be installed on the server.
2) See 1.