/// <summary>
 /// Helper method to find all suitable services using single type, known at compile time, as search criterion.
 /// </summary>
 /// <typeparam name="TService">The type of the service.</typeparam>
 /// <param name="ssp">The <see cref="StructureServiceProvider"/>.</param>
 /// <returns>All <see cref="ServiceReferenceInfo{T}"/>s matching search criterion.</returns>
 /// <exception cref="NullReferenceException">If <paramref name="ssp"/> is <c>null</c>.</exception>
 /// <remarks>
 /// See <see cref="StructureServiceProvider.FindServices(IEnumerable{Type})"/> method for more exception scenarios.
 /// </remarks>
 /// <seealso cref="StructureServiceProvider.FindServices(IEnumerable{Type})"/>
 /// <seealso cref="ServiceReferenceInfo{T}"/>
 public static IEnumerable <ServiceReferenceInfo <TService> > FindServices <TService>(this StructureServiceProvider ssp)
 {
     return(ssp.FindServices(typeof(TService).Singleton()).ToArray()
            .Select(sRef => new ServiceReferenceInfo <TService>(sRef)));
 }
 /// <summary>
 /// Helper method to find all suitable services using given type as search criterion.
 /// </summary>
 /// <param name="ssp">The <see cref="StructureServiceProvider"/>.</param>
 /// <param name="serviceType">The type of the service.</param>
 /// <returns>All <see cref="ServiceReference"/>s matching search criterion.</returns>
 /// <exception cref="NullReferenceException">If <paramref name="ssp"/> is <c>null</c>.</exception>
 /// <remarks>
 /// See <see cref="StructureServiceProvider.FindServices(IEnumerable{Type})"/> method for more exception scenarios.
 /// </remarks>
 /// <seealso cref="StructureServiceProvider.FindServices(IEnumerable{Type})"/>
 /// <seealso cref="ServiceReference"/>
 public static IEnumerable <ServiceReference> FindServices(this StructureServiceProvider ssp, Type serviceType)
 {
     return(ssp.FindServices(serviceType.Singleton()));
 }
 /// <summary>
 /// Helper method to find a first suitable <see cref="ServiceReferenceInfo{T}"/> using given type as search criterion.
 /// </summary>
 /// <param name="ssp">The <see cref="StructureServiceProvider"/>.</param>
 /// <param name="serviceType">The type of the service.</param>
 /// <returns>A first <see cref="ServiceReference"/> matching search criterion.</returns>
 /// <exception cref="NullReferenceException">If <paramref name="ssp"/> is <c>null</c>.</exception>
 /// <exception cref="InvalidOperationException">If no suitable services found.</exception>
 /// <remarks>
 /// See <see cref="StructureServiceProvider.FindServices(IEnumerable{Type})"/> method for more exception scenarios.
 /// </remarks>
 /// <seealso cref="StructureServiceProvider.FindServices(IEnumerable{Type})"/>
 /// <seealso cref="ServiceReference"/>
 public static ServiceReference FindService(this StructureServiceProvider ssp, Type serviceType)
 {
     return(ssp.FindServices(serviceType.Singleton()).First());
 }
 /// <summary>
 /// Helper method to find first suitable <see cref="ServiceReference"/> using given types as search criterion.
 /// </summary>
 /// <param name="ssp">The <see cref="StructureServiceProvider"/>.</param>
 /// <param name="serviceTypes">The types of the service.</param>
 /// <returns>A first <see cref="ServiceReference"/> matching search criterion.</returns>
 /// <exception cref="NullReferenceException">If <paramref name="ssp"/> is <c>null</c>.</exception>
 /// <exception cref="InvalidOperationException">If no suitable services found.</exception>
 /// <remarks>
 /// See <see cref="StructureServiceProvider.FindServices(IEnumerable{Type})"/> method for more exception scenarios.
 /// </remarks>
 /// <seealso cref="StructureServiceProvider.FindServices(IEnumerable{Type})"/>
 /// <seealso cref="ServiceReference"/>
 public static ServiceReference FindService(this StructureServiceProvider ssp, IEnumerable <Type> serviceTypes)
 {
     return(ssp.FindServices(serviceTypes).First());
 }
    // TODO implementing value composite model type should be done via extension
    //public static CompositeBuilderInfo<TComposite> NewValueBuilder<TComposite>( this StructureServiceProvider ssp )
    //{
    //   return ssp.NewCompositeBuilder<TComposite>( CompositeModelType.VALUE );
    //}

    //public static CompositeBuilder NewValueBuilder( this StructureServiceProvider ssp, Type compositeType )
    //{
    //   return ssp.NewCompositeBuilder( CompositeModelType.VALUE, compositeType.Singleton() );
    //}

    //public static CompositeBuilder NewValueBuilder( this StructureServiceProvider ssp, IEnumerable<Type> compositeTypes )
    //{
    //   return ssp.NewCompositeBuilder( CompositeModelType.VALUE, compositeTypes );
    //}

    /// <summary>
    /// Helper method to find a first suitable <see cref="ServiceReferenceInfo{T}"/> using given type, known at compile time, as search criterion.
    /// </summary>
    /// <typeparam name="TService">The type of the service.</typeparam>
    /// <param name="ssp">The <see cref="StructureServiceProvider"/>.</param>
    /// <returns>A first <see cref="ServiceReferenceInfo{T}"/> matching search criterion.</returns>
    /// <exception cref="NullReferenceException">If <paramref name="ssp"/> is <c>null</c>.</exception>
    /// <exception cref="InvalidOperationException">If no suitable services found.</exception>
    /// <remarks>
    /// See <see cref="StructureServiceProvider.FindServices(IEnumerable{Type})"/> method for more exception scenarios.
    /// </remarks>
    /// <seealso cref="StructureServiceProvider.FindServices(IEnumerable{Type})"/>
    /// <seealso cref="ServiceReferenceInfo{T}"/>
    public static ServiceReferenceInfo <TService> FindService <TService>(this StructureServiceProvider ssp)
    {
        return(ssp.FindServices <TService>().First());
    }