
Harpreet Kaur is a skilled Full Stack Developer with 5.7 years of experience specializing in both front-end and back-end development using the .NET Framework, .NET Core, C#, MVC, LINQ, REST APIs, SQL, and JavaScript, along with one year of expertise in Angular. Throughout her career, she has built and maintained complex applications in industries like health insurance and contributed to innovation through POCs and API integrations. She thrives in Agile environments, where she has taken on leadership roles, guided teammates, and earned recognition for her technical achievements.
IT Analyst
Tata Consultancy ServicesTechnology Analyst
Infosys
ASP.NET

C#

MVC

Microsoft SQL Server

HTML

TFS

DevOps

Git
.jpg)
Web API

Web Services

SSIS

Entity Framework

Visual Studio Code
Hello, everyone. I am Harpreet Kaur, and I'm from Jalandhar, Punjab, and I have 5.7 years of experience in technology, which includes C#, dotnetcore, version 6 and 8, then MVC, architecture, web APIs, and REST APIs. So, currently, I was working in DCS, but I left due to some personal commitments. I left TCS on June 14, 2024, and now I'm looking for a remote opportunity. So while working in TCS, I was part of NBS, that is the nationwide building society project, which is a banking project that mainly deals with members' data, their health insurance policies, and loans. So we will work there. I worked there using the agile methodology. And C# and.NET were my main core technologies to work there. Then I completed my graduation from Punjab University Chandigarh. After that, I completed my master's in computer applications from Punjab University Chandigarh, and then I got placed from campus in Infosys. And now I worked there in Infosys for 4 years. After that, I switched to TCS. In TCS, I worked for one and a half years. And due to some personal reasons, I actually needed to work remotely, so that's why I left TCS.
Implement a real-time communication in a.NET Core application. We can use web APIs to communicate between different applications as we already know that we don't need to connect our project to a database when we are consuming web APIs. So we can develop our web APIs using the C# Web API project, then implement all the APIs which can be HTTP put, get, and post, or delete. After implementing, these can be asynchronously implemented. By implementing asynchronously means that we don't need to wait for one task to complete, so it will work on concurrently. That's why we have used async for implementing web APIs. After implementing these test APIs, we can consume it using any front-end, like type, for a front-end or some other platforms like Angular or using in Visual Studio Code or Visual Studio, and then we can consume these APIs. Because of this, we don't need to directly connect with a database to store our data. We can just implement those, we can just consume those REST APIs. This is how real-time communication can also happen. There is one more way we can use AJAX calls for real-time communication without reloading the full content of that page.
Custom exceptions. So when using we can create our own exception handling using custom exceptions. So we can implement our code according to our requirement. That is why we have exception custom exceptions. That means we can mold our code according to our requirement. So C# provides a way to implement custom exceptions. The main benefit of using custom exceptions is that we can implement our own business logic whenever there is an exception occurred in our application. Suppose we are running an application and an exception has occurred and we don't know where this exception is. So we can implement a custom exception class. We can create a class. We can name it as CustomException, then implement the functionality, like whether there is any exception occurred at any point of our application, then we need to raise this particular exception or render this particular view. So whenever that exception has occurred. We have some built-in exceptions in C#, like DivideByZero or some other built-in exceptions. These are the built-in exceptions. So other than that, if there are exceptions we need to handle according to a developer's perspective, then we can use custom exceptions. So we can implement our own logic, business logic into that exception and then throw that exception whenever an application has stuck somewhere in between. There are other benefits also by using custom exceptions that we don't need to stick to the existing exception handling functions. So we can develop our own exception handling code.
In C# which solid principle do extension methods most closely adhere to, in open closed relationship, in open close relationship, extension methods are most closely adhered to. By using open closed relationship means that any class should be open for implementing any new feature, and it should be closed for any modification if the application is already built and it has gone through all the unit test cases, and we now we are changing our requirement. We are doing some changes in our code that means it should not be done like that. So by using open, for example, we have a class called it, and it is calculating the area of a rectangle. So we are done with our code, and there is another requirement and we need to calculate the area of a circle also. And then again, we are making changes in our this code that is calculate area, this class, then this is violating a closed relationship. It means we have already done our coding and gone through the UAT, but we are again changing this due to this requirement. So rather than that, we can do is we can create one interface and declare a method there like calculate area. So whenever there is a new requirement of calculating the area of a rectangle or circle or triangle, any shape, then we can just need to change that method, not the full class. So the open close relationship is one of the most important relationships in SOLID principle.
Enable course origin request in a dotnetcorestapi can be done by using different ways. The first one is using an attribute upon an action method that can enable CORS by mentioning the policy name in the parentheses with the EnableCors attribute. This is the first way to enable CORS. The second way is using the UseCors middleware. By using that middleware, we can enable CORS. What we can do is use app.UseCors and mention the policy name in it. We can also use the lambda expression like options. There are multiple options for CORS, like WithSameOrigin, WithAnyMethod, and WithAnyHeaders. WithSameOrigin means only this domain should be accessed, and with any method means any method can be accessed. We have another option, like WithAnyHeaders, any headers can be accessed. This is the second way to enable CORS, and this is done using middleware with app.UseCors. We have AddCors. There is one more way to implement enable CORS that is AddCors. Services.AddCors can be used, and in this method, we can create our own policy name, mention the policy name, and then its options using a lambda expression. So this can be again WithSameOrigin, then we have other options, like WithAnyMethod and WithAnyHeaders. These are the options that we can include in our CORS properties.
We can use an async method in C# to improve API performance in a scenario where we are creating a student repository. Yes, to using async methods. We can, for example, create an interface that contains all the generic methods, and these generic methods are async methods. So we will use the async keyword before declaring a method, then its return type can be "Task" of type, then that's supposed to be the name of the method, for example, "Get". So it will return all the list of students asynchronously. We have declared this method in our interface, then we will create a class, for example, the class name is Repository class. In this Repository class, we will implement our async interface method here. So the method name will be async, the name of the method, and then we will implement it by connecting to the database using, for example, our application DB context for connecting to the database, and we will get the list of students from our database using DBContext, for example, the "Find" method or the "FirstOrDefault" method. This method can be used, and we need to use the await keyword in front of calling a sync method that is an inbuilt sync method. We can have a list async. List, it will return a list async. So this method will return data from our database. So this is how we can use async methods. We need to use the await keyword before calling any async built-in method or implementing an async method.
We need to update an existing item in the repository. So first of all, we will put a debug point in the update item method. For example, we are using Postman for testing this API, and then we are giving the item as the body of the API call. The type of the method is HTTP POST. So I think the HTTP method attribute is also missing here, HTTP POST. We need to place it just well, actually, this is the repository, and we don't need an attribute to be put here. So where existing item equals to item dot first or default. We are already assigning item in the existing item variable. So we don't need to assign again, existing item is equal to item. As we got the existing item here, so what we will do is we need to save it.
Given this issue, I was looking to identify the solid principle that might be violated here and explain why. Class report printer, print report, generating report, public format report. Actually, this is violating the first principle of Solid that is single responsibility principle. It means whenever we are creating classes, it should have a single responsibility. It should not perform multiple tasks. For example, here, we have a class report printer. So in this report printer class, we are using two methods, print report and format report. So we are performing more than one task in this class. Like, we are generating reports also. We are formatting report also. So for these two methods, we should have another classes like, generate report or the format report. And in these classes, we can implement our functionality, like how to format a class, how to format a report or how to generate a report. And then, we can implement these classes, or we can use the methods of these classes. We can use the methods of those classes in our report printer class. So it is violating the first principle, that is single responsibility principle.
How can a dot net core application be made more secure against SQL injection attacks? To make the application more secure using SQL injection attacks, we can implement stored procedures instead of directly using select or insert statements into our C# dot net core. So instead, we can create multiple stored procedures. And so we can just use a stored procedure to implement or insert or delete or some select statements to fetch the data. Other than that, we can also use normalizations. I not that the table should be in all three normalized forms. Then we can use indexes, try catch blocks in our stored procedures. Or so we can also use Windows authentication or SQL Server authentication for connecting to the database. So other than that, these things we can use.
What is the role of configure await method in using programming with C Sharp? Configure await method. It's a asynchronous method in a sec, in c sharp. It will configure our configuration items asynchronously.
Again, did you integrate signalR with.NET Core application for real-time?