Skip to content

Free user from IocGenericFactoryAttribute, IocInjectAttribute #6

@AndyElessar

Description

@AndyElessar

Free user from IocGenericFactoryAttribute and IocInjectAttribute

Motivation

At version 0.9.4-alpha, IocGenericFactoryAttribute and IocInjectAttribute need mark on members to hint source generator.
We should free user from using SourceGen.Ioc attributes in their code before release 1.0.0.

Design

  • Type[] GenericFactoryTypeMapping: same functionality as IocGenericFactoryAttribute(params Type[] genericTypeMap)
  • object[] InjectMembers
    • [nameof(prop), nameof(field), nameof(method)] for ordinary service inject
    • [new object[] { nameof(prop), MyEnum.Key }] for keyed service inject
    • [new object[] { nameof(prop), nameof(MyClass.StaticField), KeyType.Csharp }] for KeyType.Csharp inejct

Todo

  • IocRegisterForAttribute add arguments: GenericFactoryTypeMapping, InjectMembers.
  • IocRegisterDefaultsAttribute add argument: GenericFactoryTypeMapping
  • Optional: remove IocGenericFactoryAttribute avoid duplicated

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestiocSourceGen.Ioc releated issues

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions