服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
19 小时以前 a960900364d19bbf0ad7923a57989609e7fce798
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
/*生命周期枚举
 InstanceScope:
    InstancePerDependency:When you resolve a component that is instance per dependency, you get a new one each time.
    SingleInstance:When you resolve a single instance component, you always get the same instance no matter where you request it.
    InstancePerLifetimeScope:When you resolve the instance per lifetime scope component, you get a single instance per nested scope (e.g., per unit of work).
    InstancePerMatchingLifetimeScope:When you create a nested lifetime scope, you have the ability to “tag” or “name” the scope. A component with per-matching-lifetime scope will have at most a single instance per nested lifetime scope that matches a given name. This allows you to create a sort of “scoped singleton” where other nested lifetime scopes can share an instance of a component without declaring a global shared instance.
    InstancePerRequest:Instance per request builds on top of instance per matching lifetime scope by providing a well-known lifetime scope tag, a registration convenience method, and integration for common application types. Behind the scenes, though, it’s still just instance per matching lifetime scope.
    InstancePerOwned:The Owned<T> implicit relationship type creates new nested lifetime scopes. It is possible to scope dependencies to the owned instance using the instance-per-owned registrations.
    ThreadScope:Each thread executing through ThreadStart() will then get its own instance of MyThreadScopedComponent - which is essentially a “singleton” in the lifetime scope. Because scoped instances are never provided to outer scopes, it is easier to keep thread components separated.
*/
{
  "components": [
    {
      "type": "Tiger.Business.TestService,Tiger.Business",
      "services": [
        {
          "type": "Tiger.IBusiness.ITest,Tiger.IBusiness"
        }
      ],
      "autoActivate": true,
      "instanceScope": "SingleInstance", //生命周期
      "injectProperties": true
    },
    {
      "type": "Tiger.Business.MailServiceApi,Tiger.Business",
      "services": [
        {
          "type": "Tiger.IBusiness.IMailServiceApi,Tiger.IBusiness"
        }
      ],
      "autoActivate": true,
      "instanceScope": "SingleInstance", //生命周期
      "injectProperties": true
    },
    {
      "type": "Tiger.Business.WMS.WMS_ITEM_Biz+_Biz_WmsItem,Tiger.Business.WMS",
      "services": [ { "type": "Tiger.IBusiness.IBiz_WmsItem,Tiger.IBusiness.WMS" } ],
      "autoActivate": true,
      "injectProperties": true,
      "instanceScope": "SingleInstance" //生命周期
    },
    {
      "type": "Tiger.Business.Biz,Tiger.Business",
      "services": [ { "type": "Tiger.IBusiness.IBiz,Tiger.IBusiness" } ],
      "autoActivate": true,
      "injectProperties": true,
      "instanceScope": "SingleInstance" //生命周期
    },
    {
      "type": "Tiger.Business.Biz,Tiger.Business",
      "services": [ { "type": "Tiger.IBusiness.ILogin,Tiger.IBusiness" } ],
      "autoActivate": true,
      "injectProperties": true,
      "instanceScope": "SingleInstance" //生命周期
    },
    {
      "type": "Tiger.Business.Biz,Tiger.Business",
      "services": [ { "type": "Tiger.IBusiness.ISystem,Tiger.IBusiness" } ],
      "autoActivate": true,
      "injectProperties": true,
      "instanceScope": "SingleInstance" //生命周期
    },
    {
      "type": "Tiger.Business.Biz+Language,Tiger.Business",
      "services": [ { "type": "Tiger.IBusiness.ILanguage,Tiger.IBusiness" } ],
      "autoActivate": true,
      "injectProperties": true,
      "instanceScope": "SingleInstance" //生命周期
    },
    {
      "type": "Tiger.Business.WMS.BS,Tiger.Business.WMS",
      "services": [ { "type": "Tiger.IBusiness.IBS,Tiger.IBusiness.WMS" } ],
      "autoActivate": true,
      "injectProperties": true,
      "instanceScope": "SingleInstance" //生命周期
    },
    {
      "type": "Tiger.Business.WMS.iSRM,Tiger.Business.WMS",
      "services": [ { "type": "Tiger.IBusiness.IiSRM,Tiger.IBusiness.WMS" } ],
      "autoActivate": true,
      "injectProperties": true,
      "instanceScope": "SingleInstance" //生命周期
    },
    {
      "type": "Tiger.Business.WMS.KanBan,Tiger.Business.WMS",
      "services": [ { "type": "Tiger.IBusiness.IKanBan,Tiger.IBusiness.WMS" } ],
      "autoActivate": true,
      "injectProperties": true,
      "instanceScope": "SingleInstance" //生命周期
    },
    {
      "type": "Tiger.Business.WMS.AGV,Tiger.Business.WMS",
      "services": [ { "type": "Tiger.IBusiness.IAGV,Tiger.IBusiness.WMS" } ],
      "autoActivate": true,
      "injectProperties": true,
      "instanceScope": "SingleInstance" //生命周期
    },
    //{
    //  "type": "Tiger.Business.WMS.RePrintBarcode,Tiger.Business.WMS",
    //  "services": [ { "type": "Tiger.IBusiness.IRePrintBarcode,Tiger.IBusiness.WMS" } ],
    //  "autoActivate": true,
    //  "injectProperties": true,
    //  "instanceScope": "SingleInstance" //生命周期
    //},
    {
      "type": "Tiger.Business.BizContext,Tiger.Business",
      "services": [ { "type": "Tiger.IBusiness.IBizContext,Tiger.IBusiness" } ],
      "autoActivate": true,
      "injectProperties": true,
      "instanceScope": "SingleInstance" //生命周期
    },
    {
      "type": "Tiger.Business.WMS.WMSContext,Tiger.Business.WMS",
      "services": [ { "type": "Tiger.IBusiness.IWMSContext,Tiger.IBusiness.WMS" } ],
      "autoActivate": true,
      "injectProperties": true,
      "instanceScope": "SingleInstance" //生命周期
    },
    {
      "type": "Tiger.Business.WMS.iWMS,Tiger.Business.WMS",
      "services": [ { "type": "Tiger.IBusiness.IiWMS,Tiger.IBusiness.WMS" } ],
      "autoActivate": true,
      "injectProperties": true,
      "instanceScope": "SingleInstance" //生命周期
    },
    {
      "type": "Tiger.Business.WMS.ErpT100,Tiger.Business.WMS",
      "services": [ { "type": "Tiger.IBusiness.IErpT100,Tiger.IBusiness.WMS" } ],
      "autoActivate": true,
      "injectProperties": true,
      "instanceScope": "SingleInstance" //生命周期
    },
    {
      "type": "Tiger.Business.MonitorBus,Tiger.Business",
      "services": [ { "type": "Tiger.IBusiness.IMonitorBus,Tiger.IBusiness" } ],
      "autoActivate": true,
      "injectProperties": true,
      "instanceScope": "SingleInstance" //生命周期
    },
    //{
    //  "type": "Tiger.Business.DbCacheBus,Tiger.Business",
    //  "services": [ { "type": "Tiger.IBusiness.IDbCacheBus,Tiger.IBusiness" } ],
    //  "autoActivate": true,
    //  "injectProperties": true,
    //  "instanceScope": "SingleInstance" //生命周期
    //},
    {
      "type": "Tiger.Business.DbCache.CodeRuleCache,Tiger.Business",
      "services": [ { "type": "Tiger.IBusiness.ICodeRuleCache,Tiger.IBusiness" } ],
      "autoActivate": true,
      "injectProperties": true,
      "instanceScope": "SingleInstance" //生命周期
    },
    {
      "type": "Tiger.Business.DbCache.SysParamCache,Tiger.Business",
      "services": [ { "type": "Tiger.IBusiness.ISysParamCache,Tiger.IBusiness" } ],
      "autoActivate": true,
      "injectProperties": true,
      "instanceScope": "SingleInstance" //生命周期
    },
    {
      "type": "Tiger.Business.DbCache.MesDefectCache,Tiger.Business.MES",
      "services": [ { "type": "Tiger.IBusiness.IMesDefectCache,Tiger.IBusiness" } ],
      "autoActivate": true,
      "injectProperties": true,
      "instanceScope": "SingleInstance" //生命周期
    },
    {
      "type": "Tiger.Business.DbCache.MesPositionCache,Tiger.Business.MES",
      "services": [ { "type": "Tiger.IBusiness.IMesPositionCache,Tiger.IBusiness" } ],
      "autoActivate": true,
      "injectProperties": true,
      "instanceScope": "SingleInstance" //生命周期
    },
    {
      "type": "Tiger.Business.ServicesBus,Tiger.Business",
      "services": [ { "type": "Tiger.IBusiness.IServicesBus,Tiger.IBusiness" } ],
      "autoActivate": true,
      "injectProperties": true,
      "instanceScope": "SingleInstance" //生命周期
    }
  ]
}
/*生命周期枚举
 InstanceScope:
    InstancePerDependency:When you resolve a component that is instance per dependency, you get a new one each time.
    SingleInstance:When you resolve a single instance component, you always get the same instance no matter where you request it.
    InstancePerLifetimeScope:When you resolve the instance per lifetime scope component, you get a single instance per nested scope (e.g., per unit of work).
    InstancePerMatchingLifetimeScope:When you create a nested lifetime scope, you have the ability to “tag” or “name” the scope. A component with per-matching-lifetime scope will have at most a single instance per nested lifetime scope that matches a given name. This allows you to create a sort of “scoped singleton” where other nested lifetime scopes can share an instance of a component without declaring a global shared instance.
    InstancePerRequest:Instance per request builds on top of instance per matching lifetime scope by providing a well-known lifetime scope tag, a registration convenience method, and integration for common application types. Behind the scenes, though, it’s still just instance per matching lifetime scope.
    InstancePerOwned:The Owned<T> implicit relationship type creates new nested lifetime scopes. It is possible to scope dependencies to the owned instance using the instance-per-owned registrations.
    ThreadScope:Each thread executing through ThreadStart() will then get its own instance of MyThreadScopedComponent - which is essentially a “singleton” in the lifetime scope. Because scoped instances are never provided to outer scopes, it is easier to keep thread components separated.
*/