Blog

Seamless Integration

Adding AutoFac as Inversion of Control (IoC) mechanism in Asp.Net Core 2.2

Include AutoFac and Autofac.Extensions.DependencyInjection packages in your project 2. In the Startup Class, add an Autfac Container Object: 3. Build the Container and Register the Entities within the ConfigureServices method. Populate the .Net Core Services in the AutoFac Container 4. Return AutoFacServiceProvider and change the return type of ConfigureServices to IServiceProvider 5. Services within the …

Entity Framework Core in Asp.Net Core 2.2

Create a Database Context Class inherited from Microsoft.EntityFrameworkCore.DbContext and define DbSets with Database Models: 2. Create a ConnectionString in appsettings.json 3. In the Startup class, add database context to the Service Collection 4. Use the Database Context to query/execute SQL commands

Pattern Matching in C# Switch

Switch…Case block is used to provide handling of flow of the program logic based on certain outcome of a variable. Most of the time, we evaluate the variable and depending on exact match, we pass the flow to a case handler like this: switch (color) { case “Red”: gotoRedHandler(); break; case “Green”: gotoGreenHandler(); break; default: …

SQL Server Management Studio (SSMS) – Save changes made to a Table

SSMS will prevent any changes being made to the table through the ‘Design’ mode: You will see the following error appear that prompts us to drop and re-create table: This restriction is set by SSMS from accidental changes on the table structure. However, if you are certain the changes are intended, you can overcome this …

Extract and Store RSS Feed to Sql Server

Welcome to WordPress. This is your first post. Edit or delete it, then start writing!