-
Notifications
You must be signed in to change notification settings - Fork 10
/
Program.cs
57 lines (52 loc) · 1.32 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
namespace Use_Dependency_Injection_With_Factory_Pattern
{
class Program
{
static void Main(string[] args)
{
Demo1.Run();
Demo2.Run();
Demo3.Run();
Demo4.Run();
Demo5.Run();
}
}
/// <summary>
/// 发送短信
/// </summary>
public interface ISmsSender
{
/// <summary>
/// 发送短信
/// </summary>
/// <param name="phone">手机</param>
/// <param name="message">短信 </param>
void Send(string phone, string message);
}
/// <summary>
/// 用户业务
/// </summary>
public interface IUserBll
{
/// <summary>
/// 登录
/// </summary>
/// <param name="phone"></param>
/// <param name="password"></param>
bool Login(string phone, string password);
}
public interface IUserDal
{
bool Exists(string phone, string password);
}
public class UserDal : IUserDal
{
private const string StaticPassword = "newbe";
private const string StaticPhone = "yueluo";
public bool Exists(string phone, string password)
{
// 使用固定的账号密码验证
return phone == StaticPhone && password == StaticPassword;
}
}
}