• Stars
    star
    111
  • Rank 313,039 (Top 7 %)
  • Language
    C#
  • License
    MIT License
  • Created over 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

DesignPatterns samples by csharp on dotnetcore 《大话设计模式》 中设计模式总结/C#(.NET)代码

DesignPatterns

Intro 简介

Design patterns from 《大话设计模式》 and some samples implemented by C#.

《大话设计模式》 中设计模式总结,示例代码是用 C# 写的,如果要自己编译请下载安装 .NET SDK

设计模式设计原则

  • 单一职责原则

    对于一个类而言,应该仅有一个引起它变化的原因

    如果一个类承担的职责过多,就等于把这些职责耦合再一起,一个职责的变化可能会削弱或者抑制这个类完全其他职责的能力。这种耦合会导致脆弱的设计,当发生变化时,设计会遭受到意想不到的破坏。

  • 开放-封闭原则

    开放-封闭原则是说软件实体(类、模块、函数等等)应该可以扩展,但是不可修改。

    对于扩展开放,对于更改封闭

  • 依赖倒转原则

    • 高层模块不应该依赖低层模式,两个都应该依赖抽象。
    • 抽象不应该依赖细节,细节应该依赖于抽象。基于接口编程。
  • 里氏代换原则

    子类型必须能够替换掉它们的父类型

  • 接口隔离原则

    使用多个隔离的接口,比使用单个接口好,建立最小的接口

    一个接口只负责一个功能

  • 迪米特法则

    如果两个类不必彼此通信,那么这两个类就不应当发生直接的相互作用。如果其中一个类需要调用另一个类的某一个方法,可以通过第三者转发这个调用。

    类的结构设计上,每一个类都应当尽量降低成员的访问权限

    类之间的耦合越弱,越有利于复用,一个处在弱耦合的类别修改,不会对有关系的类造成波及

Overview 概览

设计模式大体上可分为三类:

Contact

Contact me if you need: [email protected]

More Repositories

1

DbTool

数据库工具,根据表结构文档生成创建表sql,根据数据库表信息导出Model和表结构文档,根据文档生成数据库表,根据已有Model文件生成创建数据库表sql
C#
318
star
2

WeihanLi.Common

common tools, methods, extension methods, etc... .net 常用工具类,公共方法,常用扩展方法等,基础类库
C#
214
star
3

WeihanLi.Npoi

NPOI Extensions, excel/csv importer/exporter for IEnumerable<T>/DataTable, fluentapi(great flexibility)/attribute configuration
C#
193
star
4

StackExchange.Redis-docs-zh-cn

StackExchange.Redis中文使用文档
102
star
5

AccessControlHelper

AccessControlHelper for asp.net mvc and asp.net core, strategy based authorization
C#
74
star
6

SamplesInPractice

some samples in practice
C#
61
star
7

WeihanLi.EntityFramework

EntityFrameworkCore extensions
C#
58
star
8

SparkTodo

TodoList WebApi Powered by ASP.NET Core and JWT token auth
C#
47
star
9

WeihanLi.Redis

RedisExtensions for StackExchange.Redis, Cache/Redlock/Counter/RateLimiter/Rank/RedisEventBus
C#
46
star
10

dotnet-exec

dotnet execute with custom entry point, another dotnet run without project file
C#
37
star
11

dotnet-httpie

Amazing HTTP command-line tool powered by .NET, inspired by httpie
C#
26
star
12

ProxyCrawler

代理爬虫服务,爬取代理IP并保存到 Redis 中, topshelf+Quartz.Net+redis
C#
25
star
13

AspNetCorePlayground

AspNetCorePlayground
C#
23
star
14

WeihanLi.Web.Extensions

asp.net core web extensions
C#
15
star
15

MvcSimplePager

Simple,lightweight,easy to expand pager for asp.net mvc and asp.net core,针对asp.net mvc 和 asp.net core 设计的通用、扩展性良好的轻量级分页扩展
C#
13
star
16

docker-env

some docker images build environment
Dockerfile
12
star
17

XunitDependencyInjection.Samples

samples for https://github.com/pengweiqhca/Xunit.DependencyInjection
C#
9
star
18

WeihanLi.Extensions.Localization.Json

dotnetcore json based localization support
C#
7
star
19

WeihanLi.DataProtection

asp.net core data protection extensions
C#
7
star
20

weihanli.github.io

weihanli's personal homepage
TypeScript
7
star
21

OrmBenchmark

OrmBenchmark for .net framework and .net core
6
star
22

Markdown2HtmlTool

markdown2htmlTool markdown转换为html小工具
C#
5
star
23

AccountingApp

Accounting App Powered by asp.net core
C#
4
star
24

DbTool.Packages

DbTool packages source code
C#
4
star
25

roslyn-docs-zh-cn

【TODO】roslyn中文文档,原英文文档参考 https://github.com/dotnet/roslyn/tree/main/docs
3
star
26

markdown-syntax-summary

markdown 语法总结,包含基本的markdown语法和github支持的markdown语法
3
star
27

WeihanLi.Profile

weihanli's personal profile
2
star
28

PrivateSpaceDemo

ASP.NETMVC Demo website,ASP.NET Wechat Develop,ASP.NETMVC网站私密空间,ASP.NET MVC微信开发
JavaScript
2
star
29

dotnet-exec-action

Github action for dotnet-exec
C#
1
star
30

PublishPlatform

xx 项目发布平台 demo, asp.net core webapi + angular 9
TypeScript
1
star
31

WeihanLi.Templates

project templates for dotnet new
TypeScript
1
star
32

TechNotes

my tech notes about dotnet/arch
1
star
33

LeetCodeSolutions

LeetCodeSolutions powered by csharp
C#
1
star