To understand Async and Await, first we need to understand about 'Task'. Task - This is used create thread but it will create thread from the thread pool and not from the computer operating system unlike normal Thread object in c# does. This is used to perform async operations 1. Task<TResult> - This return is used when the async method that returns a value. 2. Task - This return type is used when the async method does not return any value. 3. void - This return type is used for an event handler. We saw that concurrency refers to, in one way or another, doing several things at the same time. That concept of concurrency encompasses parallel programming and asynchronous programming. Parallel programming refers to the use of multiple threads simultaneously to solve a set of tasks. For this, we need processors with adequate abilities to perform several tasks at the same time. In general, we use parallel programming to gain speed. Asynchronous programming refers to the e...
Now a days properties has become rule to declare in every class. I don’t think it should be used in every class that we declare. It all depends on what is the scenario in our project whether we need properties or declare them? Well I guess it should be used in all classes because as we all know that variables inside class are private by default and cannot be accessed outside it’s class. In order to access private variables of the class then we have only two options Declare with public - not good idea as anything can be set into it and by anyone. Declare with properties Advantage by declaring properties is that, either we can allow only to read access with “GET” or we can give SET access by checking some conditions and then only set those values. I think if a property is declared with get and set without special conditions inside get and set then it is better to declare them with public we can also declare property which is of type ENUM. we can also define property whi...
URI - it can be of type http, FTP or mailto. In Web API - all are resource I guess unlike web service, in web api , we dont create proxy class First - we need URL second - what types of methods third - what type of data URI will be same but based on method type [GET or Delete ] the action will be invoked inisde API. services.AddDBContext<OrganizationContext> --->inside Configservice class is add like dependency injection way. Reason is since there are lot of controllers then we create in each and every controller OrganizationContext object which is very time consuming process. that's why if we added in Configservice then Dependency injection will take care of creating the OrganizationContext object in each and every controller and pass it to the controller constrcutor and it will also take care of disposing the object also. Swagger - It is for those who are consuming our developed services Fiddler - It is used for developers to test th...
Comments
Post a Comment