Example #1
0
        /// <summary>
        /// Create mixin for target class using constructor arguments.
        /// Usefull for abstract classes.
        /// </summary>
        /// <typeparam name="TMixin">target instance</typeparam>
        /// <param name="provider">mixin service</param>
        /// <param name="type">target class</param>
        /// <param name="args">constructor arguments</param>
        /// <returns>object instance</returns>
        public static TMixin Create <TMixin>(this IMixinProvider provider, Type type, object[] args)
        {
            Contract.Requires(provider != null);

            return((TMixin)provider.Create(type, args, new object[0]));
        }
Example #2
0
        /// <summary>
        /// Create mixin for target class using provided instances and constructor arguments.
        /// </summary>
        /// <typeparam name="TMixin">target class</typeparam>
        /// <param name="provider">mixin service</param>
        /// <param name="implementations">additional mixins</param>
        /// <param name="args">constructor arguments</param>
        /// <returns>object instance with merged mixins</returns>
        public static TMixin Create <TMixin>(this IMixinProvider provider, IEnumerable <object> implementations, params object[] args)
        {
            Contract.Requires(provider != null);

            return((TMixin)provider.Create(typeof(TMixin), args, implementations));
        }