Search a CodePlex project

Caching IOC wrapper for your interfaces

This is very simple to use. You can use it from your app or web config or in your code

For the app and web config add this to your confing
<section name="IocConfiguration" type="Ioc.Configuration.IocConfiguration, Ioc" />
<add Type="IocTests.ITestInter" InstanceType="IocTests.TestInter"IsMultipleInstances="False" IsDefault="False" IsCached="True" CacheHours="0" CacheMinutes="10" CacheSeconds="0" IsLocked="False"/>

Type= The Interface to use
InstanceType= the type to use for the interface
IsMultipleInstances= New instance every time the IOC is called
IsDefault= Default instance. You can override the IOC class in the code. If you do not then this type will be used
IsCached = Use cashing. This is only used it IsMultipleInstances=false
CacheHours= Hours to Cache
CacheMinutes= Minutes to Cache
CacheSeconds= Seconds to Cache
IsLocked= This type can not be changed once set.

to use in your code just call this method

ITestInter itester = Ioc.Container.GetInstance<ITestInter>();

To set in coded you can use and of the overloaded methods

The cache key is calculated by using tostring on each of the signature items. If you want to change how this key is calculated use Ioc.Attributes.CacheMethodInvalidateMethodNameAttribute on the parameter that you wish.

For caching function you can change the duration by using Ioc.Attributes.MethodCacheTimeAttribute on your method or property

You can cause the cache to clear by using Ioc.Attributes.CacheMethodInvalidateMethodNameAttribute(method name to clear) note the methods must have the same signature.

If you do not want a method or property to be cached use Ioc.Attributes,DoNotCacheMethodAttribute

Not affiliated with Microsoft and CodePlex
To remove your project or any question, please contact us: [email protected]