Exemple #1
0
    /// <summary>
    /// Realizes implementation of a contract by mediating access to a <see cref="DelegateIndex"/>
    /// </summary>
    /// <typeparam name="TContract">The type of realized contract</typeparam>
    /// <returns></returns>
    internal static TContract Realize <TContract>(string implementationName, DelegateIndex delegates)
    {
        var implementation = new DelegatedContract(implementationName, delegates);
        var type           = DynamicContractImplementor.ImplementContract <TContract>(implementationName);

        return((TContract)Activator.CreateInstance(type, implementation));
    }
 /// <summary>
 /// Emits the implementation defined by the builder and returns an intance of this implementation
 /// to the caller
 /// </summary>
 /// <returns></returns>
 public TContract Realize()
 => DelegatedContract.Realize <TContract>(typeof(TContract).Name + "Implementation", delegates);