Creational Design Patterns in C# - Abstract Factory Pattern
Abstract Factory Pattern
Abstract Factory design pattern
(The code of the example given below can be found here at github.)
Lets consider an Agency called – CarInfo. CarInfo is an agency to provide consumers information about cars.
CarInfo want to develop a simple webpage where user selects car manufacturer, and then it shows the models of the select car . . .
Posted in: .netc#design patterns
Custom Claims-based Windows Authentication in ASP.net MVC 5
When I first read about the Claims-based identity/authorization, I immediately liked the idea. Claims are simple key-value pairs, dictionary type of objects and make it very easy for the developers to implement authorizations. You can very easily implement custom authorization class in your MVC project to use these claims and decorate your . . .
Posted in: .netc#claims-based identity
Creational Design Patterns in C# - Singleton Pattern
Singleton Pattern
Singleton Pattern
Singleton pattern (wiki) is a design pattern that restricts the instantiation of a class to one object. This is useful when exactly one object is needed to be shared across the system.
To make a class Singleton, usually the below pattern is followed:
The constructor of the class is made . . . |
Posted in: .netc#design patterns
Creational Design Patterns in C# - Prototype Pattern
Prototype Pattern
Prototype Pattern
When we want the type of an object to be determined by a prototypical instance, we use Prototype pattern to clone the instance to create a new object that we extend as per our new needs. (wiki)
Sometimes in our application, we may want to take an existing object (lets call this objectOriginal), and create another . . .
Creational Design Patterns in C# - Builder Pattern
Builder Pattern
Builder pattern (wiki) tries to separate the construction of a complex object from its representation. This pattern is used when complex object that need to be created is constructed by constituent parts that must by created in the same order or by using a specific algorithm.
Let’s consider . . . |
Posted in: .netc#design patterns
Creational Design Patterns in C# - Factory Pattern
Factory Pattern
Factory Pattern
In Factory design pattern, an object is created via a Factory class without specifying the actual concrete class name. It rather passes a parameter to a Factory class’s method that would indicate what concrete class the client code is interested in at run-time and then the Factory method can return the concrete . . .
Design Patterns In C# - Creational Design Patterns
Creational Design Patterns
SOFTWARE DESIGN PATTERNS
Design patterns = Software/coding design patterns that should be considered at every phase of software development right from designing the overall architecture of the software project to coding of small unit functionalities.
Keeping these Design Patterns in mind during software development helps towards . . .
Posted in: .netc#design patterns