How to design patterns from scratch using C# asp.net MVC

coder rock 196 Reputation points
2024-04-19T14:27:10.4633333+00:00

I am new to building design pattern using factory design pattern, its C# asp.net mvc application which i am going developing my new web application,

please can you help me how to start from scratch.

I have worked one design pattern application which is designed by my seniors developed using factory design pattern they have developed using component class.

I have 8 years of experience never design, any design pattern from scratch just used develop by others.

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,390 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,263 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,269 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 56,531 Reputation points
    2024-04-19T16:19:47.74+00:00

    You should study design patterns. There are books and online courses.

    The factory pattern is one of the simplest. instead of creating class instances with the new operator, you call a "factory" method to create the instance. typically an interface is returned rather than a class type. It is not uncommon to use a factory for the factory, especially if plugins are used.

    a common use besides configuration is unit test mocking.

    simple online example:

    https://www.dofactory.com/net/factory-method-design-pattern

    0 comments No comments

  2. Lan Huang-MSFT 25,636 Reputation points Microsoft Vendor
    2024-04-22T03:12:16.71+00:00

    Hi @coder rock,

    MVC is a Model-View-Controller - high-level architectural pattern which intend is separating UI from from model. Factory is a low-level pattern which intend is a creation of objects.

    You can check out the following links:

    ASP.NET MVC Pattern

    Getting started with ASP.NET MVC 5

    https://github.com/nemanjarogic/DesignPatternsLibrary
    Best regards,
    Lan Huang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments