DependencyInjection.Annotation icon indicating copy to clipboard operation
DependencyInjection.Annotation copied to clipboard

通过特性标注自动注入属性

Open ShmilyChen opened this issue 2 years ago • 3 comments

类似Java中Spring的@Autowired自动注入属性,标注后通过生成构造方法完成注入

ShmilyChen avatar Aug 29 '23 14:08 ShmilyChen

这个需求,在多构造器的c#类型里,会违背c#的Nullable语言特性。

xljiulang avatar Sep 04 '23 06:09 xljiulang

那是否有其他方法可以实现这个需求呢

ShmilyChen avatar Sep 04 '23 13:09 ShmilyChen

个人觉得不是有必要,因为手写字段(或属性)再声明特性,反而都没有直接写构造器轻松

xljiulang avatar Sep 05 '23 01:09 xljiulang