AngularJs Factory and Services. References: https://blog.thoughtram.io/angular/2015/07/07/service-vs-factory-once-and-for-all.html The difference between services and factories we can define a service like this: app . service ( 'MyService' , function () { this . sayHello = function () { console . log ( 'hello' ); }; }); .service() is a method on our module that takes a name and a function that defines the service. app . factory ( 'MyService' , function () { return { sayHello : function () { console . log ( 'hello' ); } } }); .factory() is a method on our module and it also takes a name and a function, that defines the factory. a service is a constructor function where as a factory is Not .T here’s ' this ' code that calls Object.create() with the service constructor function, when it gets instantiated. However, a factory function is really just a function that gets called, ...
Ref: https://code-maze.com/aspnetcore-webapi-best-practices/ In the Startup class, there are two methods: the ConfigureServices method for registering the services and the Configure method for adding the middleware components to the application’s pipeline. public static class ServiceExtensions { public static void ConfigureCors(this IServiceCollection services) { services.AddCors(options => { options.AddPolicy("CorsPolicy", builder => builder.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader() ...
Interview question https://www.wisdomjobs.com/e-university/advanced-c-hash-interview-questions.html https://www.guru99.com/c-sharp-interview-questions.html Best concepts c# https://www.geeksforgeeks.org/private-constructors-in-c-sharp/ https://www.completecsharptutorial.com/basic/referencetype-parameter.php Difference between Abstract Class and Interface ABSTRACT CLASS INTERFACE It contains both declaration and definition part. It contains only a declaration part. Multiple inheritance is not achieved by abstract class. Multiple inheritance is achieved by interface. It contain constructor . It does not contain constructor . It can contain static members. It does not contain static members. It can contain different types of access modifiers like public, private, protected etc. It only contains public access modifier because everything in the interface is public. The performance of an abstract class is fast. The performance of interface is slow becau...
Comments
Post a Comment