Posts

Showing posts with the label .Net

Fix: EF Core - empty array returned when executing stored procedure against MSSQL server

 If you're getting an empty array when executing a stored procedure against an MS SQL Server using Entity Framework Core in .NET, there are several potential causes for this issue. Here are some steps to troubleshoot and address the problem: 1. **Check the Stored Procedure**:    Ensure that the stored procedure is defined correctly and doesn't have logic that inadvertently returns an empty result set. Test the stored procedure directly in SQL Server Management Studio to verify that it produces the expected results. 2. **Check Parameter Values**:    Confirm that the parameter values you are passing to the stored procedure match the expected data types and values. Incorrect parameter values can result in an empty result. 3. **Check Mapping and Model**:    Ensure that your Entity Framework model and mapping are correctly set up to match the structure of the result set returned by the stored procedure. The model should have properties corresponding to the columns returned by the st

How to have two active .NET applications in IIS?

 To host two active .NET applications in Internet Information Services (IIS), you need to create separate application pools and configure individual websites for each application. Here are the general steps to achieve this: 1. **Prepare Your Applications**:    Ensure that your two .NET applications are properly built and ready to be deployed to IIS. You should have the application files and configurations ready. 2. **Install IIS**:    If IIS is not already installed on your server, you will need to install it. You can use the "Add Roles and Features" wizard in Windows Server to install the "Web Server (IIS)" role. 3. **Create Application Pools**:    Each .NET application should run in its own application pool to ensure isolation. Open IIS Manager, navigate to "Application Pools," and create two new application pools, one for each application. Configure the .NET CLR version and pipeline mode according to your application's requirements. 4. **Publish App

How can i get GUID of Windows Forms in .NET (not .Net Framwork)

 In .NET (not .NET Framework), you can generate a GUID (Globally Unique Identifier) for a Windows Forms application using the `System.Guid` class, just as you would in any other .NET application. Here's how you can create and retrieve a GUID in a Windows Forms application: 1. First, make sure you have included the necessary `using` directive at the top of your code file:    ```csharp    using System;    ``` 2. To generate a new GUID, you can use the `Guid.NewGuid()` method. You can call this method in response to a button click or any other event in your Windows Forms application:    ```csharp    private void GenerateGuidButton_Click(object sender, EventArgs e)    {        Guid newGuid = Guid.NewGuid();        string guidString = newGuid.ToString();                // Display the generated GUID in a TextBox or any other control.        guidTextBox.Text = guidString;    }    ``` 3. In this example, we generate a new GUID and convert it to a string using the `ToString()` method. You c