Posts

Missing Functions App in API Management Service in Azure

Image
When we go to add an Azure Function as an API in the API Managagement in Azure, some Azure Functions might be missing from the list and there is no filter screen in API Management Screen to see all the Azure Functions. In order to see all the functions, 1. Click on the gear icon on the top right of the screen. 2. Click on the Default Subscription Filter dropdown and make sure that you have the subscription(s) selected which have the Azure Functions. 3. Head back to to the API Management Screen and when you click on the Function API tile, you should be able to see the missing Azure Functions.

Creating a C# class from JSON.

Image
Previously to create a C# class from JSON, we would use some tool, either web based or otherwise to generate the C# class. Now we have an option to generate an C# class directly from Visual Studio using the menu option Edit --> Paste Special --> Paste JSON as Classes. Steps to implement this. 1. Copy the JSON that we to use to generate the C# class 2. Create a new C# class 2. Click on the menu option Edit --> Paste Special --> Paste JSON as Classes 3. We can see the C# class created. You might have to change some of the data types as at times, the date and integer properties are generated as string. Hope this helps.

Using IOptions class in .Net Core Unit Testing.

When implementing unit testng for a interface that was using a IOptions class, we were getting an null exception when trying to access the value using _mockMyconfig!.Object.Value . To resolve this error this, you have to manually create the MyConfig class and then assign it to the Value property. MyConfig myConfig = new MyConfig() { BaseURL = "https://mocktest.com" }; _mockMyconfig = new Mock >(MockBehavior.Loose); // We need to set the Value of IOptions to be the Myconfig Class, if this step is not done, then we get null exception when we try to use the value like this _mockMyconfig!.Object.Value _mockMyconfig.Setup(ap => ap.Value).Returns(myConfig); Once you have done this, then we use this in the unit testing like without getting the null exception. _mockHttpClient!.Setup(repo => repo.GetPWSHttpClient(_mockMyconfig!.Object.Value)).Returns(new HttpClient()).Verifiable(); The Main NuGet packages that have been used for th...

Retrieve Inbound IP Address for a Azure App Service when using a Private Endpoint.

When we are using Bicep Script to configure Azure App Services in your environment and we are using Private Endpoint, the Inbound IP Address of the Azure App Service is the Private IPv4 Address of the NIC associated with the Private Endpoint. Below is the Bicep script that we need to use to get the Private IPv4 IP address using the Bicep Script. // NICName - Replace the Nic Name with the name of the NIC from your environment. resource networkInterfacesResource 'Microsoft.Network/networkInterfaces@2023-09-01' existing = { name: NICName .nic' } //The IPv4 Address is part of the IP configuration of the NIC and the ipConfigurations is an array. Here in this example, we have only ipConfiguration associated with the NIC //so hard coding the array with the value 0 will work here. output IP string = networkInterfacesResource.properties.ipConfigurations[0].properties.privateIPAddress Just for completeness sake, below is the Bicep script that you can use to get the Inboun...

SharePoint CSS Chart

Found a great post on Heather blog http://sharepointexperience.com/csschart/csschart.html  that contains all the CSS elements in SharePoint and what they do. This is a invaluable tool if are into any kind of branding in SharePoint 2010.

Handy XSLT Tag to output XML data

Many a time we want to display the incoming XML in the XSLT transformation that we are doing. this is specially true when we are working with SharePoint and we do not know the XML format of the incoming XML Data. the XMP tag is a easy way to out the incoming XML to the screen. Just place this in your root tag and refresh the browser and the incoming XML data is displayed Make sure that any other tags in the root tag are commented out before you run the xslt. <xsl:template match="/"> <xmp> <xsl:copy-of select="/"/> </xmp>< !--<xsl:call-template name="dvt_1"/>--></xsl:template>

Print from WPF using ReportViewer Control

Came across a requirements in a project that i was working on were we had to show SQL reports from inside of a WPF application(that WPF does not have a way to show SQL Reports requires another post). Could not find a complete solution that will give the user the code to add and show SQL Reports from WPF. The environment that i have used for this solution is Visual Studio 2010, SQL 2008  R2 deployed on a remote server Below is the complete code using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace ReportViewer { /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow ...