AOP through Unity interceptors - Compression
Today we are going to compress our data. We will still use AOP through Unity. The scenario is the following: we have a class generating a huge set of data (in our example, data structure is string). we don't want it to be kept in memory, because we will use it later, or not often. So one solution could be to compress this data & uncompress it once we will really need it. public interface IBigDataRepo { string GetData(); } public class BigDataRepo : IBigDataRepo { public string GetData() { return new string('X', 100000); } } We are going to use is this way: static void Main(string[] args) { using (var container = new UnityContainer()) { container.AddNewExtension<Interception>(); // Register container.RegisterType<IBigDataRepo, BigDataRepo>( new Interceptor<InterfaceInterceptor>(),