我们的系统使用哪种设计模式? [英] Which design pattern to use for our system?

查看:108
本文介绍了我们的系统使用哪种设计模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Suppose, I have four different entities in our c# design system.

 1. Organization
 2. Class
 3. Course
 4. Students

Now, I have to pull the above entities data from the third party API and store in our system.

I have created the four different business access classes of above entities which will have common pull method.

    Public bool PullFromThirdPartyApi()
    {
    //Logic goes here
    }

So far, I can use the factory design pattern for it but problem will arise when business class may contains different functions.

Suppose, Organization and Class business access contains extra below method which Course and Students business Class may not contain.

    Public bool PullByIDFromThirdPartyApi()
    {
      //Logic goes here
    }

Please suggest the suitable design pattern here with approach.

What I have tried:

I have tried with factory design pattern which is not suitable if it extends further as mentioned in question description.

推荐答案

也许这会有所帮助:工厂方法模式与抽象工厂模式 [ ^ ]

如果你想了解原版Gang of中的其他模式四个然后DZone有一个很好的refcard关于它(你需要登录,它是免费的):

https://dzone.com/refcardz/design-patterns?chapter=1 [ ^ ]
Maybe this will be of help: Factory Method Pattern vs. Abstract Factory Pattern[^]
If you want to learn about other patterns from the original "Gang of four" then DZone has a nice refcard about it (you will need to sign in, it's free):
https://dzone.com/refcardz/design-patterns?chapter=1[^]


这篇关于我们的系统使用哪种设计模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆