mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
VS code cleanup: Apply auto property preferences
This commit is contained in:
@@ -4,15 +4,13 @@ namespace NHibernate.Linq.Expressions
|
||||
{
|
||||
public class CollectionAccessExpression : PropertyAccessExpression
|
||||
{
|
||||
private readonly EntityExpression _elementExpression;
|
||||
|
||||
public EntityExpression ElementExpression => _elementExpression;
|
||||
public EntityExpression ElementExpression { get; }
|
||||
|
||||
public CollectionAccessExpression(string name, System.Type type, IType nhibernateType,
|
||||
EntityExpression expression, EntityExpression elementExpression)
|
||||
: base(name, type, nhibernateType, expression, NHibernateExpressionType.CollectionAccess)
|
||||
{
|
||||
_elementExpression = elementExpression;
|
||||
ElementExpression = elementExpression;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,26 +5,21 @@ namespace NHibernate.Linq.Expressions
|
||||
{
|
||||
public class EntityExpression : NHibernateExpression
|
||||
{
|
||||
private readonly string _alias;
|
||||
private readonly string _associationPath;
|
||||
private readonly IClassMetadata _metaData;
|
||||
private readonly Expression _expression;
|
||||
public string Alias { get; }
|
||||
|
||||
public string Alias => _alias;
|
||||
public string AssociationPath { get; }
|
||||
|
||||
public string AssociationPath => _associationPath;
|
||||
public IClassMetadata MetaData { get; }
|
||||
|
||||
public IClassMetadata MetaData => _metaData;
|
||||
|
||||
public Expression Expression => _expression;
|
||||
public Expression Expression { get; }
|
||||
|
||||
public EntityExpression(string associationPath, string alias, System.Type type, IClassMetadata metaData, Expression expression)
|
||||
: base(IsRoot(expression) ? NHibernateExpressionType.RootEntity : NHibernateExpressionType.Entity, type)
|
||||
{
|
||||
_associationPath = associationPath;
|
||||
_alias = alias;
|
||||
_metaData = metaData;
|
||||
_expression = expression;
|
||||
AssociationPath = associationPath;
|
||||
Alias = alias;
|
||||
MetaData = metaData;
|
||||
Expression = expression;
|
||||
}
|
||||
|
||||
private static bool IsRoot(Expression expr)
|
||||
|
||||
@@ -5,15 +5,11 @@ namespace NHibernate.Linq.Expressions
|
||||
{
|
||||
public class PropertyAccessExpression : NHibernateExpression
|
||||
{
|
||||
private readonly string _name;
|
||||
private readonly EntityExpression _expression;
|
||||
private readonly IType _nhibernateType;
|
||||
public string Name { get; }
|
||||
|
||||
public string Name => _name;
|
||||
public EntityExpression Expression { get; }
|
||||
|
||||
public EntityExpression Expression => _expression;
|
||||
|
||||
public IType NHibernateType => _nhibernateType;
|
||||
public IType NHibernateType { get; }
|
||||
|
||||
public PropertyAccessExpression(string name, System.Type type, IType nhibernateType, EntityExpression expression)
|
||||
: this(name, type, nhibernateType, expression, NHibernateExpressionType.PropertyAccess) { }
|
||||
@@ -26,9 +22,9 @@ namespace NHibernate.Linq.Expressions
|
||||
if (nhibernateType == null) throw new ArgumentNullException("nhibernateType");
|
||||
if (expression == null) throw new ArgumentNullException("expression");
|
||||
|
||||
_name = name;
|
||||
_expression = expression;
|
||||
_nhibernateType = nhibernateType;
|
||||
Name = name;
|
||||
Expression = expression;
|
||||
NHibernateType = nhibernateType;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
||||
@@ -4,13 +4,11 @@ namespace NHibernate.Linq.Expressions
|
||||
{
|
||||
public class QuerySourceExpression : NHibernateExpression
|
||||
{
|
||||
private readonly string _alias;
|
||||
private readonly IQueryable _query;
|
||||
private readonly System.Type _elementType;
|
||||
|
||||
public string Alias => _alias;
|
||||
public string Alias { get; }
|
||||
|
||||
public IQueryable Query => _query;
|
||||
public IQueryable Query { get; }
|
||||
|
||||
public System.Type ElementType => _elementType ?? Query.ElementType;
|
||||
|
||||
@@ -20,8 +18,8 @@ namespace NHibernate.Linq.Expressions
|
||||
public QuerySourceExpression(string alias, IQueryable query, System.Type elementType)
|
||||
: base(NHibernateExpressionType.QuerySource, query.GetType())
|
||||
{
|
||||
_alias = alias;
|
||||
_query = query;
|
||||
Alias = alias;
|
||||
Query = query;
|
||||
_elementType = elementType;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,14 +13,13 @@ namespace NHibernate.Linq
|
||||
{
|
||||
private readonly QueryProvider provider;
|
||||
private readonly Expression expression;
|
||||
private readonly QueryOptions queryOptions;
|
||||
|
||||
public Query(QueryProvider provider, QueryOptions queryOptions)
|
||||
{
|
||||
if (provider == null) throw new ArgumentNullException("provider");
|
||||
|
||||
this.provider = provider;
|
||||
this.queryOptions = queryOptions;
|
||||
this.QueryOptions = queryOptions;
|
||||
this.expression = Expression.Constant(this);
|
||||
}
|
||||
|
||||
@@ -33,7 +32,7 @@ namespace NHibernate.Linq
|
||||
throw new ArgumentOutOfRangeException("expression");
|
||||
|
||||
this.provider = provider;
|
||||
this.queryOptions = queryOptions;
|
||||
this.QueryOptions = queryOptions;
|
||||
this.expression = expression;
|
||||
}
|
||||
|
||||
@@ -43,11 +42,11 @@ namespace NHibernate.Linq
|
||||
|
||||
IQueryProvider IQueryable.Provider => this.provider;
|
||||
|
||||
public QueryOptions QueryOptions => queryOptions;
|
||||
public QueryOptions QueryOptions { get; }
|
||||
|
||||
public IQueryable<T> Expand(string path)
|
||||
{
|
||||
queryOptions.AddExpansion(path);
|
||||
QueryOptions.AddExpansion(path);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,6 @@ namespace NHibernate.Linq.Transform
|
||||
/// <typeparam name="TElement"></typeparam>
|
||||
internal class Grouping<TKey, TElement> : IGrouping<TKey, TElement>, IGrouping
|
||||
{
|
||||
private readonly TKey key;
|
||||
private readonly IList<TElement> list = new List<TElement>();
|
||||
|
||||
/// <summary>
|
||||
@@ -107,7 +106,7 @@ namespace NHibernate.Linq.Transform
|
||||
/// <param name="key"></param>
|
||||
public Grouping(TKey key)
|
||||
{
|
||||
this.key = key;
|
||||
this.Key = key;
|
||||
}
|
||||
|
||||
#region IGrouping Members
|
||||
@@ -128,7 +127,7 @@ namespace NHibernate.Linq.Transform
|
||||
/// <summary>
|
||||
/// Gets the key of the <see cref="T:System.Linq.IGrouping`2"/>.
|
||||
/// </summary>
|
||||
public TKey Key => key;
|
||||
public TKey Key { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that iterates through the collection.
|
||||
|
||||
@@ -20,33 +20,30 @@ namespace NHibernate.Linq.Util
|
||||
|
||||
public class DetachedCriteriaAdapter : ICriteria
|
||||
{
|
||||
private readonly DetachedCriteria detachedCriteria;
|
||||
private readonly ISession session;
|
||||
|
||||
public DetachedCriteriaAdapter(DetachedCriteria detachedCriteria, ISession session)
|
||||
{
|
||||
this.detachedCriteria = detachedCriteria;
|
||||
this.session = session;
|
||||
this.DetachedCriteria = detachedCriteria;
|
||||
this.Session = session;
|
||||
}
|
||||
|
||||
public DetachedCriteria DetachedCriteria => detachedCriteria;
|
||||
public DetachedCriteria DetachedCriteria { get; }
|
||||
|
||||
public ISession Session => session;
|
||||
public ISession Session { get; }
|
||||
|
||||
#region ICriteria Members
|
||||
|
||||
public IProjection Projection => null;
|
||||
public ICriteria Add(ICriterion expression)
|
||||
{
|
||||
return detachedCriteria.Add(expression).Adapt(session);
|
||||
return DetachedCriteria.Add(expression).Adapt(Session);
|
||||
}
|
||||
|
||||
public ICriteria AddOrder(Order order)
|
||||
{
|
||||
return detachedCriteria.AddOrder(order).Adapt(session);
|
||||
return DetachedCriteria.AddOrder(order).Adapt(Session);
|
||||
}
|
||||
|
||||
public string Alias => detachedCriteria.Alias;
|
||||
public string Alias => DetachedCriteria.Alias;
|
||||
|
||||
public void ClearOrderds()
|
||||
{
|
||||
@@ -55,12 +52,12 @@ namespace NHibernate.Linq.Util
|
||||
|
||||
public ICriteria CreateAlias(string associationPath, string alias, JoinType joinType)
|
||||
{
|
||||
return detachedCriteria.CreateAlias(associationPath, alias, joinType).Adapt(session);
|
||||
return DetachedCriteria.CreateAlias(associationPath, alias, joinType).Adapt(Session);
|
||||
}
|
||||
|
||||
public ICriteria CreateAlias(string associationPath, string alias)
|
||||
{
|
||||
return detachedCriteria.CreateAlias(associationPath, alias).Adapt(session);
|
||||
return DetachedCriteria.CreateAlias(associationPath, alias).Adapt(Session);
|
||||
}
|
||||
|
||||
public ICriteria CreateAlias(string associationPath, string alias, JoinType joinType, ICriterion withClause)
|
||||
@@ -70,17 +67,17 @@ namespace NHibernate.Linq.Util
|
||||
|
||||
public ICriteria CreateCriteria(string associationPath, string alias, JoinType joinType)
|
||||
{
|
||||
return detachedCriteria.CreateCriteria(associationPath, alias, joinType).Adapt(session);
|
||||
return DetachedCriteria.CreateCriteria(associationPath, alias, joinType).Adapt(Session);
|
||||
}
|
||||
|
||||
public ICriteria CreateCriteria(string associationPath, string alias)
|
||||
{
|
||||
return detachedCriteria.CreateCriteria(associationPath, alias).Adapt(session);
|
||||
return DetachedCriteria.CreateCriteria(associationPath, alias).Adapt(Session);
|
||||
}
|
||||
|
||||
public ICriteria CreateCriteria(string associationPath, JoinType joinType)
|
||||
{
|
||||
return detachedCriteria.CreateCriteria(associationPath, joinType).Adapt(session);
|
||||
return DetachedCriteria.CreateCriteria(associationPath, joinType).Adapt(Session);
|
||||
}
|
||||
|
||||
public ICriteria CreateCriteria(string associationPath, string alias, JoinType joinType, ICriterion withClause)
|
||||
@@ -90,17 +87,17 @@ namespace NHibernate.Linq.Util
|
||||
|
||||
public ICriteria CreateCriteria(string associationPath)
|
||||
{
|
||||
return detachedCriteria.CreateCriteria(associationPath).Adapt(session);
|
||||
return DetachedCriteria.CreateCriteria(associationPath).Adapt(Session);
|
||||
}
|
||||
|
||||
public ICriteria GetCriteriaByAlias(string alias)
|
||||
{
|
||||
return detachedCriteria.GetCriteriaByAlias(alias).Adapt(session);
|
||||
return DetachedCriteria.GetCriteriaByAlias(alias).Adapt(Session);
|
||||
}
|
||||
|
||||
public ICriteria GetCriteriaByPath(string path)
|
||||
{
|
||||
return detachedCriteria.GetCriteriaByPath(path).Adapt(session);
|
||||
return DetachedCriteria.GetCriteriaByPath(path).Adapt(Session);
|
||||
}
|
||||
|
||||
public IList<T> List<T>()
|
||||
@@ -120,7 +117,7 @@ namespace NHibernate.Linq.Util
|
||||
|
||||
public ICriteria SetCacheMode(CacheMode cacheMode)
|
||||
{
|
||||
return detachedCriteria.SetCacheMode(cacheMode).Adapt(session);
|
||||
return DetachedCriteria.SetCacheMode(cacheMode).Adapt(Session);
|
||||
}
|
||||
|
||||
public ICriteria SetCacheRegion(string cacheRegion)
|
||||
@@ -141,7 +138,7 @@ namespace NHibernate.Linq.Util
|
||||
[Obsolete("Use Fetch instead")]
|
||||
public ICriteria SetFetchMode(string associationPath, FetchMode mode)
|
||||
{
|
||||
return detachedCriteria.SetFetchMode(associationPath, mode).Adapt(session);
|
||||
return DetachedCriteria.SetFetchMode(associationPath, mode).Adapt(Session);
|
||||
}
|
||||
|
||||
public ICriteria SetFetchSize(int fetchSize)
|
||||
@@ -151,7 +148,7 @@ namespace NHibernate.Linq.Util
|
||||
|
||||
public ICriteria SetFirstResult(int firstResult)
|
||||
{
|
||||
return detachedCriteria.SetFirstResult(firstResult).Adapt(session);
|
||||
return DetachedCriteria.SetFirstResult(firstResult).Adapt(Session);
|
||||
}
|
||||
|
||||
public ICriteria SetFlushMode(FlushMode flushMode)
|
||||
@@ -171,12 +168,12 @@ namespace NHibernate.Linq.Util
|
||||
|
||||
public ICriteria SetMaxResults(int maxResults)
|
||||
{
|
||||
return detachedCriteria.SetMaxResults(maxResults).Adapt(session);
|
||||
return DetachedCriteria.SetMaxResults(maxResults).Adapt(Session);
|
||||
}
|
||||
|
||||
public ICriteria SetProjection(IProjection projection)
|
||||
{
|
||||
return detachedCriteria.SetProjection(projection).Adapt(session);
|
||||
return DetachedCriteria.SetProjection(projection).Adapt(Session);
|
||||
}
|
||||
|
||||
public ICriteria SetProjection(params IProjection[] projections)
|
||||
@@ -185,12 +182,12 @@ namespace NHibernate.Linq.Util
|
||||
foreach (var proj in projections)
|
||||
projectionList.Add(proj);
|
||||
|
||||
return detachedCriteria.SetProjection(projectionList).Adapt(session);
|
||||
return DetachedCriteria.SetProjection(projectionList).Adapt(Session);
|
||||
}
|
||||
|
||||
public ICriteria SetResultTransformer(IResultTransformer resultTransformer)
|
||||
{
|
||||
return detachedCriteria.SetResultTransformer(resultTransformer).Adapt(session);
|
||||
return DetachedCriteria.SetResultTransformer(resultTransformer).Adapt(Session);
|
||||
}
|
||||
|
||||
public ICriteria SetTimeout(int timeout)
|
||||
@@ -210,12 +207,12 @@ namespace NHibernate.Linq.Util
|
||||
|
||||
public System.Type GetRootEntityTypeIfAvailable()
|
||||
{
|
||||
return detachedCriteria.GetRootEntityTypeIfAvailable();
|
||||
return DetachedCriteria.GetRootEntityTypeIfAvailable();
|
||||
}
|
||||
|
||||
public void ClearOrders()
|
||||
{
|
||||
detachedCriteria.ClearOrders();
|
||||
DetachedCriteria.ClearOrders();
|
||||
}
|
||||
|
||||
public IEnumerable<T> Future<T>()
|
||||
@@ -269,17 +266,15 @@ namespace NHibernate.Linq.Util
|
||||
#endregion
|
||||
|
||||
|
||||
private bool _readOnly;
|
||||
private bool _readOnlyInitialized;
|
||||
|
||||
public bool IsReadOnly => _readOnly;
|
||||
public bool IsReadOnly { get; private set; }
|
||||
|
||||
public bool IsReadOnlyInitialized => _readOnlyInitialized;
|
||||
public bool IsReadOnlyInitialized { get; private set; }
|
||||
|
||||
public ICriteria SetReadOnly(bool readOnly)
|
||||
{
|
||||
_readOnly = readOnly;
|
||||
_readOnlyInitialized = true;
|
||||
IsReadOnly = readOnly;
|
||||
IsReadOnlyInitialized = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@ namespace NHibernate.Linq.Visitors
|
||||
{
|
||||
private readonly ICriteria rootCriteria;
|
||||
private readonly bool createCriteriaForCollections;
|
||||
private ICriteria currentCriteria;
|
||||
private Expression currentExpression;
|
||||
private StringBuilder memberNameBuilder;
|
||||
private string currentAssociationPath;
|
||||
private bool isQueringEntity;
|
||||
@@ -33,16 +31,16 @@ namespace NHibernate.Linq.Visitors
|
||||
}
|
||||
}
|
||||
|
||||
public ICriteria CurrentCriteria => currentCriteria;
|
||||
public ICriteria CurrentCriteria { get; private set; }
|
||||
|
||||
public Expression CurrentExpression => currentExpression;
|
||||
public Expression CurrentExpression { get; private set; }
|
||||
|
||||
public MemberNameVisitor(ICriteria criteria)
|
||||
: this(criteria, false) { }
|
||||
|
||||
public MemberNameVisitor(ICriteria criteria, bool createCriteriaForCollections)
|
||||
{
|
||||
this.rootCriteria = this.currentCriteria = criteria;
|
||||
this.rootCriteria = this.CurrentCriteria = criteria;
|
||||
this.createCriteriaForCollections = createCriteriaForCollections;
|
||||
this.memberNameBuilder = new StringBuilder();
|
||||
}
|
||||
@@ -56,9 +54,9 @@ namespace NHibernate.Linq.Visitors
|
||||
private ICriteria EnsureCriteria(string associationPath, string alias)
|
||||
{
|
||||
ICriteria criteria;
|
||||
if ((criteria = currentCriteria.GetCriteriaByAlias(alias)) == null)
|
||||
if ((criteria = CurrentCriteria.GetCriteriaByAlias(alias)) == null)
|
||||
{
|
||||
criteria = currentCriteria.CreateCriteria(associationPath, alias, JoinType.LeftOuterJoin);
|
||||
criteria = CurrentCriteria.CreateCriteria(associationPath, alias, JoinType.LeftOuterJoin);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
@@ -80,15 +78,15 @@ namespace NHibernate.Linq.Visitors
|
||||
{
|
||||
expr = (EntityExpression)base.VisitEntity(expr);
|
||||
|
||||
if (currentCriteria.GetCriteriaByAlias(expr.Alias) != null || !IsRootEntity(expr))
|
||||
if (CurrentCriteria.GetCriteriaByAlias(expr.Alias) != null || !IsRootEntity(expr))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(expr.AssociationPath))
|
||||
currentCriteria = EnsureCriteria(expr.AssociationPath, expr.Alias);
|
||||
CurrentCriteria = EnsureCriteria(expr.AssociationPath, expr.Alias);
|
||||
|
||||
ResetMemberName(expr.Alias + ".");
|
||||
}
|
||||
currentAssociationPath = expr.AssociationPath;
|
||||
currentExpression = expr;
|
||||
CurrentExpression = expr;
|
||||
isQueringEntity = true;
|
||||
|
||||
return expr;
|
||||
@@ -99,7 +97,7 @@ namespace NHibernate.Linq.Visitors
|
||||
expr = (PropertyAccessExpression)base.VisitPropertyAccess(expr);
|
||||
memberNameBuilder.Append(expr.Name + ".");
|
||||
|
||||
currentExpression = expr;
|
||||
CurrentExpression = expr;
|
||||
isQueringEntity = false;
|
||||
|
||||
return expr;
|
||||
@@ -110,13 +108,13 @@ namespace NHibernate.Linq.Visitors
|
||||
expr = (CollectionAccessExpression)base.VisitCollectionAccess(expr);
|
||||
//memberNameBuilder.Append(expr.Name + ".");
|
||||
ResetMemberName(expr.Name + ".");
|
||||
currentExpression = expr;
|
||||
CurrentExpression = expr;
|
||||
|
||||
if (createCriteriaForCollections)
|
||||
{
|
||||
if (expr.ElementExpression != null)
|
||||
{
|
||||
currentCriteria = EnsureCriteria(expr.Name, expr.ElementExpression.Alias);
|
||||
CurrentCriteria = EnsureCriteria(expr.Name, expr.ElementExpression.Alias);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ namespace NHibernate.Linq.Visitors
|
||||
private readonly ICriteria _rootCriteria;
|
||||
private readonly ISession _session;
|
||||
private readonly List<IProjection> _projections;
|
||||
private IResultTransformer _transformer;
|
||||
private ICriteriaQuery _criteriaQuery;
|
||||
|
||||
public IProjection Projection
|
||||
@@ -51,7 +50,7 @@ namespace NHibernate.Linq.Visitors
|
||||
}
|
||||
}
|
||||
|
||||
public IResultTransformer Transformer => _transformer;
|
||||
public IResultTransformer Transformer { get; private set; }
|
||||
|
||||
private ICriteriaQuery CriteriaQuery
|
||||
{
|
||||
@@ -153,7 +152,7 @@ namespace NHibernate.Linq.Visitors
|
||||
protected override NewExpression VisitNew(NewExpression expr)
|
||||
{
|
||||
NewExpression newExpr = base.VisitNew(expr);
|
||||
_transformer = new TypeSafeConstructorMemberInitResultTransformer(expr);
|
||||
Transformer = new TypeSafeConstructorMemberInitResultTransformer(expr);
|
||||
|
||||
var aggregators = expr.Arguments.Where(arg => arg is MethodCallExpression && SupportsMethod(((MethodCallExpression)arg).Method.Name));
|
||||
if (aggregators.Any())
|
||||
@@ -174,7 +173,7 @@ namespace NHibernate.Linq.Visitors
|
||||
protected override Expression VisitMemberInit(MemberInitExpression expr)
|
||||
{
|
||||
Expression newExpr = base.VisitMemberInit(expr);
|
||||
_transformer = new TypeSafeConstructorMemberInitResultTransformer(expr);
|
||||
Transformer = new TypeSafeConstructorMemberInitResultTransformer(expr);
|
||||
return newExpr;
|
||||
}
|
||||
|
||||
@@ -330,7 +329,7 @@ namespace NHibernate.Linq.Visitors
|
||||
{
|
||||
if (_rootCriteria.GetCriteriaByAlias(expr.Alias) != null)
|
||||
{
|
||||
_transformer = new LinqJoinResultsTransformer(expr.Type);
|
||||
Transformer = new LinqJoinResultsTransformer(expr.Type);
|
||||
}
|
||||
|
||||
return expr;
|
||||
|
||||
@@ -193,10 +193,7 @@ namespace Orchard.Core.Tests.Common.Providers
|
||||
|
||||
class UpdateModelStub : IUpdateModel
|
||||
{
|
||||
|
||||
ModelStateDictionary _modelState = new ModelStateDictionary();
|
||||
|
||||
public ModelStateDictionary ModelErrors => _modelState;
|
||||
public ModelStateDictionary ModelErrors { get; } = new ModelStateDictionary();
|
||||
|
||||
public string Owner { get; set; }
|
||||
|
||||
@@ -208,7 +205,7 @@ namespace Orchard.Core.Tests.Common.Providers
|
||||
|
||||
public void AddModelError(string key, LocalizedString errorMessage)
|
||||
{
|
||||
_modelState.AddModelError(key, errorMessage.ToString());
|
||||
ModelErrors.AddModelError(key, errorMessage.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,21 +19,15 @@ namespace Orchard.Specs.Bindings
|
||||
[Binding]
|
||||
public class WebAppHosting
|
||||
{
|
||||
private WebHost _webHost;
|
||||
private RequestDetails _details;
|
||||
private HtmlDocument _doc;
|
||||
private MessageSink _messages;
|
||||
private static readonly Path _orchardTemp = Path.Get(System.IO.Path.GetTempPath()).Combine("Orchard.Specs");
|
||||
private ExtensionDeploymentOptions _moduleDeploymentOptions = ExtensionDeploymentOptions.CompiledAssembly;
|
||||
private DynamicCompilationOption _dynamicCompilationOption = DynamicCompilationOption.Enabled;
|
||||
|
||||
public WebHost Host => _webHost;
|
||||
public WebHost Host { get; private set; }
|
||||
|
||||
public RequestDetails Details
|
||||
{
|
||||
get { return _details; }
|
||||
set { _details = value; }
|
||||
}
|
||||
public RequestDetails Details { get; set; }
|
||||
|
||||
[BeforeTestRun]
|
||||
public static void BeforeTestRun()
|
||||
@@ -55,19 +49,19 @@ namespace Orchard.Specs.Bindings
|
||||
[BeforeScenario]
|
||||
public void CleanOutTheOldWebHost()
|
||||
{
|
||||
if (_webHost != null)
|
||||
if (Host != null)
|
||||
{
|
||||
_webHost.Clean();
|
||||
_webHost = null;
|
||||
Host.Clean();
|
||||
Host = null;
|
||||
}
|
||||
}
|
||||
|
||||
[AfterScenario]
|
||||
public void AfterScenario()
|
||||
{
|
||||
if (_webHost != null)
|
||||
if (Host != null)
|
||||
{
|
||||
_webHost.Dispose();
|
||||
Host.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +99,7 @@ namespace Orchard.Specs.Bindings
|
||||
[Given(@"I have a clean site based on (.*) at ""(.*)""")]
|
||||
public void GivenIHaveACleanSiteBasedOn(string siteFolder, string virtualDirectory)
|
||||
{
|
||||
_webHost = new WebHost(_orchardTemp);
|
||||
Host = new WebHost(_orchardTemp);
|
||||
Host.Initialize(siteFolder, virtualDirectory ?? "/", _dynamicCompilationOption);
|
||||
var shuttle = new Shuttle();
|
||||
Host.Execute(() => Executor(shuttle));
|
||||
|
||||
@@ -11,19 +11,18 @@ namespace Orchard.Tests.Stubs
|
||||
public class StubAppDataFolder : IAppDataFolder
|
||||
{
|
||||
private readonly IClock _clock;
|
||||
private readonly StubFileSystem _fileSystem;
|
||||
|
||||
public StubAppDataFolder(IClock clock)
|
||||
{
|
||||
_clock = clock;
|
||||
_fileSystem = new StubFileSystem(_clock);
|
||||
FileSystem = new StubFileSystem(_clock);
|
||||
}
|
||||
|
||||
public StubFileSystem FileSystem => _fileSystem;
|
||||
public StubFileSystem FileSystem { get; }
|
||||
|
||||
public IEnumerable<string> ListFiles(string path)
|
||||
{
|
||||
var entry = _fileSystem.GetDirectoryEntry(path);
|
||||
var entry = FileSystem.GetDirectoryEntry(path);
|
||||
if (entry == null)
|
||||
throw new ArgumentException();
|
||||
|
||||
@@ -32,7 +31,7 @@ namespace Orchard.Tests.Stubs
|
||||
|
||||
public IEnumerable<string> ListDirectories(string path)
|
||||
{
|
||||
var entry = _fileSystem.GetDirectoryEntry(path);
|
||||
var entry = FileSystem.GetDirectoryEntry(path);
|
||||
if (entry == null)
|
||||
throw new ArgumentException();
|
||||
|
||||
@@ -41,7 +40,7 @@ namespace Orchard.Tests.Stubs
|
||||
|
||||
public bool FileExists(string path)
|
||||
{
|
||||
return _fileSystem.GetFileEntry(path) != null;
|
||||
return FileSystem.GetFileEntry(path) != null;
|
||||
}
|
||||
|
||||
public string Combine(params string[] paths)
|
||||
@@ -62,7 +61,7 @@ namespace Orchard.Tests.Stubs
|
||||
|
||||
public Stream CreateFile(string path)
|
||||
{
|
||||
return _fileSystem.CreateFile(path);
|
||||
return FileSystem.CreateFile(path);
|
||||
}
|
||||
|
||||
public string ReadFile(string path)
|
||||
@@ -78,14 +77,14 @@ namespace Orchard.Tests.Stubs
|
||||
|
||||
public Stream OpenFile(string path)
|
||||
{
|
||||
return _fileSystem.OpenFile(path);
|
||||
return FileSystem.OpenFile(path);
|
||||
}
|
||||
|
||||
public void StoreFile(string sourceFileName, string destinationPath)
|
||||
{
|
||||
using (var inputStream = File.OpenRead(sourceFileName))
|
||||
{
|
||||
using (var outputStream = _fileSystem.CreateFile(destinationPath))
|
||||
using (var outputStream = FileSystem.CreateFile(destinationPath))
|
||||
{
|
||||
byte[] buffer = new byte[1024];
|
||||
for (; ; )
|
||||
@@ -101,12 +100,12 @@ namespace Orchard.Tests.Stubs
|
||||
|
||||
public void DeleteFile(string path)
|
||||
{
|
||||
_fileSystem.DeleteFile(path);
|
||||
FileSystem.DeleteFile(path);
|
||||
}
|
||||
|
||||
public DateTime GetFileLastWriteTimeUtc(string path)
|
||||
{
|
||||
var entry = _fileSystem.GetFileEntry(path);
|
||||
var entry = FileSystem.GetFileEntry(path);
|
||||
if (entry == null)
|
||||
throw new ArgumentException();
|
||||
return entry.LastWriteTimeUtc;
|
||||
@@ -114,17 +113,17 @@ namespace Orchard.Tests.Stubs
|
||||
|
||||
public void CreateDirectory(string path)
|
||||
{
|
||||
_fileSystem.CreateDirectoryEntry(path);
|
||||
FileSystem.CreateDirectoryEntry(path);
|
||||
}
|
||||
|
||||
public bool DirectoryExists(string path)
|
||||
{
|
||||
return _fileSystem.GetDirectoryEntry(path) != null;
|
||||
return FileSystem.GetDirectoryEntry(path) != null;
|
||||
}
|
||||
|
||||
public IVolatileToken WhenPathChanges(string path)
|
||||
{
|
||||
return _fileSystem.WhenPathChanges(path);
|
||||
return FileSystem.WhenPathChanges(path);
|
||||
}
|
||||
|
||||
public string MapPath(string path)
|
||||
@@ -139,7 +138,7 @@ namespace Orchard.Tests.Stubs
|
||||
|
||||
public DateTime GetLastWriteTimeUtc(string path)
|
||||
{
|
||||
var entry = _fileSystem.GetFileEntry(path);
|
||||
var entry = FileSystem.GetFileEntry(path);
|
||||
if (entry == null)
|
||||
throw new InvalidOperationException();
|
||||
return entry.LastWriteTimeUtc;
|
||||
|
||||
@@ -98,20 +98,19 @@ namespace Orchard.Tests.Stubs
|
||||
{
|
||||
private readonly StubFileSystem _stubFileSystem;
|
||||
private readonly string _path;
|
||||
private bool _isCurrent;
|
||||
|
||||
public Token(StubFileSystem stubFileSystem, string path)
|
||||
{
|
||||
_stubFileSystem = stubFileSystem;
|
||||
_path = path;
|
||||
_isCurrent = true;
|
||||
IsCurrent = true;
|
||||
}
|
||||
|
||||
public bool IsCurrent => _isCurrent;
|
||||
public bool IsCurrent { get; private set; }
|
||||
|
||||
public void OnChange()
|
||||
{
|
||||
_isCurrent = false;
|
||||
IsCurrent = false;
|
||||
_stubFileSystem.DetachToken(_path);
|
||||
}
|
||||
}
|
||||
@@ -153,18 +152,17 @@ namespace Orchard.Tests.Stubs
|
||||
{
|
||||
private readonly T[] _buffer;
|
||||
private readonly int _offset;
|
||||
private readonly int _count;
|
||||
|
||||
public ArrayWrapper(T[] buffer, int offset, int count)
|
||||
{
|
||||
_buffer = buffer;
|
||||
_offset = offset;
|
||||
_count = count;
|
||||
Count = count;
|
||||
}
|
||||
|
||||
public IEnumerator<T> GetEnumerator()
|
||||
{
|
||||
for (int i = _offset; i < _count; i++)
|
||||
for (int i = _offset; i < Count; i++)
|
||||
yield return _buffer[i];
|
||||
}
|
||||
|
||||
@@ -190,7 +188,7 @@ namespace Orchard.Tests.Stubs
|
||||
|
||||
public void CopyTo(T[] array, int arrayIndex)
|
||||
{
|
||||
Array.Copy(_buffer, _offset, array, arrayIndex, _count);
|
||||
Array.Copy(_buffer, _offset, array, arrayIndex, Count);
|
||||
}
|
||||
|
||||
public bool Remove(T item)
|
||||
@@ -198,7 +196,7 @@ namespace Orchard.Tests.Stubs
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public int Count => _count;
|
||||
public int Count { get; }
|
||||
|
||||
public bool IsReadOnly => true;
|
||||
}
|
||||
@@ -234,17 +232,16 @@ namespace Orchard.Tests.Stubs
|
||||
|
||||
public class FileEntryReadStream : Stream
|
||||
{
|
||||
private readonly FileEntry _entry;
|
||||
private readonly IClock _clock;
|
||||
private int _position;
|
||||
|
||||
public FileEntryReadStream(FileEntry entry, IClock clock)
|
||||
{
|
||||
_entry = entry;
|
||||
FileEntry = entry;
|
||||
_clock = clock;
|
||||
}
|
||||
|
||||
public FileEntry FileEntry => _entry;
|
||||
public FileEntry FileEntry { get; }
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
@@ -262,7 +259,7 @@ namespace Orchard.Tests.Stubs
|
||||
_position += (int)offset;
|
||||
break;
|
||||
case SeekOrigin.End:
|
||||
_position = _entry.Content.Count - (int)offset;
|
||||
_position = FileEntry.Content.Count - (int)offset;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException("origin");
|
||||
@@ -277,10 +274,10 @@ namespace Orchard.Tests.Stubs
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
int remaingCount = _entry.Content.Count - _position;
|
||||
int remaingCount = FileEntry.Content.Count - _position;
|
||||
count = Math.Min(count, remaingCount);
|
||||
|
||||
_entry.Content.CopyTo(_position, buffer, offset, count);
|
||||
FileEntry.Content.CopyTo(_position, buffer, offset, count);
|
||||
|
||||
_position += count;
|
||||
return count;
|
||||
@@ -297,7 +294,7 @@ namespace Orchard.Tests.Stubs
|
||||
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override long Length => _entry.Content.Count;
|
||||
public override long Length => FileEntry.Content.Count;
|
||||
|
||||
public override long Position
|
||||
{
|
||||
|
||||
@@ -8,14 +8,12 @@ namespace Orchard.Tests.Stubs
|
||||
{
|
||||
public class StubVirtualPathProvider : IVirtualPathProvider
|
||||
{
|
||||
private readonly StubFileSystem _fileSystem;
|
||||
|
||||
public StubVirtualPathProvider(StubFileSystem fileSystem)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
FileSystem = fileSystem;
|
||||
}
|
||||
|
||||
public StubFileSystem FileSystem => _fileSystem;
|
||||
public StubFileSystem FileSystem { get; }
|
||||
|
||||
private string ToFileSystemPath(string path)
|
||||
{
|
||||
@@ -59,27 +57,27 @@ namespace Orchard.Tests.Stubs
|
||||
|
||||
public bool FileExists(string virtualPath)
|
||||
{
|
||||
return _fileSystem.GetFileEntry(ToFileSystemPath(virtualPath)) != null;
|
||||
return FileSystem.GetFileEntry(ToFileSystemPath(virtualPath)) != null;
|
||||
}
|
||||
|
||||
public Stream OpenFile(string virtualPath)
|
||||
{
|
||||
return _fileSystem.OpenFile(ToFileSystemPath(virtualPath));
|
||||
return FileSystem.OpenFile(ToFileSystemPath(virtualPath));
|
||||
}
|
||||
|
||||
public StreamWriter CreateText(string virtualPath)
|
||||
{
|
||||
return new StreamWriter(_fileSystem.CreateFile(ToFileSystemPath(virtualPath)));
|
||||
return new StreamWriter(FileSystem.CreateFile(ToFileSystemPath(virtualPath)));
|
||||
}
|
||||
|
||||
public Stream CreateFile(string virtualPath)
|
||||
{
|
||||
return _fileSystem.CreateFile(ToFileSystemPath(virtualPath));
|
||||
return FileSystem.CreateFile(ToFileSystemPath(virtualPath));
|
||||
}
|
||||
|
||||
public DateTime GetFileLastWriteTimeUtc(string virtualPath)
|
||||
{
|
||||
return _fileSystem.GetFileEntry(ToFileSystemPath(virtualPath)).LastWriteTimeUtc;
|
||||
return FileSystem.GetFileEntry(ToFileSystemPath(virtualPath)).LastWriteTimeUtc;
|
||||
}
|
||||
|
||||
public string GetFileHash(string virtualPath)
|
||||
@@ -94,17 +92,17 @@ namespace Orchard.Tests.Stubs
|
||||
|
||||
public void DeleteFile(string virtualPath)
|
||||
{
|
||||
_fileSystem.DeleteFile(ToFileSystemPath(virtualPath));
|
||||
FileSystem.DeleteFile(ToFileSystemPath(virtualPath));
|
||||
}
|
||||
|
||||
public bool DirectoryExists(string virtualPath)
|
||||
{
|
||||
return _fileSystem.GetDirectoryEntry(ToFileSystemPath(virtualPath)) != null;
|
||||
return FileSystem.GetDirectoryEntry(ToFileSystemPath(virtualPath)) != null;
|
||||
}
|
||||
|
||||
public void CreateDirectory(string virtualPath)
|
||||
{
|
||||
_fileSystem.CreateDirectoryEntry(ToFileSystemPath(virtualPath));
|
||||
FileSystem.CreateDirectoryEntry(ToFileSystemPath(virtualPath));
|
||||
}
|
||||
|
||||
public void DeleteDirectory(string virtualPath)
|
||||
@@ -119,14 +117,14 @@ namespace Orchard.Tests.Stubs
|
||||
|
||||
public IEnumerable<string> ListFiles(string path)
|
||||
{
|
||||
return _fileSystem.GetDirectoryEntry(ToFileSystemPath(path))
|
||||
return FileSystem.GetDirectoryEntry(ToFileSystemPath(path))
|
||||
.Files
|
||||
.Select(f => Combine(path, f.Name));
|
||||
}
|
||||
|
||||
public IEnumerable<string> ListDirectories(string path)
|
||||
{
|
||||
return _fileSystem.GetDirectoryEntry(ToFileSystemPath(path))
|
||||
return FileSystem.GetDirectoryEntry(ToFileSystemPath(path))
|
||||
.Directories
|
||||
.Select(f => Combine(path, f.Name));
|
||||
}
|
||||
|
||||
@@ -8,23 +8,20 @@ namespace Orchard.Core.Common.Models
|
||||
{
|
||||
public class CommonPart : ContentPart<CommonPartRecord>, ICommonPart
|
||||
{
|
||||
private readonly LazyField<IUser> _owner = new LazyField<IUser>();
|
||||
private readonly LazyField<IContent> _container = new LazyField<IContent>();
|
||||
public LazyField<IUser> OwnerField { get; } = new LazyField<IUser>();
|
||||
|
||||
public LazyField<IUser> OwnerField => _owner;
|
||||
|
||||
public LazyField<IContent> ContainerField => _container;
|
||||
public LazyField<IContent> ContainerField { get; } = new LazyField<IContent>();
|
||||
|
||||
public IUser Owner
|
||||
{
|
||||
get { return _owner.Value; }
|
||||
set { _owner.Value = value; }
|
||||
get { return OwnerField.Value; }
|
||||
set { OwnerField.Value = value; }
|
||||
}
|
||||
|
||||
public IContent Container
|
||||
{
|
||||
get { return _container.Value; }
|
||||
set { _container.Value = value; }
|
||||
get { return ContainerField.Value; }
|
||||
set { ContainerField.Value = value; }
|
||||
}
|
||||
|
||||
public DateTime? CreatedUtc
|
||||
|
||||
@@ -15,14 +15,12 @@ namespace Orchard.Core.Containers.Services
|
||||
|
||||
public class ListViewService : IListViewService
|
||||
{
|
||||
private readonly IEnumerable<IListViewProvider> _providers;
|
||||
|
||||
public ListViewService(IEnumerable<IListViewProvider> providers)
|
||||
{
|
||||
_providers = providers.OrderBy(x => x.Priority);
|
||||
Providers = providers.OrderBy(x => x.Priority);
|
||||
}
|
||||
|
||||
public IEnumerable<IListViewProvider> Providers => _providers;
|
||||
public IEnumerable<IListViewProvider> Providers { get; }
|
||||
|
||||
public IListViewProvider GetProvider(string name)
|
||||
{
|
||||
|
||||
@@ -6,14 +6,12 @@ namespace Orchard.Core.Navigation.Models
|
||||
{
|
||||
public class MenuPart : ContentPart<MenuPartRecord>
|
||||
{
|
||||
|
||||
private readonly LazyField<IContent> _menu = new LazyField<IContent>();
|
||||
public LazyField<IContent> MenuField => _menu;
|
||||
public LazyField<IContent> MenuField { get; } = new LazyField<IContent>();
|
||||
|
||||
public IContent Menu
|
||||
{
|
||||
get { return _menu.Value; }
|
||||
set { _menu.Value = value; }
|
||||
get { return MenuField.Value; }
|
||||
set { MenuField.Value = value; }
|
||||
}
|
||||
|
||||
[StringLength(MenuPartRecord.DefaultMenuTextLength)]
|
||||
|
||||
@@ -7,14 +7,13 @@ namespace Lucene.Models
|
||||
public class LuceneSearchHit : ISearchHit
|
||||
{
|
||||
private readonly Document _doc;
|
||||
private readonly float _score;
|
||||
|
||||
public float Score => _score;
|
||||
public float Score { get; }
|
||||
|
||||
public LuceneSearchHit(Document document, float score)
|
||||
{
|
||||
_doc = document;
|
||||
_score = score;
|
||||
Score = score;
|
||||
}
|
||||
|
||||
public int ContentItemId => GetInt("id");
|
||||
|
||||
@@ -12,12 +12,11 @@ namespace Lucene.Models
|
||||
set { this.Store(x => x.LuceneAnalyzerSelectorMappingsSerialized, value); }
|
||||
}
|
||||
|
||||
private readonly LazyField<IEnumerable<LuceneAnalyzerSelectorMapping>> _luceneAnalyzerSelectorMappings = new LazyField<IEnumerable<LuceneAnalyzerSelectorMapping>>();
|
||||
internal LazyField<IEnumerable<LuceneAnalyzerSelectorMapping>> LuceneAnalyzerSelectorMappingsField => _luceneAnalyzerSelectorMappings;
|
||||
internal LazyField<IEnumerable<LuceneAnalyzerSelectorMapping>> LuceneAnalyzerSelectorMappingsField { get; } = new LazyField<IEnumerable<LuceneAnalyzerSelectorMapping>>();
|
||||
public IEnumerable<LuceneAnalyzerSelectorMapping> LuceneAnalyzerSelectorMappings
|
||||
{
|
||||
get { return _luceneAnalyzerSelectorMappings.Value; }
|
||||
set { _luceneAnalyzerSelectorMappings.Value = value; }
|
||||
get { return LuceneAnalyzerSelectorMappingsField.Value; }
|
||||
set { LuceneAnalyzerSelectorMappingsField.Value = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ namespace Orchard.ArchiveLater.Models
|
||||
{
|
||||
public class ArchiveLaterPart : ContentPart
|
||||
{
|
||||
private readonly LazyField<DateTime?> _scheduledArchiveUtc = new LazyField<DateTime?>();
|
||||
public LazyField<DateTime?> ScheduledArchiveUtc => _scheduledArchiveUtc;
|
||||
public LazyField<DateTime?> ScheduledArchiveUtc { get; } = new LazyField<DateTime?>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@ namespace Orchard.Blogs.Models
|
||||
{
|
||||
public class ArchiveData : IEquatable<ArchiveData>, IComparable<ArchiveData>
|
||||
{
|
||||
private static readonly string _defaultString = DateTime.Now.Year.ToString();
|
||||
|
||||
private static readonly Regex archiveDataRegex =
|
||||
new Regex(@"^(?<year>\d{4})(?:/(?<month>\d{1,2})?(?:/(?<day>\d{1,2})?)?)?(?:/(?:page(?<page>\d+))?)?$",
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
@@ -57,7 +55,7 @@ namespace Orchard.Blogs.Models
|
||||
public int Month { get; private set; }
|
||||
public int Day { get; private set; }
|
||||
|
||||
public static string DefaultString => _defaultString;
|
||||
public static string DefaultString { get; } = DateTime.Now.Year.ToString();
|
||||
|
||||
#region IComparable<ArchiveData> Members
|
||||
|
||||
|
||||
@@ -8,11 +8,8 @@ namespace Orchard.Comments.Models
|
||||
{
|
||||
public class CommentPart : ContentPart<CommentPartRecord>
|
||||
{
|
||||
private readonly LazyField<ContentItem> _commentedOnContentItem = new LazyField<ContentItem>();
|
||||
private readonly LazyField<ContentItemMetadata> _commentedOnContentItemMetadata = new LazyField<ContentItemMetadata>();
|
||||
|
||||
public LazyField<ContentItem> CommentedOnContentItemField => _commentedOnContentItem;
|
||||
public LazyField<ContentItemMetadata> CommentedOnContentItemMetadataField => _commentedOnContentItemMetadata;
|
||||
public LazyField<ContentItem> CommentedOnContentItemField { get; } = new LazyField<ContentItem>();
|
||||
public LazyField<ContentItemMetadata> CommentedOnContentItemMetadataField { get; } = new LazyField<ContentItemMetadata>();
|
||||
|
||||
[StringLength(255)]
|
||||
public string Author
|
||||
@@ -82,14 +79,14 @@ namespace Orchard.Comments.Models
|
||||
|
||||
public ContentItem CommentedOnContentItem
|
||||
{
|
||||
get { return _commentedOnContentItem.Value; }
|
||||
set { _commentedOnContentItem.Value = value; }
|
||||
get { return CommentedOnContentItemField.Value; }
|
||||
set { CommentedOnContentItemField.Value = value; }
|
||||
}
|
||||
|
||||
public ContentItemMetadata CommentedOnContentItemMetadata
|
||||
{
|
||||
get { return _commentedOnContentItemMetadata.Value; }
|
||||
set { _commentedOnContentItemMetadata.Value = value; }
|
||||
get { return CommentedOnContentItemMetadataField.Value; }
|
||||
set { CommentedOnContentItemMetadataField.Value = value; }
|
||||
}
|
||||
|
||||
public int CommentedOnContainer
|
||||
|
||||
@@ -6,22 +6,19 @@ namespace Orchard.Comments.Models
|
||||
{
|
||||
public class CommentsPart : ContentPart<CommentsPartRecord>
|
||||
{
|
||||
private readonly LazyField<IList<CommentPart>> _comments = new LazyField<IList<CommentPart>>();
|
||||
private readonly LazyField<IList<CommentPart>> _pendingComments = new LazyField<IList<CommentPart>>();
|
||||
|
||||
public LazyField<IList<CommentPart>> CommentsField => _comments;
|
||||
public LazyField<IList<CommentPart>> PendingCommentsField => _pendingComments;
|
||||
public LazyField<IList<CommentPart>> CommentsField { get; } = new LazyField<IList<CommentPart>>();
|
||||
public LazyField<IList<CommentPart>> PendingCommentsField { get; } = new LazyField<IList<CommentPart>>();
|
||||
|
||||
public IList<CommentPart> Comments
|
||||
{
|
||||
get { return _comments.Value; }
|
||||
set { _comments.Value = value; }
|
||||
get { return CommentsField.Value; }
|
||||
set { CommentsField.Value = value; }
|
||||
}
|
||||
|
||||
public IList<CommentPart> PendingComments
|
||||
{
|
||||
get { return _pendingComments.Value; }
|
||||
set { _pendingComments.Value = value; }
|
||||
get { return PendingCommentsField.Value; }
|
||||
set { PendingCommentsField.Value = value; }
|
||||
}
|
||||
|
||||
public bool CommentsShown
|
||||
|
||||
@@ -8,9 +8,7 @@ namespace Orchard.Email.Models
|
||||
{
|
||||
public class SmtpSettingsPart : ContentPart
|
||||
{
|
||||
private readonly ComputedField<string> _password = new ComputedField<string>();
|
||||
|
||||
public ComputedField<string> PasswordField => _password;
|
||||
public ComputedField<string> PasswordField { get; } = new ComputedField<string>();
|
||||
|
||||
public string FromAddress
|
||||
{
|
||||
@@ -29,10 +27,8 @@ namespace Orchard.Email.Models
|
||||
get => this.Retrieve(x => x.ReplyTo);
|
||||
set => this.Store(x => x.ReplyTo, value);
|
||||
}
|
||||
|
||||
private readonly LazyField<string> _addressPlaceholder = new LazyField<string>();
|
||||
internal LazyField<string> AddressPlaceholderField => _addressPlaceholder;
|
||||
public string AddressPlaceholder => _addressPlaceholder.Value;
|
||||
internal LazyField<string> AddressPlaceholderField { get; } = new LazyField<string>();
|
||||
public string AddressPlaceholder => AddressPlaceholderField.Value;
|
||||
|
||||
public string Host
|
||||
{
|
||||
@@ -81,8 +77,8 @@ namespace Orchard.Email.Models
|
||||
|
||||
public string Password
|
||||
{
|
||||
get => _password.Value;
|
||||
set => _password.Value = value;
|
||||
get => PasswordField.Value;
|
||||
set => PasswordField.Value = value;
|
||||
}
|
||||
|
||||
// Hotmail only supports the mailto:link. When a user clicks on the 'unsubscribe' option in Hotmail.
|
||||
|
||||
@@ -7,22 +7,19 @@ namespace Orchard.Localization.Models
|
||||
{
|
||||
public sealed class LocalizationPart : ContentPart<LocalizationPartRecord>, ILocalizableAspect
|
||||
{
|
||||
private readonly LazyField<CultureRecord> _culture = new LazyField<CultureRecord>();
|
||||
private readonly LazyField<IContent> _masterContentItem = new LazyField<IContent>();
|
||||
|
||||
public LazyField<CultureRecord> CultureField => _culture;
|
||||
public LazyField<IContent> MasterContentItemField => _masterContentItem;
|
||||
public LazyField<CultureRecord> CultureField { get; } = new LazyField<CultureRecord>();
|
||||
public LazyField<IContent> MasterContentItemField { get; } = new LazyField<IContent>();
|
||||
|
||||
public CultureRecord Culture
|
||||
{
|
||||
get { return _culture.Value; }
|
||||
set { _culture.Value = value; }
|
||||
get { return CultureField.Value; }
|
||||
set { CultureField.Value = value; }
|
||||
}
|
||||
|
||||
public IContent MasterContentItem
|
||||
{
|
||||
get { return _masterContentItem.Value; }
|
||||
set { _masterContentItem.Value = value; }
|
||||
get { return MasterContentItemField.Value; }
|
||||
set { MasterContentItemField.Value = value; }
|
||||
}
|
||||
|
||||
public bool HasTranslationGroup => Record.MasterContentItemId != 0;
|
||||
|
||||
@@ -8,14 +8,8 @@ namespace Orchard.MediaLibrary.Models
|
||||
public string MediaPath { get; set; }
|
||||
public string User { get; set; }
|
||||
public DateTime LastUpdated { get; set; }
|
||||
internal Lazy<long> SizeField { get; set; }
|
||||
|
||||
private Lazy<long> _size;
|
||||
internal Lazy<long> SizeField
|
||||
{
|
||||
get { return _size; }
|
||||
set { _size = value; }
|
||||
}
|
||||
|
||||
public long Size => _size.Value;
|
||||
public long Size => SizeField.Value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace Orchard.Packaging.Services
|
||||
{
|
||||
private const string NetFrameworkIdentifier = ".NETFramework";
|
||||
private const string BinDir = "bin";
|
||||
private readonly string _root;
|
||||
private DateTime? _writeTimeUtcForAddedFiles;
|
||||
|
||||
public FileBasedProjectSystem(string root)
|
||||
@@ -20,10 +19,10 @@ namespace Orchard.Packaging.Services
|
||||
{
|
||||
throw new ArgumentException("root");
|
||||
}
|
||||
_root = root;
|
||||
Root = root;
|
||||
}
|
||||
|
||||
public string Root => _root;
|
||||
public string Root { get; }
|
||||
|
||||
public virtual string ProjectName => Root;
|
||||
|
||||
|
||||
@@ -243,16 +243,15 @@ namespace Orchard.Packaging.Services
|
||||
{
|
||||
private readonly IWebSiteFolder _webSiteFolder;
|
||||
private readonly string _virtualPath;
|
||||
private readonly string _packagePath;
|
||||
|
||||
public VirtualPackageFile(IWebSiteFolder webSiteFolder, string virtualPath, string packagePath)
|
||||
{
|
||||
_webSiteFolder = webSiteFolder;
|
||||
_virtualPath = virtualPath;
|
||||
_packagePath = packagePath;
|
||||
Path = packagePath;
|
||||
}
|
||||
|
||||
public string Path => _packagePath;
|
||||
public string Path { get; }
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "Supposed to return an open stream.")]
|
||||
public Stream GetStream()
|
||||
|
||||
@@ -7,7 +7,6 @@ namespace Orchard.PublishLater.Models
|
||||
{
|
||||
public class PublishLaterPart : ContentPart<PublishLaterPart>, IPublishingControlAspect
|
||||
{
|
||||
private readonly LazyField<DateTime?> _scheduledPublishUtc = new LazyField<DateTime?>();
|
||||
public LazyField<DateTime?> ScheduledPublishUtc => _scheduledPublishUtc;
|
||||
public LazyField<DateTime?> ScheduledPublishUtc { get; } = new LazyField<DateTime?>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,18 +106,17 @@ namespace Orchard.Recipes.Providers.Executors
|
||||
class State
|
||||
{
|
||||
private readonly string _commandLine;
|
||||
private readonly StringBuilder _stringBuilder;
|
||||
private readonly List<string> _arguments;
|
||||
private int _index;
|
||||
|
||||
public State(string commandLine)
|
||||
{
|
||||
_commandLine = commandLine;
|
||||
_stringBuilder = new StringBuilder();
|
||||
StringBuilder = new StringBuilder();
|
||||
_arguments = new List<string>();
|
||||
}
|
||||
|
||||
public StringBuilder StringBuilder => _stringBuilder;
|
||||
public StringBuilder StringBuilder { get; }
|
||||
public bool EOF => _index >= _commandLine.Length;
|
||||
public char Current => _commandLine[_index];
|
||||
public IEnumerable<string> Arguments => _arguments;
|
||||
|
||||
@@ -5,30 +5,26 @@ namespace Orchard.Scripting.Ast
|
||||
{
|
||||
public class BinaryAstNode : AstNode, IAstNodeWithToken
|
||||
{
|
||||
private readonly AstNode _left;
|
||||
private readonly Token _token;
|
||||
private readonly AstNode _right;
|
||||
|
||||
public BinaryAstNode(AstNode left, Token token, AstNode right)
|
||||
{
|
||||
_left = left;
|
||||
_token = token;
|
||||
_right = right;
|
||||
Left = left;
|
||||
Operator = token;
|
||||
Right = right;
|
||||
}
|
||||
|
||||
public Token Token => _token;
|
||||
public Token Token => Operator;
|
||||
|
||||
public Token Operator => _token;
|
||||
public Token Operator { get; }
|
||||
|
||||
public override object Accept(AstVisitor visitor)
|
||||
{
|
||||
return visitor.VisitBinary(this);
|
||||
}
|
||||
|
||||
public override IEnumerable<AstNode> Children => new List<AstNode>(2) { _left, _right };
|
||||
public override IEnumerable<AstNode> Children => new List<AstNode>(2) { Left, Right };
|
||||
|
||||
public AstNode Left => _left;
|
||||
public AstNode Left { get; }
|
||||
|
||||
public AstNode Right => _right;
|
||||
public AstNode Right { get; }
|
||||
}
|
||||
}
|
||||
@@ -4,16 +4,14 @@ namespace Orchard.Scripting.Ast
|
||||
{
|
||||
public class ConstantAstNode : AstNode, IAstNodeWithToken
|
||||
{
|
||||
private readonly Token _token;
|
||||
|
||||
public ConstantAstNode(Token token)
|
||||
{
|
||||
_token = token;
|
||||
Token = token;
|
||||
}
|
||||
|
||||
public Token Token => _token;
|
||||
public Token Token { get; }
|
||||
|
||||
public object Value => _token.Value;
|
||||
public object Value => Token.Value;
|
||||
|
||||
public override object Accept(AstVisitor visitor)
|
||||
{
|
||||
|
||||
@@ -4,18 +4,15 @@ namespace Orchard.Scripting.Ast
|
||||
{
|
||||
public class ErrorAstNode : AstNode, IAstNodeWithToken
|
||||
{
|
||||
private readonly Token _token;
|
||||
private readonly string _message;
|
||||
|
||||
public ErrorAstNode(Token token, string message)
|
||||
{
|
||||
_token = token;
|
||||
_message = message;
|
||||
Token = token;
|
||||
Message = message;
|
||||
}
|
||||
|
||||
public Token Token => _token;
|
||||
public Token Token { get; }
|
||||
|
||||
public string Message => _message;
|
||||
public string Message { get; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
|
||||
@@ -5,21 +5,18 @@ namespace Orchard.Scripting.Ast
|
||||
{
|
||||
public class MethodCallAstNode : AstNode, IAstNodeWithToken
|
||||
{
|
||||
private readonly Token _token;
|
||||
private readonly IList<AstNode> _arguments;
|
||||
|
||||
public MethodCallAstNode(Token token, IList<AstNode> arguments)
|
||||
{
|
||||
_token = token;
|
||||
_arguments = arguments;
|
||||
Token = token;
|
||||
Arguments = arguments;
|
||||
}
|
||||
|
||||
public Token Target => _token;
|
||||
public IList<AstNode> Arguments => _arguments;
|
||||
public Token Target => Token;
|
||||
public IList<AstNode> Arguments { get; }
|
||||
|
||||
public Token Token => _token;
|
||||
public Token Token { get; }
|
||||
|
||||
public override IEnumerable<AstNode> Children => _arguments;
|
||||
public override IEnumerable<AstNode> Children => Arguments;
|
||||
|
||||
public override object Accept(AstVisitor visitor)
|
||||
{
|
||||
|
||||
@@ -5,20 +5,17 @@ namespace Orchard.Scripting.Ast
|
||||
{
|
||||
public class UnaryAstNode : AstNode, IAstNodeWithToken
|
||||
{
|
||||
private readonly AstNode _operand;
|
||||
private readonly Token _token;
|
||||
|
||||
public UnaryAstNode(Token token, AstNode operand)
|
||||
{
|
||||
_operand = operand;
|
||||
_token = token;
|
||||
Operand = operand;
|
||||
Operator = token;
|
||||
}
|
||||
|
||||
public Token Token => _token;
|
||||
public Token Operator => _token;
|
||||
public AstNode Operand => _operand;
|
||||
public Token Token => Operator;
|
||||
public Token Operator { get; }
|
||||
public AstNode Operand { get; }
|
||||
|
||||
public override IEnumerable<AstNode> Children => new List<AstNode>(1) { _operand };
|
||||
public override IEnumerable<AstNode> Children => new List<AstNode>(1) { Operand };
|
||||
|
||||
public override object Accept(AstVisitor visitor)
|
||||
{
|
||||
|
||||
@@ -4,11 +4,9 @@ namespace Orchard.Scripting.Compiler
|
||||
{
|
||||
public class EvaluationResult
|
||||
{
|
||||
private readonly object _value;
|
||||
|
||||
public EvaluationResult(object value)
|
||||
{
|
||||
_value = value;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public static EvaluationResult Result(object value)
|
||||
@@ -23,7 +21,7 @@ namespace Orchard.Scripting.Compiler
|
||||
return new EvaluationResult(new Error { Message = message });
|
||||
}
|
||||
|
||||
public object Value => _value;
|
||||
public object Value { get; }
|
||||
|
||||
public bool IsError => Value is Error;
|
||||
public bool IsNil => IsNull;
|
||||
|
||||
@@ -39,14 +39,12 @@ namespace Orchard.Scripting.Compiler
|
||||
|
||||
public struct Marker
|
||||
{
|
||||
private readonly int _tokenIndex;
|
||||
|
||||
public Marker(int tokenIndex)
|
||||
{
|
||||
_tokenIndex = tokenIndex;
|
||||
TokenIndex = tokenIndex;
|
||||
}
|
||||
|
||||
public int TokenIndex => _tokenIndex;
|
||||
public int TokenIndex { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,11 +11,6 @@ namespace Orchard.Users.Services
|
||||
|
||||
public class UsernameValidationError
|
||||
{
|
||||
|
||||
private Severity _severity;
|
||||
private string _key;
|
||||
private LocalizedString _errorMessage;
|
||||
|
||||
public UsernameValidationError(Severity severity, string key, LocalizedString errorMessage)
|
||||
{
|
||||
Severity = severity;
|
||||
@@ -23,9 +18,9 @@ namespace Orchard.Users.Services
|
||||
ErrorMessage = errorMessage;
|
||||
}
|
||||
|
||||
public Severity Severity { get => _severity; set => _severity = value; }
|
||||
public string Key { get => _key; set => _key = value; }
|
||||
public LocalizedString ErrorMessage { get => _errorMessage; set => _errorMessage = value; }
|
||||
public Severity Severity { get; set; }
|
||||
public string Key { get; set; }
|
||||
public LocalizedString ErrorMessage { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -24,13 +24,11 @@ namespace Orchard.Caching
|
||||
/// </summary>
|
||||
public class SimpleAcquireContext : IAcquireContext
|
||||
{
|
||||
private readonly Action<IVolatileToken> _monitor;
|
||||
|
||||
public SimpleAcquireContext(Action<IVolatileToken> monitor)
|
||||
{
|
||||
_monitor = monitor;
|
||||
Monitor = monitor;
|
||||
}
|
||||
|
||||
public Action<IVolatileToken> Monitor => _monitor;
|
||||
public Action<IVolatileToken> Monitor { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,14 +4,8 @@ namespace Orchard.Caching
|
||||
{
|
||||
public class DefaultCacheContextAccessor : ICacheContextAccessor
|
||||
{
|
||||
[ThreadStatic]
|
||||
private static IAcquireContext _threadInstance;
|
||||
|
||||
public static IAcquireContext ThreadInstance
|
||||
{
|
||||
get { return _threadInstance; }
|
||||
set { _threadInstance = value; }
|
||||
}
|
||||
[field: ThreadStatic]
|
||||
public static IAcquireContext ThreadInstance { get; set; }
|
||||
|
||||
public IAcquireContext Current
|
||||
{
|
||||
|
||||
@@ -5,14 +5,12 @@ namespace Orchard.Commands
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public class CommandNameAttribute : Attribute
|
||||
{
|
||||
private readonly string _commandAlias;
|
||||
|
||||
public CommandNameAttribute(string commandAlias)
|
||||
{
|
||||
_commandAlias = commandAlias;
|
||||
Command = commandAlias;
|
||||
}
|
||||
|
||||
public string Command => _commandAlias;
|
||||
public string Command { get; }
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
|
||||
@@ -9,7 +9,6 @@ namespace Orchard.ContentManagement.MetaData.Builders
|
||||
public class ContentPartDefinitionBuilder
|
||||
{
|
||||
private readonly ContentPartDefinition _part;
|
||||
private string _name;
|
||||
private readonly IList<ContentPartFieldDefinition> _fields;
|
||||
private readonly SettingsDictionary _settings;
|
||||
|
||||
@@ -31,22 +30,22 @@ namespace Orchard.ContentManagement.MetaData.Builders
|
||||
}
|
||||
else
|
||||
{
|
||||
_name = existing.Name;
|
||||
Name = existing.Name;
|
||||
_fields = existing.Fields.ToList();
|
||||
_settings = new SettingsDictionary(existing.Settings.ToDictionary(kv => kv.Key, kv => kv.Value));
|
||||
}
|
||||
}
|
||||
|
||||
public string Name => _name;
|
||||
public string Name { get; private set; }
|
||||
|
||||
public ContentPartDefinition Build()
|
||||
{
|
||||
return new ContentPartDefinition(_name, _fields, _settings);
|
||||
return new ContentPartDefinition(Name, _fields, _settings);
|
||||
}
|
||||
|
||||
public ContentPartDefinitionBuilder Named(string name)
|
||||
{
|
||||
_name = name;
|
||||
Name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,11 +8,10 @@ namespace Orchard.ContentManagement
|
||||
public class QueryHints
|
||||
{
|
||||
private readonly List<string> _records = new List<string>();
|
||||
private static readonly QueryHints _empty = new QueryHints();
|
||||
|
||||
public IEnumerable<string> Records => _records;
|
||||
|
||||
public static QueryHints Empty => _empty;
|
||||
public static QueryHints Empty { get; } = new QueryHints();
|
||||
|
||||
public QueryHints ExpandRecords(IEnumerable<string> records)
|
||||
{
|
||||
|
||||
@@ -7,15 +7,13 @@ namespace Orchard.Data
|
||||
/// </summary>
|
||||
public class MapAsRecordAttribute : Attribute
|
||||
{
|
||||
private readonly bool _enabled;
|
||||
|
||||
public MapAsRecordAttribute() : this(true) { }
|
||||
|
||||
public MapAsRecordAttribute(bool enabled)
|
||||
{
|
||||
_enabled = enabled;
|
||||
Enabled = enabled;
|
||||
}
|
||||
|
||||
public bool Enabled => _enabled;
|
||||
public bool Enabled { get; }
|
||||
}
|
||||
}
|
||||
@@ -7,32 +7,28 @@ namespace Orchard.Data.Migration.Schema
|
||||
{
|
||||
public class SchemaBuilder
|
||||
{
|
||||
private readonly IDataMigrationInterpreter _interpreter;
|
||||
private readonly string _featurePrefix;
|
||||
private readonly Func<string, string> _formatPrefix;
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public SchemaBuilder(IDataMigrationInterpreter interpreter, string featurePrefix = null, Func<string, string> formatPrefix = null)
|
||||
{
|
||||
_interpreter = interpreter;
|
||||
_featurePrefix = featurePrefix ?? string.Empty;
|
||||
_formatPrefix = formatPrefix ?? (s => s ?? string.Empty);
|
||||
Interpreter = interpreter;
|
||||
FeaturePrefix = featurePrefix ?? string.Empty;
|
||||
FormatPrefix = formatPrefix ?? (s => s ?? string.Empty);
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
public IDataMigrationInterpreter Interpreter => _interpreter;
|
||||
public IDataMigrationInterpreter Interpreter { get; }
|
||||
|
||||
public string FeaturePrefix => _featurePrefix;
|
||||
public string FeaturePrefix { get; }
|
||||
|
||||
public Func<string, string> FormatPrefix => _formatPrefix;
|
||||
public Func<string, string> FormatPrefix { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Translate Table name into database table name - including prefixes.
|
||||
/// </summary>
|
||||
public virtual string TableDbName(string srcTable, string featurePrefixOverride = null)
|
||||
{
|
||||
return _interpreter.PrefixTableName(FormatPrefix(featurePrefixOverride ?? FeaturePrefix) + srcTable);
|
||||
return Interpreter.PrefixTableName(FormatPrefix(featurePrefixOverride ?? FeaturePrefix) + srcTable);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -40,12 +36,12 @@ namespace Orchard.Data.Migration.Schema
|
||||
/// </summary>
|
||||
public virtual string RemoveDataTablePrefix(string prefixedTableName)
|
||||
{
|
||||
return _interpreter.RemovePrefixFromTableName(prefixedTableName);
|
||||
return Interpreter.RemovePrefixFromTableName(prefixedTableName);
|
||||
}
|
||||
|
||||
public SchemaBuilder CreateTable(string name, Action<CreateTableCommand> table)
|
||||
{
|
||||
var createTable = new CreateTableCommand(string.Concat(_formatPrefix(_featurePrefix), name));
|
||||
var createTable = new CreateTableCommand(string.Concat(FormatPrefix(FeaturePrefix), name));
|
||||
table(createTable);
|
||||
Run(createTable);
|
||||
return this;
|
||||
@@ -53,7 +49,7 @@ namespace Orchard.Data.Migration.Schema
|
||||
|
||||
public SchemaBuilder AlterTable(string name, Action<AlterTableCommand> table)
|
||||
{
|
||||
var alterTable = new AlterTableCommand(string.Concat(_formatPrefix(_featurePrefix), name));
|
||||
var alterTable = new AlterTableCommand(string.Concat(FormatPrefix(FeaturePrefix), name));
|
||||
table(alterTable);
|
||||
Run(alterTable);
|
||||
return this;
|
||||
@@ -61,7 +57,7 @@ namespace Orchard.Data.Migration.Schema
|
||||
|
||||
public SchemaBuilder DropTable(string name)
|
||||
{
|
||||
var deleteTable = new DropTableCommand(string.Concat(_formatPrefix(_featurePrefix), name));
|
||||
var deleteTable = new DropTableCommand(string.Concat(FormatPrefix(FeaturePrefix), name));
|
||||
Run(deleteTable);
|
||||
return this;
|
||||
}
|
||||
@@ -90,47 +86,47 @@ namespace Orchard.Data.Migration.Schema
|
||||
|
||||
private void Run(ISchemaBuilderCommand command)
|
||||
{
|
||||
_interpreter.Visit(command);
|
||||
Interpreter.Visit(command);
|
||||
}
|
||||
|
||||
public SchemaBuilder CreateForeignKey(string name, string srcTable, string[] srcColumns, string destTable, string[] destColumns)
|
||||
{
|
||||
var command = new CreateForeignKeyCommand(name, string.Concat(_formatPrefix(_featurePrefix), srcTable), srcColumns, string.Concat(_formatPrefix(_featurePrefix), destTable), destColumns);
|
||||
var command = new CreateForeignKeyCommand(name, string.Concat(FormatPrefix(FeaturePrefix), srcTable), srcColumns, string.Concat(FormatPrefix(FeaturePrefix), destTable), destColumns);
|
||||
Run(command);
|
||||
return this;
|
||||
}
|
||||
|
||||
public SchemaBuilder CreateForeignKey(string name, string srcModule, string srcTable, string[] srcColumns, string destTable, string[] destColumns)
|
||||
{
|
||||
var command = new CreateForeignKeyCommand(name, string.Concat(_formatPrefix(srcModule), srcTable), srcColumns, string.Concat(_formatPrefix(_featurePrefix), destTable), destColumns);
|
||||
var command = new CreateForeignKeyCommand(name, string.Concat(FormatPrefix(srcModule), srcTable), srcColumns, string.Concat(FormatPrefix(FeaturePrefix), destTable), destColumns);
|
||||
Run(command);
|
||||
return this;
|
||||
}
|
||||
|
||||
public SchemaBuilder CreateForeignKey(string name, string srcTable, string[] srcColumns, string destModule, string destTable, string[] destColumns)
|
||||
{
|
||||
var command = new CreateForeignKeyCommand(name, string.Concat(_formatPrefix(_featurePrefix), srcTable), srcColumns, string.Concat(_formatPrefix(destModule), destTable), destColumns);
|
||||
var command = new CreateForeignKeyCommand(name, string.Concat(FormatPrefix(FeaturePrefix), srcTable), srcColumns, string.Concat(FormatPrefix(destModule), destTable), destColumns);
|
||||
Run(command);
|
||||
return this;
|
||||
}
|
||||
|
||||
public SchemaBuilder CreateForeignKey(string name, string srcModule, string srcTable, string[] srcColumns, string destModule, string destTable, string[] destColumns)
|
||||
{
|
||||
var command = new CreateForeignKeyCommand(name, string.Concat(_formatPrefix(srcModule), srcTable), srcColumns, string.Concat(_formatPrefix(destModule), destTable), destColumns);
|
||||
var command = new CreateForeignKeyCommand(name, string.Concat(FormatPrefix(srcModule), srcTable), srcColumns, string.Concat(FormatPrefix(destModule), destTable), destColumns);
|
||||
Run(command);
|
||||
return this;
|
||||
}
|
||||
|
||||
public SchemaBuilder DropForeignKey(string srcTable, string name)
|
||||
{
|
||||
var command = new DropForeignKeyCommand(string.Concat(_formatPrefix(_featurePrefix), srcTable), name);
|
||||
var command = new DropForeignKeyCommand(string.Concat(FormatPrefix(FeaturePrefix), srcTable), name);
|
||||
Run(command);
|
||||
return this;
|
||||
}
|
||||
|
||||
public SchemaBuilder DropForeignKey(string srcModule, string srcTable, string name)
|
||||
{
|
||||
var command = new DropForeignKeyCommand(string.Concat(_formatPrefix(srcModule), srcTable), name);
|
||||
var command = new DropForeignKeyCommand(string.Concat(FormatPrefix(srcModule), srcTable), name);
|
||||
Run(command);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -6,18 +6,16 @@ namespace Orchard.Data
|
||||
{
|
||||
public class Orderable<T>
|
||||
{
|
||||
private IQueryable<T> _queryable;
|
||||
|
||||
public Orderable(IQueryable<T> enumerable)
|
||||
{
|
||||
_queryable = enumerable;
|
||||
Queryable = enumerable;
|
||||
}
|
||||
|
||||
public IQueryable<T> Queryable => _queryable;
|
||||
public IQueryable<T> Queryable { get; private set; }
|
||||
|
||||
public Orderable<T> Asc<TKey>(Expression<Func<T, TKey>> keySelector)
|
||||
{
|
||||
_queryable = _queryable
|
||||
Queryable = Queryable
|
||||
.OrderBy(keySelector);
|
||||
return this;
|
||||
}
|
||||
@@ -25,7 +23,7 @@ namespace Orchard.Data
|
||||
public Orderable<T> Asc<TKey1, TKey2>(Expression<Func<T, TKey1>> keySelector1,
|
||||
Expression<Func<T, TKey2>> keySelector2)
|
||||
{
|
||||
_queryable = _queryable
|
||||
Queryable = Queryable
|
||||
.OrderBy(keySelector1)
|
||||
.OrderBy(keySelector2);
|
||||
return this;
|
||||
@@ -35,7 +33,7 @@ namespace Orchard.Data
|
||||
Expression<Func<T, TKey2>> keySelector2,
|
||||
Expression<Func<T, TKey3>> keySelector3)
|
||||
{
|
||||
_queryable = _queryable
|
||||
Queryable = Queryable
|
||||
.OrderBy(keySelector1)
|
||||
.OrderBy(keySelector2)
|
||||
.OrderBy(keySelector3);
|
||||
@@ -44,7 +42,7 @@ namespace Orchard.Data
|
||||
|
||||
public Orderable<T> Desc<TKey>(Expression<Func<T, TKey>> keySelector)
|
||||
{
|
||||
_queryable = _queryable
|
||||
Queryable = Queryable
|
||||
.OrderByDescending(keySelector);
|
||||
return this;
|
||||
}
|
||||
@@ -52,7 +50,7 @@ namespace Orchard.Data
|
||||
public Orderable<T> Desc<TKey1, TKey2>(Expression<Func<T, TKey1>> keySelector1,
|
||||
Expression<Func<T, TKey2>> keySelector2)
|
||||
{
|
||||
_queryable = _queryable
|
||||
Queryable = Queryable
|
||||
.OrderByDescending(keySelector1)
|
||||
.OrderByDescending(keySelector2);
|
||||
return this;
|
||||
@@ -62,7 +60,7 @@ namespace Orchard.Data
|
||||
Expression<Func<T, TKey2>> keySelector2,
|
||||
Expression<Func<T, TKey3>> keySelector3)
|
||||
{
|
||||
_queryable = _queryable
|
||||
Queryable = Queryable
|
||||
.OrderByDescending(keySelector1)
|
||||
.OrderByDescending(keySelector2)
|
||||
.OrderByDescending(keySelector3);
|
||||
|
||||
@@ -15,9 +15,6 @@ namespace Orchard.DisplayManagement.Shapes
|
||||
{
|
||||
public class Composite : DynamicObject
|
||||
{
|
||||
|
||||
private readonly IDictionary _props = new HybridDictionary();
|
||||
|
||||
public override bool TryGetMember(GetMemberBinder binder, out object result)
|
||||
{
|
||||
return TryGetMemberImpl(binder.Name, out result);
|
||||
@@ -25,9 +22,9 @@ namespace Orchard.DisplayManagement.Shapes
|
||||
|
||||
protected virtual bool TryGetMemberImpl(string name, out object result)
|
||||
{
|
||||
if (_props.Contains(name))
|
||||
if (Properties.Contains(name))
|
||||
{
|
||||
result = _props[name];
|
||||
result = Properties[name];
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -42,7 +39,7 @@ namespace Orchard.DisplayManagement.Shapes
|
||||
|
||||
protected bool TrySetMemberImpl(string name, object value)
|
||||
{
|
||||
_props[name] = value;
|
||||
Properties[name] = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -83,9 +80,9 @@ namespace Orchard.DisplayManagement.Shapes
|
||||
|
||||
var index = indexes.Single();
|
||||
|
||||
if (_props.Contains(index))
|
||||
if (Properties.Contains(index))
|
||||
{
|
||||
result = _props[index];
|
||||
result = Properties[index];
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -117,11 +114,11 @@ namespace Orchard.DisplayManagement.Shapes
|
||||
return true;
|
||||
}
|
||||
|
||||
_props[indexes.Single()] = value;
|
||||
Properties[indexes.Single()] = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
public IDictionary Properties => _props;
|
||||
public IDictionary Properties { get; } = new HybridDictionary();
|
||||
|
||||
public static bool operator ==(Composite a, Nil b) => null == a;
|
||||
|
||||
@@ -129,7 +126,7 @@ namespace Orchard.DisplayManagement.Shapes
|
||||
|
||||
protected bool Equals(Composite other)
|
||||
{
|
||||
return Equals(_props, other._props);
|
||||
return Equals(Properties, other.Properties);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
@@ -151,7 +148,7 @@ namespace Orchard.DisplayManagement.Shapes
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return (_props != null ? _props.GetHashCode() : 0);
|
||||
return (Properties != null ? Properties.GetHashCode() : 0);
|
||||
}
|
||||
|
||||
#region InterfaceProxyBehavior
|
||||
@@ -459,8 +456,7 @@ namespace Orchard.DisplayManagement.Shapes
|
||||
|
||||
public class Nil : DynamicObject
|
||||
{
|
||||
static readonly Nil Singleton = new Nil();
|
||||
public static Nil Instance => Singleton;
|
||||
public static Nil Instance { get; } = new Nil();
|
||||
|
||||
private Nil()
|
||||
{
|
||||
|
||||
@@ -24,7 +24,6 @@ namespace Orchard.Environment
|
||||
private readonly IRoutePublisher _routePublisher;
|
||||
private readonly IEnumerable<IModelBinderProvider> _modelBinderProviders;
|
||||
private readonly IModelBinderPublisher _modelBinderPublisher;
|
||||
private readonly ISweepGenerator _sweepGenerator;
|
||||
private readonly IEnumerable<IOwinMiddlewareProvider> _owinMiddlewareProviders;
|
||||
private readonly ShellSettings _shellSettings;
|
||||
|
||||
@@ -45,7 +44,7 @@ namespace Orchard.Environment
|
||||
_routePublisher = routePublisher;
|
||||
_modelBinderProviders = modelBinderProviders;
|
||||
_modelBinderPublisher = modelBinderPublisher;
|
||||
_sweepGenerator = sweepGenerator;
|
||||
Sweep = sweepGenerator;
|
||||
_owinMiddlewareProviders = owinMiddlewareProviders;
|
||||
_shellSettings = shellSettings;
|
||||
|
||||
@@ -53,7 +52,7 @@ namespace Orchard.Environment
|
||||
}
|
||||
|
||||
public ILogger Logger { get; set; }
|
||||
public ISweepGenerator Sweep => _sweepGenerator;
|
||||
public ISweepGenerator Sweep { get; }
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
@@ -94,7 +93,7 @@ namespace Orchard.Environment
|
||||
}
|
||||
}
|
||||
|
||||
_sweepGenerator.Activate();
|
||||
Sweep.Activate();
|
||||
}
|
||||
|
||||
public void Terminate()
|
||||
@@ -110,7 +109,7 @@ namespace Orchard.Environment
|
||||
}
|
||||
});
|
||||
|
||||
SafelyTerminate(() => _sweepGenerator.Terminate());
|
||||
SafelyTerminate(() => Sweep.Terminate());
|
||||
}
|
||||
|
||||
private void SafelyTerminate(Action action)
|
||||
|
||||
@@ -70,13 +70,12 @@ namespace Orchard.Environment
|
||||
|
||||
class HttpContextScopeImplementation : IWorkContextScope
|
||||
{
|
||||
readonly WorkContext _workContext;
|
||||
readonly Action _disposer;
|
||||
|
||||
public HttpContextScopeImplementation(IEnumerable<IWorkContextEvents> events, ILifetimeScope lifetimeScope, HttpContextBase httpContext, object workContextKey)
|
||||
{
|
||||
_workContext = lifetimeScope.Resolve<WorkContext>();
|
||||
httpContext.Items[workContextKey] = _workContext;
|
||||
WorkContext = lifetimeScope.Resolve<WorkContext>();
|
||||
httpContext.Items[workContextKey] = WorkContext;
|
||||
|
||||
_disposer = () =>
|
||||
{
|
||||
@@ -91,7 +90,7 @@ namespace Orchard.Environment
|
||||
_disposer();
|
||||
}
|
||||
|
||||
public WorkContext WorkContext => _workContext;
|
||||
public WorkContext WorkContext { get; }
|
||||
|
||||
public TService Resolve<TService>()
|
||||
{
|
||||
@@ -106,7 +105,6 @@ namespace Orchard.Environment
|
||||
|
||||
class CallContextScopeImplementation : IWorkContextScope
|
||||
{
|
||||
readonly WorkContext _workContext;
|
||||
readonly Action _disposer;
|
||||
|
||||
public CallContextScopeImplementation(IEnumerable<IWorkContextEvents> events, ILifetimeScope lifetimeScope, string workContextSlot)
|
||||
@@ -114,11 +112,11 @@ namespace Orchard.Environment
|
||||
|
||||
CallContext.LogicalSetData(workContextSlot, null);
|
||||
|
||||
_workContext = lifetimeScope.Resolve<WorkContext>();
|
||||
WorkContext = lifetimeScope.Resolve<WorkContext>();
|
||||
var httpContext = lifetimeScope.Resolve<HttpContextBase>();
|
||||
_workContext.HttpContext = httpContext;
|
||||
WorkContext.HttpContext = httpContext;
|
||||
|
||||
CallContext.LogicalSetData(workContextSlot, new ObjectHandle(_workContext));
|
||||
CallContext.LogicalSetData(workContextSlot, new ObjectHandle(WorkContext));
|
||||
|
||||
_disposer = () =>
|
||||
{
|
||||
@@ -133,7 +131,7 @@ namespace Orchard.Environment
|
||||
_disposer();
|
||||
}
|
||||
|
||||
public WorkContext WorkContext => _workContext;
|
||||
public WorkContext WorkContext { get; }
|
||||
|
||||
public TService Resolve<TService>()
|
||||
{
|
||||
|
||||
@@ -9,23 +9,18 @@ namespace Orchard.Localization
|
||||
/// </summary>
|
||||
public class LocalizedString : MarshalByRefObject, IHtmlString
|
||||
{
|
||||
private readonly string _localized;
|
||||
private readonly string _scope;
|
||||
private readonly string _textHint;
|
||||
private readonly object[] _args;
|
||||
|
||||
public LocalizedString(string languageNeutral)
|
||||
{
|
||||
_localized = languageNeutral;
|
||||
_textHint = languageNeutral;
|
||||
Text = languageNeutral;
|
||||
TextHint = languageNeutral;
|
||||
}
|
||||
|
||||
public LocalizedString(string localized, string scope, string textHint, object[] args)
|
||||
{
|
||||
_localized = localized;
|
||||
_scope = scope;
|
||||
_textHint = textHint;
|
||||
_args = args;
|
||||
Text = localized;
|
||||
Scope = scope;
|
||||
TextHint = textHint;
|
||||
Args = args;
|
||||
}
|
||||
|
||||
public static LocalizedString TextOrDefault(string text, LocalizedString defaultValue)
|
||||
@@ -35,38 +30,38 @@ namespace Orchard.Localization
|
||||
return new LocalizedString(text);
|
||||
}
|
||||
|
||||
public string Scope => _scope;
|
||||
public string Scope { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The HTML-Encoded original text
|
||||
/// </summary>
|
||||
public string TextHint => _textHint;
|
||||
public string TextHint { get; }
|
||||
|
||||
public object[] Args => _args;
|
||||
public object[] Args { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The HTML-encoded localized text
|
||||
/// </summary>
|
||||
public string Text => _localized;
|
||||
public string Text { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The HTML-encoded localized text
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
return _localized;
|
||||
return Text;
|
||||
}
|
||||
|
||||
string IHtmlString.ToHtmlString()
|
||||
{
|
||||
return _localized;
|
||||
return Text;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
var hashCode = 0;
|
||||
if (_localized != null)
|
||||
hashCode ^= _localized.GetHashCode();
|
||||
if (Text != null)
|
||||
hashCode ^= Text.GetHashCode();
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
@@ -76,7 +71,7 @@ namespace Orchard.Localization
|
||||
return false;
|
||||
|
||||
var that = (LocalizedString)obj;
|
||||
return string.Equals(_localized, that._localized);
|
||||
return string.Equals(Text, that.Text);
|
||||
}
|
||||
|
||||
public override object InitializeLifetimeService()
|
||||
|
||||
@@ -10,25 +10,21 @@ namespace Orchard.Localization.Models
|
||||
|
||||
public DateParts(int year, int month, int day)
|
||||
{
|
||||
_year = year;
|
||||
_month = month;
|
||||
_day = day;
|
||||
Year = year;
|
||||
Month = month;
|
||||
Day = day;
|
||||
}
|
||||
|
||||
private readonly int _day;
|
||||
private readonly int _month;
|
||||
private readonly int _year;
|
||||
|
||||
public int Year => _year;
|
||||
public int Month => _month;
|
||||
public int Day => _day;
|
||||
public int Year { get; }
|
||||
public int Month { get; }
|
||||
public int Day { get; }
|
||||
|
||||
public DateTime ToDateTime(Calendar calendar)
|
||||
{
|
||||
return new DateTime(
|
||||
_year > 0 ? _year : DateTime.MinValue.Year,
|
||||
_month > 0 ? _month : DateTime.MinValue.Month,
|
||||
_day > 0 ? _day : DateTime.MinValue.Day,
|
||||
Year > 0 ? Year : DateTime.MinValue.Year,
|
||||
Month > 0 ? Month : DateTime.MinValue.Month,
|
||||
Day > 0 ? Day : DateTime.MinValue.Day,
|
||||
DateTime.MinValue.Hour,
|
||||
DateTime.MinValue.Minute,
|
||||
DateTime.MinValue.Second,
|
||||
@@ -39,7 +35,7 @@ namespace Orchard.Localization.Models
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}-{1}-{2}", _year, _month, _day);
|
||||
return string.Format("{0}-{1}-{2}", Year, Month, Day);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,22 +18,19 @@ namespace Orchard.Localization.Models
|
||||
|
||||
public DateTimeParts(int year, int month, int day, int hour, int minute, int second, int millisecond, DateTimeKind kind, TimeSpan offset)
|
||||
{
|
||||
_date = new DateParts(year, month, day);
|
||||
_time = new TimeParts(hour, minute, second, millisecond, kind, offset);
|
||||
Date = new DateParts(year, month, day);
|
||||
Time = new TimeParts(hour, minute, second, millisecond, kind, offset);
|
||||
}
|
||||
|
||||
public DateTimeParts(DateParts dateParts, TimeParts timeParts)
|
||||
{
|
||||
_date = dateParts;
|
||||
_time = timeParts;
|
||||
Date = dateParts;
|
||||
Time = timeParts;
|
||||
}
|
||||
|
||||
private readonly DateParts _date;
|
||||
private readonly TimeParts _time;
|
||||
public DateParts Date { get; }
|
||||
|
||||
public DateParts Date => _date;
|
||||
|
||||
public TimeParts Time => _time;
|
||||
public TimeParts Time { get; }
|
||||
|
||||
public DateTime ToDateTime(Calendar calendar)
|
||||
{
|
||||
@@ -52,7 +49,7 @@ namespace Orchard.Localization.Models
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0} {1}", _date, _time);
|
||||
return string.Format("{0} {1}", Date, Time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,30 +13,25 @@ namespace Orchard.Localization.Models
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(string.Format("The specified offset {0} does not match the specified kind {1}.", offset, kind));
|
||||
}
|
||||
_hour = hour;
|
||||
_minute = minute;
|
||||
_second = second;
|
||||
_millisecond = millisecond;
|
||||
_kind = kind;
|
||||
Hour = hour;
|
||||
Minute = minute;
|
||||
Second = second;
|
||||
Millisecond = millisecond;
|
||||
Kind = kind;
|
||||
_offset = offset;
|
||||
}
|
||||
|
||||
private readonly int _hour;
|
||||
private readonly int _minute;
|
||||
private readonly int _second;
|
||||
private readonly int _millisecond;
|
||||
private readonly DateTimeKind _kind;
|
||||
private readonly TimeSpan _offset;
|
||||
|
||||
public int Hour => _hour;
|
||||
public int Hour { get; }
|
||||
|
||||
public int Minute => _minute;
|
||||
public int Minute { get; }
|
||||
|
||||
public int Second => _second;
|
||||
public int Second { get; }
|
||||
|
||||
public int Millisecond => _millisecond;
|
||||
public int Millisecond { get; }
|
||||
|
||||
public DateTimeKind Kind => _kind;
|
||||
public DateTimeKind Kind { get; }
|
||||
|
||||
public TimeSpan? Offset => _offset;
|
||||
|
||||
@@ -46,17 +41,17 @@ namespace Orchard.Localization.Models
|
||||
DateTime.MinValue.Year,
|
||||
DateTime.MinValue.Month,
|
||||
DateTime.MinValue.Day,
|
||||
_hour > 0 ? _hour : DateTime.MinValue.Hour,
|
||||
_minute > 0 ? _minute : DateTime.MinValue.Minute,
|
||||
_second > 0 ? _second : DateTime.MinValue.Second,
|
||||
_millisecond > 0 ? _millisecond : DateTime.MinValue.Millisecond,
|
||||
_kind
|
||||
Hour > 0 ? Hour : DateTime.MinValue.Hour,
|
||||
Minute > 0 ? Minute : DateTime.MinValue.Minute,
|
||||
Second > 0 ? Second : DateTime.MinValue.Second,
|
||||
Millisecond > 0 ? Millisecond : DateTime.MinValue.Millisecond,
|
||||
Kind
|
||||
);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}:{1}:{2}.{3}-{4}-{5}", _hour, _minute, _second, _millisecond, _kind, _offset);
|
||||
return string.Format("{0}:{1}:{2}.{3}-{4}-{5}", Hour, Minute, Second, Millisecond, Kind, _offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,9 @@ namespace Orchard.Localization
|
||||
|
||||
static NullLocalizer()
|
||||
{
|
||||
_instance = (format, args) => new LocalizedString((args == null || args.Length == 0) ? format : string.Format(format, args));
|
||||
Instance = (format, args) => new LocalizedString((args == null || args.Length == 0) ? format : string.Format(format, args));
|
||||
}
|
||||
|
||||
static readonly Localizer _instance;
|
||||
|
||||
public static Localizer Instance => _instance;
|
||||
public static Localizer Instance { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,7 @@ namespace Orchard.Logging
|
||||
{
|
||||
public class NullLogger : ILogger
|
||||
{
|
||||
private static readonly ILogger _instance = new NullLogger();
|
||||
|
||||
public static ILogger Instance => _instance;
|
||||
public static ILogger Instance { get; } = new NullLogger();
|
||||
|
||||
public bool IsEnabled(LogLevel level)
|
||||
{
|
||||
|
||||
@@ -95,18 +95,17 @@ namespace Orchard.Mvc.AntiForgery
|
||||
|
||||
private class HackHttpContext : HttpContextWrapper
|
||||
{
|
||||
private readonly HttpContextBase _originalHttpContextBase;
|
||||
private readonly HttpContext _originalHttpContext;
|
||||
private HttpRequestWrapper _request;
|
||||
|
||||
public HackHttpContext(HttpContextBase httpContextBase, HttpContext httpContext)
|
||||
: base(httpContext)
|
||||
{
|
||||
_originalHttpContextBase = httpContextBase;
|
||||
OriginalHttpContextBase = httpContextBase;
|
||||
_originalHttpContext = httpContext;
|
||||
}
|
||||
|
||||
public HttpContextBase OriginalHttpContextBase => _originalHttpContextBase;
|
||||
public HttpContextBase OriginalHttpContextBase { get; }
|
||||
|
||||
public override HttpRequestBase Request
|
||||
{
|
||||
|
||||
@@ -6,15 +6,13 @@ namespace Orchard.Mvc.AntiForgery
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public class ValidateAntiForgeryTokenOrchardAttribute : FilterAttribute
|
||||
{
|
||||
private readonly bool _enabled = true;
|
||||
|
||||
public ValidateAntiForgeryTokenOrchardAttribute() : this(true) { }
|
||||
|
||||
public ValidateAntiForgeryTokenOrchardAttribute(bool enabled)
|
||||
{
|
||||
_enabled = enabled;
|
||||
Enabled = enabled;
|
||||
}
|
||||
|
||||
public bool Enabled => _enabled;
|
||||
public bool Enabled { get; } = true;
|
||||
}
|
||||
}
|
||||
@@ -20,11 +20,9 @@ namespace Orchard.Mvc
|
||||
private ResourceRegister _stylesheetRegister;
|
||||
|
||||
private object _display;
|
||||
private Localizer _localizer = NullLocalizer.Instance;
|
||||
private object _layout;
|
||||
private WorkContext _workContext;
|
||||
|
||||
public Localizer T => _localizer;
|
||||
public Localizer T { get; private set; } = NullLocalizer.Instance;
|
||||
public dynamic Display => _display;
|
||||
public ScriptRegister Script
|
||||
{
|
||||
@@ -36,16 +34,16 @@ namespace Orchard.Mvc
|
||||
}
|
||||
|
||||
public dynamic Layout => _layout;
|
||||
public WorkContext WorkContext => _workContext;
|
||||
public WorkContext WorkContext { get; private set; }
|
||||
|
||||
private IDisplayHelperFactory _displayHelperFactory;
|
||||
public IDisplayHelperFactory DisplayHelperFactory => _displayHelperFactory ?? (_displayHelperFactory = _workContext.Resolve<IDisplayHelperFactory>());
|
||||
public IDisplayHelperFactory DisplayHelperFactory => _displayHelperFactory ?? (_displayHelperFactory = WorkContext.Resolve<IDisplayHelperFactory>());
|
||||
|
||||
private IShapeFactory _shapeFactory;
|
||||
public IShapeFactory ShapeFactory => _shapeFactory ?? (_shapeFactory = _workContext.Resolve<IShapeFactory>());
|
||||
public IShapeFactory ShapeFactory => _shapeFactory ?? (_shapeFactory = WorkContext.Resolve<IShapeFactory>());
|
||||
|
||||
private IAuthorizer _authorizer;
|
||||
public IAuthorizer Authorizer => _authorizer ?? (_authorizer = _workContext.Resolve<IAuthorizer>());
|
||||
public IAuthorizer Authorizer => _authorizer ?? (_authorizer = WorkContext.Resolve<IAuthorizer>());
|
||||
|
||||
public ResourceRegister Style
|
||||
{
|
||||
@@ -60,11 +58,11 @@ namespace Orchard.Mvc
|
||||
{
|
||||
base.InitHelpers();
|
||||
|
||||
_workContext = ViewContext.GetWorkContext();
|
||||
WorkContext = ViewContext.GetWorkContext();
|
||||
|
||||
_localizer = LocalizationUtilities.Resolve(ViewContext, AppRelativeVirtualPath);
|
||||
T = LocalizationUtilities.Resolve(ViewContext, AppRelativeVirtualPath);
|
||||
_display = DisplayHelperFactory.CreateHelper(ViewContext, this);
|
||||
_layout = _workContext.Layout;
|
||||
_layout = WorkContext.Layout;
|
||||
}
|
||||
|
||||
public virtual void RegisterLink(LinkEntry link)
|
||||
|
||||
@@ -18,24 +18,22 @@ namespace Orchard.Mvc
|
||||
private ResourceRegister _stylesheetRegister;
|
||||
|
||||
private object _display;
|
||||
private Localizer _localizer = NullLocalizer.Instance;
|
||||
private object _layout;
|
||||
private WorkContext _workContext;
|
||||
|
||||
public Localizer T => _localizer;
|
||||
public Localizer T { get; private set; } = NullLocalizer.Instance;
|
||||
public dynamic Display => _display;
|
||||
public dynamic New => ShapeFactory;
|
||||
public dynamic Layout => _layout;
|
||||
public WorkContext WorkContext => _workContext;
|
||||
public WorkContext WorkContext { get; private set; }
|
||||
|
||||
private IDisplayHelperFactory _displayHelperFactory;
|
||||
public IDisplayHelperFactory DisplayHelperFactory => _displayHelperFactory ?? (_displayHelperFactory = _workContext.Resolve<IDisplayHelperFactory>());
|
||||
public IDisplayHelperFactory DisplayHelperFactory => _displayHelperFactory ?? (_displayHelperFactory = WorkContext.Resolve<IDisplayHelperFactory>());
|
||||
|
||||
private IShapeFactory _shapeFactory;
|
||||
public IShapeFactory ShapeFactory => _shapeFactory ?? (_shapeFactory = _workContext.Resolve<IShapeFactory>());
|
||||
public IShapeFactory ShapeFactory => _shapeFactory ?? (_shapeFactory = WorkContext.Resolve<IShapeFactory>());
|
||||
|
||||
private IAuthorizer _authorizer;
|
||||
public IAuthorizer Authorizer => _authorizer ?? (_authorizer = _workContext.Resolve<IAuthorizer>());
|
||||
public IAuthorizer Authorizer => _authorizer ?? (_authorizer = WorkContext.Resolve<IAuthorizer>());
|
||||
|
||||
public ScriptRegister Script
|
||||
{
|
||||
@@ -83,11 +81,11 @@ namespace Orchard.Mvc
|
||||
|
||||
public override void RenderView(ViewContext viewContext)
|
||||
{
|
||||
_workContext = viewContext.GetWorkContext();
|
||||
WorkContext = viewContext.GetWorkContext();
|
||||
|
||||
_localizer = LocalizationUtilities.Resolve(viewContext, AppRelativeVirtualPath);
|
||||
T = LocalizationUtilities.Resolve(viewContext, AppRelativeVirtualPath);
|
||||
_display = DisplayHelperFactory.CreateHelper(viewContext, this);
|
||||
_layout = _workContext.Layout;
|
||||
_layout = WorkContext.Layout;
|
||||
|
||||
base.RenderView(viewContext);
|
||||
}
|
||||
|
||||
@@ -3,14 +3,6 @@ namespace Orchard.Security
|
||||
//TEMP: Add setters, provide default constructor and remove parameterized constructor
|
||||
public class CreateUserParams
|
||||
{
|
||||
private readonly string _username;
|
||||
private readonly string _password;
|
||||
private readonly string _email;
|
||||
private readonly string _passwordQuestion;
|
||||
private readonly string _passwordAnswer;
|
||||
private readonly bool _isApproved;
|
||||
private readonly bool _forcePasswordChange;
|
||||
|
||||
public CreateUserParams(string username, string password, string email)
|
||||
: this(username, password, email, string.Empty, string.Empty, true, false) { }
|
||||
|
||||
@@ -19,27 +11,27 @@ namespace Orchard.Security
|
||||
|
||||
public CreateUserParams(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, bool forcePasswordChange)
|
||||
{
|
||||
_username = username;
|
||||
_password = password;
|
||||
_email = email;
|
||||
_passwordQuestion = passwordQuestion;
|
||||
_passwordAnswer = passwordAnswer;
|
||||
_isApproved = isApproved;
|
||||
_forcePasswordChange = forcePasswordChange;
|
||||
Username = username;
|
||||
Password = password;
|
||||
Email = email;
|
||||
PasswordQuestion = passwordQuestion;
|
||||
PasswordAnswer = passwordAnswer;
|
||||
IsApproved = isApproved;
|
||||
ForcePasswordChange = forcePasswordChange;
|
||||
}
|
||||
|
||||
public string Username => _username;
|
||||
public string Username { get; }
|
||||
|
||||
public string Password => _password;
|
||||
public string Password { get; }
|
||||
|
||||
public string Email => _email;
|
||||
public string Email { get; }
|
||||
|
||||
public string PasswordQuestion => _passwordQuestion;
|
||||
public string PasswordQuestion { get; }
|
||||
|
||||
public string PasswordAnswer => _passwordAnswer;
|
||||
public string PasswordAnswer { get; }
|
||||
|
||||
public bool IsApproved => _isApproved;
|
||||
public bool IsApproved { get; }
|
||||
|
||||
public bool ForcePasswordChange => _forcePasswordChange;
|
||||
public bool ForcePasswordChange { get; }
|
||||
}
|
||||
}
|
||||
@@ -7,21 +7,20 @@ namespace Orchard.Tasks.Locking.Services
|
||||
{
|
||||
|
||||
private readonly string _name;
|
||||
private readonly string _internalName;
|
||||
private readonly Action _releaseLockAction;
|
||||
private int _count;
|
||||
|
||||
internal DistributedLock(string name, string internalName, Action releaseLockAction)
|
||||
{
|
||||
_name = name;
|
||||
_internalName = internalName;
|
||||
InternalName = internalName;
|
||||
_releaseLockAction = releaseLockAction;
|
||||
_count = 1;
|
||||
}
|
||||
|
||||
string IDistributedLock.Name => _name;
|
||||
|
||||
internal string InternalName => _internalName;
|
||||
internal string InternalName { get; }
|
||||
|
||||
internal void Increment()
|
||||
{
|
||||
|
||||
@@ -7,7 +7,6 @@ namespace Orchard.WebApi
|
||||
{
|
||||
public class AutofacWebApiDependencyResolver : IDependencyResolver
|
||||
{
|
||||
readonly ILifetimeScope _container;
|
||||
readonly IDependencyScope _rootDependencyScope;
|
||||
|
||||
//internal static readonly string ApiRequestTag = "AutofacWebRequest";
|
||||
@@ -16,11 +15,11 @@ namespace Orchard.WebApi
|
||||
{
|
||||
if (container == null) throw new ArgumentNullException("container");
|
||||
|
||||
_container = container;
|
||||
Container = container;
|
||||
_rootDependencyScope = new AutofacWebApiDependencyScope(container);
|
||||
}
|
||||
|
||||
public ILifetimeScope Container => _container;
|
||||
public ILifetimeScope Container { get; }
|
||||
|
||||
public object GetService(Type serviceType)
|
||||
{
|
||||
@@ -34,7 +33,7 @@ namespace Orchard.WebApi
|
||||
|
||||
public IDependencyScope BeginScope()
|
||||
{
|
||||
ILifetimeScope lifetimeScope = _container.BeginLifetimeScope();
|
||||
ILifetimeScope lifetimeScope = Container.BeginLifetimeScope();
|
||||
return new AutofacWebApiDependencyScope(lifetimeScope);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,18 +20,17 @@ namespace Orchard.Parameters
|
||||
public class State
|
||||
{
|
||||
private readonly string _commandLine;
|
||||
private readonly StringBuilder _stringBuilder;
|
||||
private readonly List<string> _arguments;
|
||||
private int _index;
|
||||
|
||||
public State(string commandLine)
|
||||
{
|
||||
_commandLine = commandLine;
|
||||
_stringBuilder = new StringBuilder();
|
||||
StringBuilder = new StringBuilder();
|
||||
_arguments = new List<string>();
|
||||
}
|
||||
|
||||
public StringBuilder StringBuilder => _stringBuilder;
|
||||
public StringBuilder StringBuilder { get; }
|
||||
public bool EOF => _index >= _commandLine.Length;
|
||||
public char Current => _commandLine[_index];
|
||||
public IEnumerable<string> Arguments => _arguments;
|
||||
|
||||
Reference in New Issue
Block a user