QinSoft.Ioc
2.0.3
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package QinSoft.Ioc --version 2.0.3
NuGet\Install-Package QinSoft.Ioc -Version 2.0.3
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.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add QinSoft.Ioc --version 2.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: QinSoft.Ioc, 2.0.3"
#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.3 // Install QinSoft.Ioc as a Cake Tool #tool nuget:?package=QinSoft.Ioc&version=2.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
QinSoft.Ioc
QinSoft框架下的依赖注入组件
1. 对象工厂
ObjectFactoryImp对象工厂实现
2. 对象容器
ObjectContainerImp对象容器实现
3. 依赖注入扫描
- AttributeDependencyInjectionScanerImp特性依赖注入扫描实现
- ComponentAttribute标识ioc依赖组件
- ConstructorAttribute标识ioc构造入口
- DependencyAttribute标识依赖注入点
4. Ioc应用程序
IocApplicationContext
5. 扩展类
- IocObjectContainerExtends
- IocObjectFactoryExtends
- 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>();
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 | Versions 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.
bug修复