How to check if Configuration Section exists in .NET Core?

Since .NET Core 2.0, you can also call the ConfigurationExtensions.Exists extension method to check if a section exists. var section = this.Configuration.GetSection(“testsection”); var sectionExists = section.Exists(); Since GetSection(sectionKey) never returns null, you can safely call Exists on its return value. It is also helpful to read this documentation on Configuration in ASP.NET Core.

Deploying and Configuring ODP.NET to work without installation with Entity Framework

This answer summarizes (hopefully) all the steps required, many of which documented in various places online and might save someone hours of Googling. A. How to deploy and configure Oracle.DataAccess.Client. A.1. Download ODAC112030Xcopy_64bit.zip or ODAC112030Xcopy_32bit.zip. A.1.1. Extract the content of the following folders within the zip file into your application/host’s bin/setup folder: A.1.1.1. instantclient_11_2 A.1.1.2. … Read more

How to set boolean values in an INI configuration file?

There’s no spec for INI files, but for whatever it’s worth, I’ll list the behaviour of a few implementations from languages I know. Python’s built-in configparser module offers a getboolean that behaves as follows: the accepted values … are ‘1’, ‘yes’, ‘true’, and ‘on’, which cause this method to return True, and ‘0’, ‘no’, ‘false’, … Read more

Web.config is not transformed when debugging code

You can transform Web.config on build. Add this target to *.csproj file: <Import Project=”$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\WebApplications\Microsoft.WebApplication.targets” /> <Target Name=”BeforeBuild”> <TransformXml Source=”Web.Base.config” Transform=”Web.$(Configuration).config” Destination=”Web.config” /> </Target> Keep the origin configuration in Web.Base.config. It’s enough to enable transformation and it works for any XML config file. SlowCheetah is no longer needed at all. To avoid unwanted transform on publish, … Read more

Consume a SOAP web service without relying on the app.config

The settings in <system.ServiceModel> in the app.config file will tell the component how to connect to the external web service. The xml is simply a textual representation of the necessary classes and enumerations required to make the default connection to the web service. For example, this is the code that was generated for the web … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)