/src/LinFu.Proxy.Interfaces/IProxyCache.cs

http://github.com/philiplaureano/LinFu · C# · 40 lines · 10 code · 3 blank · 27 comment · 0 complexity · 372af6359219797591dc6246035c3837 MD5 · raw file

  1. using System;
  2. namespace LinFu.Proxy.Interfaces
  3. {
  4. /// <summary>
  5. /// Represents an interface for classes that store results from an
  6. /// <see cref="IProxyFactory" /> instance.
  7. /// </summary>
  8. public interface IProxyCache
  9. {
  10. /// <summary>
  11. /// Determines whether or not the cache contains an existing proxy type
  12. /// that is derived from the <paramref name="baseType" /> and implements
  13. /// the given <paramref name="baseInterfaces" />.
  14. /// </summary>
  15. /// <param name="baseType">The base type of the dynamically-generated proxy type.</param>
  16. /// <param name="baseInterfaces">The list of interfaces that the generated proxy type must implement.</param>
  17. /// <returns>Returns <c>true</c> if the proxy type already exists; otherwise, it will return <c>false.</c></returns>
  18. bool Contains(Type baseType, params Type[] baseInterfaces);
  19. /// <summary>
  20. /// Retrieves an existing proxy type from the cache.
  21. /// </summary>
  22. /// <param name="baseType">The base type of the dynamically-generated proxy type.</param>
  23. /// <param name="baseInterfaces">The list of interfaces that the generated proxy type must implement.</param>
  24. /// <returns>
  25. /// Returns a valid <see cref="Type" /> if the type already exists; otherwise, it might return <c>null</c> or opt
  26. /// to throw an exception.
  27. /// </returns>
  28. Type Get(Type baseType, params Type[] baseInterfaces);
  29. /// <summary>
  30. /// Stores a proxy type in the cache.
  31. /// </summary>
  32. /// <param name="result">The proxy type to be stored.</param>
  33. /// <param name="baseType">The base type of the dynamically-generated proxy type.</param>
  34. /// <param name="baseInterfaces">The list of interfaces that the generated proxy type must implement.</param>
  35. void Store(Type result, Type baseType, params Type[] baseInterfaces);
  36. }
  37. }