mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 14:03:29 -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
27
NzbDrone.Common/EnsureThat/Ensure.cs
Normal file
27
NzbDrone.Common/EnsureThat/Ensure.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace NzbDrone.Common.EnsureThat
|
||||
{
|
||||
public static class Ensure
|
||||
{
|
||||
public static Param<T> That<T>(T value, string name = Param.DefaultName)
|
||||
{
|
||||
return new Param<T>(name, value);
|
||||
}
|
||||
|
||||
public static Param<T> That<T>(Expression<Func<T>> expression)
|
||||
{
|
||||
var memberExpression = expression.GetRightMostMember();
|
||||
|
||||
return new Param<T>(
|
||||
memberExpression.ToPath(),
|
||||
expression.Compile().Invoke());
|
||||
}
|
||||
|
||||
public static TypeParam ThatTypeFor<T>(T value, string name = Param.DefaultName)
|
||||
{
|
||||
return new TypeParam(name, value.GetType());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue