mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
upgraded to autofac 3. created nancy only mode for nzbdrone.exe /n
This commit is contained in:
parent
177f88303c
commit
b0940ed8de
77 changed files with 3930 additions and 113 deletions
67
NzbDrone.Common/EnsureThat/EnsureCollectionExtensions.cs
Normal file
67
NzbDrone.Common/EnsureThat/EnsureCollectionExtensions.cs
Normal file
|
@ -0,0 +1,67 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using NzbDrone.Common.EnsureThat.Resources;
|
||||
|
||||
namespace NzbDrone.Common.EnsureThat
|
||||
{
|
||||
public static class EnsureCollectionExtensions
|
||||
{
|
||||
[DebuggerStepThrough]
|
||||
public static Param<T> HasItems<T>(this Param<T> param) where T : class, ICollection
|
||||
{
|
||||
if (param.Value == null || param.Value.Count < 1)
|
||||
throw ExceptionFactory.CreateForParamValidation(param.Name, ExceptionMessages.EnsureExtensions_IsEmptyCollection);
|
||||
|
||||
return param;
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static Param<Collection<T>> HasItems<T>(this Param<Collection<T>> param)
|
||||
{
|
||||
if (param.Value == null || param.Value.Count < 1)
|
||||
throw ExceptionFactory.CreateForParamValidation(param.Name, ExceptionMessages.EnsureExtensions_IsEmptyCollection);
|
||||
|
||||
return param;
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static Param<IEnumerable<T>> HasItems<T>(this Param<IEnumerable<T>> param)
|
||||
{
|
||||
if (param.Value == null || !param.Value.Any())
|
||||
throw ExceptionFactory.CreateForParamValidation(param.Name, ExceptionMessages.EnsureExtensions_IsEmptyCollection);
|
||||
|
||||
return param;
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static Param<T[]> HasItems<T>(this Param<T[]> param)
|
||||
{
|
||||
if (param.Value == null || param.Value.Length < 1)
|
||||
throw ExceptionFactory.CreateForParamValidation(param.Name, ExceptionMessages.EnsureExtensions_IsEmptyCollection);
|
||||
|
||||
return param;
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static Param<List<T>> HasItems<T>(this Param<List<T>> param)
|
||||
{
|
||||
if (param.Value == null || param.Value.Count < 1)
|
||||
throw ExceptionFactory.CreateForParamValidation(param.Name, ExceptionMessages.EnsureExtensions_IsEmptyCollection);
|
||||
|
||||
return param;
|
||||
}
|
||||
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static Param<IDictionary<TKey, TValue>> HasItems<TKey, TValue>(this Param<IDictionary<TKey, TValue>> param)
|
||||
{
|
||||
if (param.Value == null || param.Value.Count < 1)
|
||||
throw ExceptionFactory.CreateForParamValidation(param.Name, ExceptionMessages.EnsureExtensions_IsEmptyCollection);
|
||||
|
||||
return param;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue