/// <summary> /// Creates a new object of type <typeparamref name="TObject"/> and /// adds interception as needed to match the policies specified in /// the default policy configuration. /// </summary> /// <typeparam name="TObject">Concrete object type to create.</typeparam> /// <typeparam name="TInterface">Type of reference to return. Must be an interface the object implements.</typeparam> /// <param name="args">Arguments to pass to the <typeparamref name="TObject"/> constructor.</param> /// <returns>The intercepted object (or possibly a raw instance if no policies apply).</returns> public static TInterface Create <TObject, TInterface>(params object[] args) { return(DefaultPolicyInjector.Create <TObject, TInterface>(args)); }
/// <summary> /// Creates a proxy for the given object that adds interception policies as /// defined in the default configuration source. /// </summary> /// <remarks> /// Despite the name of the <typeparamref name="TInterface"/> parameter, this /// may be any type that the instance is assignable to, including both interfaces /// that it implements and the concrete type of the object. /// </remarks> /// <typeparam name="TInterface">Type of the proxy to return.</typeparam> /// <param name="instance">Instance object to wrap.</param> /// <returns>The proxy for the instance, or the raw object if no policies apply.</returns> public static TInterface Wrap <TInterface>(object instance) { return(DefaultPolicyInjector.Wrap <TInterface>(instance)); }
/// <summary> /// Creates a new object of type <typeparamref name="TObject"/> and /// adds interception as needed to match the policies specified in /// the default policy configuration. /// </summary> /// <typeparam name="TObject">Type of object to create.</typeparam> /// <param name="args">Arguments to pass to the <typeparamref name="TObject"/> constructor.</param> /// <returns>The intercepted object (or possibly a raw instance if no policies apply).</returns> public static TObject Create <TObject>(params object[] args) { return(DefaultPolicyInjector.Create <TObject>(args)); }