|
Here[^]'s the repository link. In addition to the features from version 1.0, LinFu.IoC v2.0 supports the following features:
Constructor Injection using Fluent Interfaces.
This is what the code looked like in v1.0:
[Factory(typeof(IVehicle))]
public class CarFactory : IFactory<ivehicle>
{
public IVehicle CreateInstance(IContainer container)
{
IEngine engine = container.GetService<iengine>();
IPerson driver = container.GetService<iperson>();
Car newCar = new Car(engine, driver);
return newCar;
}
}
</iperson></iengine></ivehicle>
This is what it looks like in LinFu IoC 2.0:
container.Inject<ivehicle>()
.Using(ioc => new Car(ioc.GetService<iengine>(),
ioc.GetService<iperson>()))
.OncePerRequest();
</iperson></iengine></ivehicle>
Property Injection using Fluent Interfaces.
Here's the code in 1.0:
[Implements(typeof(IVehicle), LifecycleType.OncePerRequest)]
public class Car : IVehicle, IInitialize
{
public void Initialize(IContainer container)
{
_engine = container.GetService<iengine>();
_person = container.GetService<iperson>();
}
}
</iperson></iengine>
Here's the 2.0 code using Fluent Interfaces:
container.Inject<ivehicle>()
.Using(ioc => new Car(ioc.GetService<iengine>(),
ioc.GetService<iperson>()))
.OncePerRequest();
</iperson></iengine></ivehicle>
In addition, LinFu.IoC v2.0 has been outfitted with a battery of automated unit tests so you'll be able to test it with confidence. It has been rewritten from the ground up to support unit tests, and if you ever get lost in the code, you'll find that almost every class, interface, method, property and enum is filled to the brim with C# XML doc comments.
I'm currently in the process of rewriting the entire LinFu library, and this should give you an idea of where things are heading with LinFu in the future. I want to thank everyone in CP for their great feedback and support, and this is my way of giving back to the other CPians who taught me the value of writing good code. Again, thanks everyone
|
|
|
|
|
|
Hi,
i'm sorry, i cant access my thread for Article "Convert Query Result into *.CSV, *.TXT, *.XLS or Fill Into Crystal Report". Actually i have added the source code this morning. Please check it again on the below my articles.
Thank you.
http://www.wiltech-center.com
|
|
|
|