QinSoft.Ioc 2.0.4

dotnet add package QinSoft.Ioc --version 2.0.4
NuGet\Install-Package QinSoft.Ioc -Version 2.0.4
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="QinSoft.Ioc" Version="2.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add QinSoft.Ioc --version 2.0.4
#r "nuget: QinSoft.Ioc, 2.0.4"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install QinSoft.Ioc as a Cake Addin
#addin nuget:?package=QinSoft.Ioc&version=2.0.4

// Install QinSoft.Ioc as a Cake Tool
#tool nuget:?package=QinSoft.Ioc&version=2.0.4

QinSoft.Ioc

QinSoft框架下的依赖注入组件

1. 对象工厂

ObjectFactoryImp对象工厂实现

2. 对象容器

ObjectContainerImp对象容器实现

3. 依赖注入扫描

  1. AttributeDependencyInjectionScanerImp特性依赖注入扫描实现
  2. ComponentAttribute标识ioc依赖组件
  3. ConstructorAttribute标识ioc构造入口
  4. DependencyAttribute标识依赖注入点

4. Ioc应用程序

IocApplicationContext

5. 扩展类

  1. IocObjectContainerExtends
  2. IocObjectFactoryExtends
  3. TypeExtends

5. 测试(使用)案例

   [TestClass]
    public class IocTest
    {
        [TestMethod]
        public void TestObjectFactoryImp()
        {
            ObjectFactoryImp objectFactory = new ObjectFactoryImp();
            TestClassA testClassA = objectFactory.CreateInstance<TestClassA>();
            Assert.IsNotNull(testClassA);
        }

        [TestMethod]
        public void TestObjectContainerImp()
        {
            ObjectContainer objectContainer = new ObjectContainerImp(new ObjectFactoryImp(), new AttributeDependencyInjectionScanerImp());
            TestClassB testClassB = objectContainer.Get(typeof(TestClassBB)) as TestClassBB;
            TestClassB testClassB2 = objectContainer.Get(typeof(TestClassBB)) as TestClassBB;
            Assert.AreEqual(testClassB, testClassB2);
        }

        [TestMethod]
        public void TestIocApplicationContext()
        {
            IocApplicationContext applicationContext = new IocApplicationContext();
            ObjectContainer objectContainer = applicationContext
                .RegisterObjectFactory<ObjectFactoryImp>()
                .RegisterDependencyInjectionScaner<AttributeDependencyInjectionScanerImp>()
                .BuildObjectContainer<ObjectContainerImp>().ObjectContainer;
            TestClassB testClassB = objectContainer.Get<TestClassBB>();
            TestClassB testClassB2 = objectContainer.Get<TestClassBB>();
            Assert.AreEqual(testClassB, testClassB2);
        }
    }

    [Component]
    public class TestClassA
    {
        [ConfigDependency("Arg1")]
        public int P1 { get; private set; }

        [ConfigDependency("Arg2")]
        public string P2 { get; private set; }
    }

    public abstract class TestClassB
    {
        [ComponentDependency]
        private TestClassA classA { get; set; }

        [ComponentDependency]
        private TestClassA classAA;

        public abstract string DoSomething();
    }

    [Component]
    public class TestClassBB : TestClassB
    {
        public override string DoSomething()
        {
            return "test";
        }
    }
Product Compatible and additional computed target framework versions.
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on QinSoft.Ioc:

Package Downloads
QinSoft.ServiceSchedule

服务调度组件 v1.0.0

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.4 775 6/19/2020
2.0.3 411 3/12/2020
2.0.2 697 3/10/2020
2.0.1 425 2/24/2020
2.0.0 483 2/19/2020

bug修复