mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 10:54:50 +08:00
Merge perf => dev
--HG-- branch : dev
This commit is contained in:
2
.hgtags
2
.hgtags
@@ -1,8 +1,10 @@
|
||||
e048b594f33613d53b59a3578d17511dc833ecb5 MIX10
|
||||
a6b8d094848d4efee67c787e52e5f7d358e3f0c1 0.5
|
||||
48d6ca62955335ce6a51859d5fab43b3b48d1911 0.8
|
||||
0ffac89fcc3013edf7283f6ebd761ee967368e77 perf first pass
|
||||
48d6ca62955335ce6a51859d5fab43b3b48d1911 0.8
|
||||
0000000000000000000000000000000000000000 0.8
|
||||
0000000000000000000000000000000000000000 0.8
|
||||
083d09cd94a7c9175272fba453a156673be9db78 0.8
|
||||
523f3564d2c053ff068970eab8c64eaf74e3dcec perf baseline
|
||||
d2cca954cbf94750946a6325e5ec23e267430bd2 perf snapshot 1
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -486,6 +486,12 @@
|
||||
<!-- Badly formed XML comment ignored for member "M:NHibernate.Linq.Visitors.Evaluator.PartialEval(System.Linq.Expressions.Expression,System.Func{System.Linq.Expressions.Expression,System.Boolean})" -->
|
||||
<!-- Badly formed XML comment ignored for member "M:NHibernate.Linq.Visitors.Evaluator.PartialEval(System.Linq.Expressions.Expression)" -->
|
||||
<!-- Badly formed XML comment ignored for member "T:NHibernate.Linq.Visitors.Evaluator.SubtreeEvaluator" -->
|
||||
<member name="T:NHibernate.Linq.Visitors.Evaluator.Condensor">
|
||||
<summary>
|
||||
Brings certain basic expression patterns closer to the surface to
|
||||
avoid a lambda compile and dynamic invoke in simple cases
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:NHibernate.Linq.Visitors.Evaluator.Nominator">
|
||||
<summary>
|
||||
Performs bottom-up analysis to determine which nodes can possibly
|
||||
|
156
lib/linqnhibernate/condensing-constant-expressions.patch
Normal file
156
lib/linqnhibernate/condensing-constant-expressions.patch
Normal file
@@ -0,0 +1,156 @@
|
||||
Index: src/NHibernate.Linq/src/NHibernate.Linq/Visitors/Evaluator.cs
|
||||
===================================================================
|
||||
--- src/NHibernate.Linq/src/NHibernate.Linq/Visitors/Evaluator.cs (revision 1432)
|
||||
+++ src/NHibernate.Linq/src/NHibernate.Linq/Visitors/Evaluator.cs (working copy)
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
+using System.Reflection;
|
||||
|
||||
namespace NHibernate.Linq.Visitors
|
||||
{
|
||||
@@ -76,12 +77,143 @@
|
||||
if (e.NodeType == ExpressionType.Lambda)
|
||||
return e;
|
||||
|
||||
+ Expression condensed = new Condensor().Visit(e);
|
||||
+ if (condensed.NodeType == ExpressionType.Constant)
|
||||
+ return condensed;
|
||||
+
|
||||
LambdaExpression lambda = Expression.Lambda(e);
|
||||
Delegate fn = lambda.Compile();
|
||||
return Expression.Constant(fn.DynamicInvoke(null), e.Type);
|
||||
}
|
||||
}
|
||||
|
||||
+ /// <summary>
|
||||
+ /// Brings certain basic expression patterns closer to the surface to
|
||||
+ /// avoid a lambda compile and dynamic invoke in simple cases
|
||||
+ /// </summary>
|
||||
+ class Condensor : ExpressionVisitor
|
||||
+ {
|
||||
+ protected override Expression VisitMemberAccess(MemberExpression m)
|
||||
+ {
|
||||
+ Expression exp = Visit(m.Expression);
|
||||
+
|
||||
+ object constant;
|
||||
+ if (m.NodeType== ExpressionType.MemberAccess && TryGetConstant(exp, out constant))
|
||||
+ {
|
||||
+ if (m.Member.MemberType == MemberTypes.Field)
|
||||
+ {
|
||||
+ FieldInfo field = (FieldInfo) m.Member;
|
||||
+ object value = field.GetValue(constant);
|
||||
+ return Expression.Constant(value, m.Type);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (exp != m.Expression)
|
||||
+ {
|
||||
+ return Expression.MakeMemberAccess(exp, m.Member);
|
||||
+ }
|
||||
+ return m;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ protected override Expression VisitUnary(UnaryExpression u) {
|
||||
+ Expression operand = Visit(u.Operand);
|
||||
+
|
||||
+ object constant;
|
||||
+ if (u.NodeType== ExpressionType.Convert && TryGetConstant(operand, out constant))
|
||||
+ {
|
||||
+ if (u.Method == null)
|
||||
+ {
|
||||
+ Func<object, object> converter = BindConverter(operand.Type, u.Type);
|
||||
+ object value = converter(constant);
|
||||
+ return Expression.Constant(value, u.Type);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (operand != u.Operand) {
|
||||
+ return Expression.MakeUnary(u.NodeType, operand, u.Type, u.Method);
|
||||
+ }
|
||||
+ return u;
|
||||
+ }
|
||||
+
|
||||
+ private static bool TryGetConstant(Expression expression, out object constant) {
|
||||
+ if (expression == null) {
|
||||
+ constant = null;
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ if (expression.NodeType == ExpressionType.Constant) {
|
||||
+ constant = ((ConstantExpression)expression).Value;
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ if (expression.NodeType == ExpressionType.New) {
|
||||
+ NewExpression nex = (NewExpression)expression;
|
||||
+ object[] constants;
|
||||
+ if (nex.Members == null && TryGetConstants(nex.Arguments, out constants)) {
|
||||
+ constant = nex.Constructor.Invoke(constants);
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ constant = null;
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ private static bool TryGetConstants(IList<Expression> expressions, out object[] constants) {
|
||||
+ if (expressions == null) {
|
||||
+ constants = null;
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ object[] results = new object[expressions.Count];
|
||||
+ for (int index = 0; index != expressions.Count; ++index) {
|
||||
+ if (!TryGetConstant(expressions[index], out results[index])) {
|
||||
+ constants = null;
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ constants = results;
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ private static readonly IDictionary<System.Type, IDictionary<System.Type, Func<object, object>>> _converterGroups = new Dictionary<System.Type, IDictionary<System.Type, Func<object, object>>>();
|
||||
+
|
||||
+ private static Func<object,object> BindConverter(System.Type inType, System.Type outType)
|
||||
+ {
|
||||
+ IDictionary<System.Type, Func<object, object>> converterGroup;
|
||||
+ lock(_converterGroups)
|
||||
+ {
|
||||
+ if (!_converterGroups.TryGetValue(inType, out converterGroup))
|
||||
+ {
|
||||
+ converterGroup = new Dictionary<System.Type, Func<object, object>>();
|
||||
+ _converterGroups[inType] = converterGroup;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ Func<object, object> converter;
|
||||
+ lock (converterGroup)
|
||||
+ {
|
||||
+ if (!converterGroup.TryGetValue(outType, out converter))
|
||||
+ {
|
||||
+ var arg0 = Expression.Parameter(typeof(object), "arg0");
|
||||
+ var lambda = Expression.Lambda<Func<object, object>>(
|
||||
+ Expression.ConvertChecked(
|
||||
+ Expression.Convert(
|
||||
+ Expression.ConvertChecked(arg0, inType),
|
||||
+ outType),
|
||||
+ typeof(object)),
|
||||
+ arg0);
|
||||
+ converter = lambda.Compile();
|
||||
+ converterGroup[outType] = converter;
|
||||
+ }
|
||||
+ }
|
||||
+ return converter;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/// <summary>
|
||||
/// Performs bottom-up analysis to determine which nodes can possibly
|
||||
/// be part of an evaluated sub-tree.
|
5
lib/linqnhibernate/orchard-buildnotes.txt
Normal file
5
lib/linqnhibernate/orchard-buildnotes.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
https://nhcontrib.svn.sourceforge.net/svnroot/nhcontrib/trunk/src/NHibernate.Linq
|
||||
at revision #1432
|
||||
applied condensing-constant-expressions.patch
|
||||
nant -D:project.config=release
|
@@ -1,47 +0,0 @@
|
||||
--- 2009-10-04 Osamu TAKEUCHI <osamu@big.jp>
|
||||
Alpha release of YamlSerializer as 0.9.0.2
|
||||
|
||||
* All "_"s in integer and floating point values are neglected
|
||||
to accommodate the !!int and !!float encoding.
|
||||
* YamlConfig.DontUseVerbatimTag is added but the default value is set false.
|
||||
Note that !<!System.Int32[,]> is much human friendly than !System.Int32%5B%2C%5D.
|
||||
* Equality of YamlNode with an unknown tag is evaluated by identity,
|
||||
while that of !!map and !!seq node is still evaluated by YAML's standard.
|
||||
Note that equality of !!map and !!seq are different from that of object[]
|
||||
and Dictionary<object, object>.
|
||||
* YamlConfig.OmitTagForRootNode was added. Fixed issue #2850.
|
||||
* Serialize Dictionary<object,object> to !!map. Fixed #2891.
|
||||
* Modified [126-130] ns-plain-???, [147] c-ns-flow-map-separate-value(n,c)
|
||||
to accommodate revision 2009-10-01
|
||||
* Omit !< > if Tag contains only ns-tag-char, Fixed issue #2813
|
||||
|
||||
--- 2009-09-23 Osamu TAKEUCHI <osamu@big.jp>
|
||||
Alpha release of YamlSerializer as 0.9.0.1
|
||||
|
||||
* Removed TODO's for reporting bugs in YAML spec that are done.
|
||||
* Fixed assembly copyright.
|
||||
* !!merge is supported. Fixed issue#2605.
|
||||
* Read-only class-type member with no child members are omitted when
|
||||
serializing. Fixed issue#2599.
|
||||
* Culture for TypeConverter is set to be CultureInfo.InvariantCulture.
|
||||
Fixed issue #2629.
|
||||
* To fix Issue#2631
|
||||
* Field names and property names are always presented as simple texts.
|
||||
* When deserializing, we can not avoid the parser parses some spacial
|
||||
names to !!bool and !!null. Such non-text nodes are converted to
|
||||
texts at construction stage.
|
||||
* To fix issue#2663
|
||||
* Hash code stored in a mapping node is now updated when the a key node's
|
||||
content is changed.
|
||||
* Hash code and equality became independent on the order of keys in a
|
||||
mapping node.
|
||||
* A mapping node checks for duplicated keys every time the node content
|
||||
is changed.
|
||||
* Test results are changed because some of them are dependent on the hash
|
||||
key order.
|
||||
* The current equality evaluation is too strict, probably needs some adjustment.
|
||||
* NativeObject property was added to YamlScalar.
|
||||
* YamlScalar's equality is evaluated by comparing NativeObject.
|
||||
|
||||
--- 2009-09-11 Osamu TAKEUCHI <osamu@big.jp>
|
||||
First release of YamlSerializer as 0.9.0.0
|
@@ -1,177 +0,0 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
@@ -1,39 +0,0 @@
|
||||
YamlSerializer 0.9.0.2 (2009-10-04) Osamu TAKEUCHI <osamu@big.jp>
|
||||
|
||||
Description:
|
||||
A library that serialize / deserialize C# native objects into YAML1.2 text.
|
||||
|
||||
Development environment:
|
||||
Visual C# 2008 Express Edition
|
||||
Sandcastle (2008-05-29)
|
||||
SandcastleBuilder 1.8.0.2
|
||||
HTML Help workshop 4.74.8702
|
||||
NUnit 2.5.0.9122
|
||||
TestDriven.NET 2.0
|
||||
|
||||
Support web page:
|
||||
http://yamlserializer.codeplex.com/
|
||||
|
||||
License:
|
||||
YamlSerializer is distributed under the MIT license as following:
|
||||
|
||||
---
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2009 Osamu TAKEUCHI <osamu@big.jp>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without limitation the rights to use, copy,
|
||||
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -7,6 +7,7 @@ using Autofac;
|
||||
using Moq;
|
||||
using NHibernate;
|
||||
using NUnit.Framework;
|
||||
using Orchard.Caching;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Builders;
|
||||
using Orchard.ContentManagement.MetaData.Models;
|
||||
@@ -15,6 +16,7 @@ using Orchard.Core.Settings.Metadata;
|
||||
using Orchard.Core.Settings.Metadata.Records;
|
||||
using Orchard.Data;
|
||||
using Orchard.Tests;
|
||||
using Orchard.Tests.Stubs;
|
||||
using Orchard.Tests.Utility;
|
||||
|
||||
namespace Orchard.Core.Tests.Settings.Metadata {
|
||||
@@ -47,6 +49,9 @@ namespace Orchard.Core.Tests.Settings.Metadata {
|
||||
builder.RegisterType(typeof(SettingsFormatter))
|
||||
.As(typeof(IMapper<XElement, SettingsDictionary>))
|
||||
.As(typeof(IMapper<SettingsDictionary, XElement>));
|
||||
builder.RegisterType<Signals>().As<ISignals>();
|
||||
builder.RegisterType<StubCacheManager>().As<ICacheManager>();
|
||||
|
||||
_container = builder.Build();
|
||||
|
||||
_container.Mock<ISessionLocator>()
|
||||
|
@@ -1,3 +1 @@
|
||||
setup /SiteName:Profiling /AdminUsername:admin /AdminPassword:profiling-secret /DatabaseProvider:SqlCe /EnabledFeatures:Profiling,Orchard.Framework,Routable,Common,Dashboard,Feeds,Orchard.PublishLater,HomePage,Contents,Navigation,Reports,Scheduling,Indexing,Settings,Localization,XmlRpc,Orchard.Users,Orchard.Roles,TinyMce,Orchard.Themes,Orchard.MultiTenancy,Orchard.Blogs,Orchard.Comments,Orchard.Modules,Orchard.Scripting,Orchard.Widgets,Orchard.Media,Orchard.Tags,Orchard.Experimental
|
||||
add profiling data
|
||||
feature disable Orchard.Experimental
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
<configuration>
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.0">
|
||||
<compilation targetFramework="4.0">
|
||||
<assemblies>
|
||||
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"/>
|
||||
</assemblies>
|
||||
|
@@ -51,7 +51,7 @@
|
||||
affects performance, set this value to true only
|
||||
during development.
|
||||
-->
|
||||
<compilation debug="true" targetFramework="4.0">
|
||||
<compilation targetFramework="4.0">
|
||||
<buildProviders>
|
||||
<add extension=".csproj" type="Orchard.Environment.Extensions.Compilers.CSharpExtensionBuildProviderShim"/>
|
||||
</buildProviders>
|
||||
|
@@ -42,7 +42,7 @@
|
||||
affects performance, set this value to true only
|
||||
during development.
|
||||
-->
|
||||
<compilation debug="true" defaultLanguage="cs">
|
||||
<compilation defaultLanguage="cs">
|
||||
<assemblies>
|
||||
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"/>
|
||||
|
@@ -3,6 +3,7 @@ using System.IO;
|
||||
using Autofac;
|
||||
using Autofac.Features.Metadata;
|
||||
using NUnit.Framework;
|
||||
using Orchard.Caching;
|
||||
using Orchard.CodeGeneration.Commands;
|
||||
using Orchard.Commands;
|
||||
using Orchard.Data;
|
||||
@@ -15,6 +16,7 @@ using Orchard.Environment.ShellBuilders.Models;
|
||||
using Orchard.FileSystems.AppData;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Tests.FileSystems.AppData;
|
||||
using Orchard.Tests.Stubs;
|
||||
|
||||
namespace Orchard.Tests.Modules.CodeGeneration.Commands {
|
||||
[TestFixture]
|
||||
@@ -46,6 +48,7 @@ namespace Orchard.Tests.Modules.CodeGeneration.Commands {
|
||||
builder.RegisterType<CompositionStrategy>().As<ICompositionStrategy>();
|
||||
builder.RegisterType<ExtensionManager>().As<IExtensionManager>();
|
||||
builder.RegisterType<SchemaCommandGenerator>().As<ISchemaCommandGenerator>();
|
||||
builder.RegisterType<StubCacheManager>().As<ICacheManager>();
|
||||
|
||||
_container = builder.Build();
|
||||
_extensionManager = _container.Resolve<IExtensionManager>();
|
||||
@@ -54,7 +57,7 @@ namespace Orchard.Tests.Modules.CodeGeneration.Commands {
|
||||
|
||||
[Test]
|
||||
public void CreateDataMigrationTestNonExistentFeature() {
|
||||
CodeGenerationCommands codeGenerationCommands = new CodeGenerationCommands(_extensionManager,
|
||||
CodeGenerationCommands codeGenerationCommands = new CodeGenerationCommands(_extensionManager,
|
||||
_schemaCommandGenerator);
|
||||
|
||||
TextWriter textWriterOutput = new StringWriter();
|
||||
|
@@ -31,6 +31,7 @@ using Orchard.Data.Providers;
|
||||
using Orchard.Tests.FileSystems.AppData;
|
||||
using Orchard.Tests.Modules.Migrations.Orchard.Tests.DataMigration.Records;
|
||||
using Path = Bleroy.FluentPath.Path;
|
||||
using Orchard.Tests.Stubs;
|
||||
|
||||
namespace Orchard.Tests.Modules.Migrations {
|
||||
[TestFixture]
|
||||
@@ -83,6 +84,8 @@ namespace Orchard.Tests.Modules.Migrations {
|
||||
builder.RegisterType<ExtensionManager>().As<IExtensionManager>();
|
||||
builder.RegisterType<SchemaCommandGenerator>().As<ISchemaCommandGenerator>();
|
||||
builder.RegisterGeneric(typeof(Repository<>)).As(typeof(IRepository<>));
|
||||
builder.RegisterType<StubCacheManager>().As<ICacheManager>();
|
||||
|
||||
_session = _sessionFactory.OpenSession();
|
||||
builder.RegisterInstance(new DefaultContentManagerTests.TestSessionLocator(_session)).As<ISessionLocator>();
|
||||
|
||||
@@ -96,8 +99,8 @@ Name: Module1
|
||||
Version: 0.1
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
Feature1:
|
||||
Description: Feature
|
||||
Feature1:
|
||||
Description: Feature
|
||||
");
|
||||
}
|
||||
|
||||
@@ -115,16 +118,15 @@ Features:
|
||||
public IDictionary<string, string> Manifests { get; set; }
|
||||
|
||||
public IEnumerable<ExtensionDescriptor> AvailableExtensions() {
|
||||
foreach ( var e in Manifests ) {
|
||||
foreach (var e in Manifests) {
|
||||
string name = e.Key;
|
||||
var parseResult = ExtensionFolders.ParseManifest(Manifests[name]);
|
||||
yield return ExtensionFolders.GetDescriptorForExtension("~/", name, "Module", parseResult);
|
||||
yield return ExtensionFolders.GetDescriptorForExtension("~/", name, "Module", Manifests[name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class StubLoaders : IExtensionLoader {
|
||||
#region Implementation of IExtensionLoader
|
||||
#region Implementation of IExtensionLoader
|
||||
|
||||
public int Order {
|
||||
get { return 1; }
|
||||
|
@@ -7,6 +7,7 @@ using System.Xml.Linq;
|
||||
using Autofac;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Orchard.Caching;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Models;
|
||||
using Orchard.ContentManagement.MetaData.Services;
|
||||
@@ -34,7 +35,6 @@ using Orchard.Users.Services;
|
||||
using Orchard.Users.ViewModels;
|
||||
using Orchard.Settings;
|
||||
using Orchard.Core.Settings.Services;
|
||||
using Orchard.Caching;
|
||||
|
||||
namespace Orchard.Tests.Modules.Users.Controllers {
|
||||
[TestFixture]
|
||||
@@ -66,6 +66,9 @@ namespace Orchard.Tests.Modules.Users.Controllers {
|
||||
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
||||
builder.RegisterInstance(new Mock<INotifier>().Object);
|
||||
builder.RegisterInstance(new Mock<IContentDisplay>().Object);
|
||||
builder.RegisterType<StubCacheManager>().As<ICacheManager>();
|
||||
builder.RegisterType<Signals>().As<ISignals>();
|
||||
|
||||
_authorizer = new Mock<IAuthorizer>();
|
||||
builder.RegisterInstance(_authorizer.Object);
|
||||
}
|
||||
|
@@ -2,6 +2,8 @@
|
||||
using Autofac;
|
||||
using NUnit.Framework;
|
||||
using Orchard.Scripting.Services;
|
||||
using Orchard.Caching;
|
||||
using Orchard.Tests.Stubs;
|
||||
using Orchard.Widgets.RuleEngine;
|
||||
using Orchard.Widgets.Services;
|
||||
|
||||
@@ -18,6 +20,8 @@ namespace Orchard.Tests.Modules.Widgets {
|
||||
builder.RegisterType<ScriptingManager>().As<IScriptingManager>();
|
||||
builder.RegisterType<AlwaysTrueRuleProvider>().As<IRuleProvider>();
|
||||
builder.RegisterType<RuleManager>().As<IRuleManager>();
|
||||
builder.RegisterType<StubCacheManager>().As<ICacheManager>();
|
||||
|
||||
_container = builder.Build();
|
||||
_ruleManager = _container.Resolve<IRuleManager>();
|
||||
}
|
||||
|
@@ -6,6 +6,7 @@ using Autofac;
|
||||
using Moq;
|
||||
using NHibernate;
|
||||
using NUnit.Framework;
|
||||
using Orchard.Caching;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.Records;
|
||||
using Orchard.Data;
|
||||
@@ -18,7 +19,7 @@ using Orchard.Environment.Extensions.Folders;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Tests.ContentManagement;
|
||||
using Orchard.Data.Providers;
|
||||
using Orchard.Tests.Utility;
|
||||
using Orchard.Tests.Stubs;
|
||||
|
||||
namespace Orchard.Tests.DataMigration {
|
||||
[TestFixture]
|
||||
@@ -65,6 +66,7 @@ namespace Orchard.Tests.DataMigration {
|
||||
builder.RegisterType<ExtensionManager>().As<IExtensionManager>();
|
||||
builder.RegisterType<DataMigrationManager>().As<IDataMigrationManager>();
|
||||
builder.RegisterGeneric(typeof(Repository<>)).As(typeof(IRepository<>));
|
||||
builder.RegisterType<StubCacheManager>().As<ICacheManager>();
|
||||
_session = _sessionFactory.OpenSession();
|
||||
builder.RegisterInstance(new DefaultContentManagerTests.TestSessionLocator(_session)).As<ISessionLocator>();
|
||||
foreach(var type in dataMigrations) {
|
||||
@@ -88,8 +90,7 @@ namespace Orchard.Tests.DataMigration {
|
||||
public IEnumerable<ExtensionDescriptor> AvailableExtensions() {
|
||||
foreach (var e in Manifests) {
|
||||
string name = e.Key;
|
||||
var parseResult = ExtensionFolders.ParseManifest(Manifests[name]);
|
||||
yield return ExtensionFolders.GetDescriptorForExtension("~/", name, "Module", parseResult);
|
||||
yield return ExtensionFolders.GetDescriptorForExtension("~/", name, "Module", Manifests[name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -232,8 +233,8 @@ Name: Module2
|
||||
Version: 0.1
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
Feature1:
|
||||
Description: Feature
|
||||
Feature1:
|
||||
Description: Feature
|
||||
");
|
||||
|
||||
_dataMigrationManager.Update("Feature1");
|
||||
@@ -249,8 +250,8 @@ Name: Module1
|
||||
Version: 0.1
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
Feature1:
|
||||
Description: Feature
|
||||
Feature1:
|
||||
Description: Feature
|
||||
");
|
||||
|
||||
_dataMigrationManager.Update("Feature1");
|
||||
@@ -266,8 +267,8 @@ Name: Module1
|
||||
Version: 0.1
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
Feature1:
|
||||
Description: Feature
|
||||
Feature1:
|
||||
Description: Feature
|
||||
");
|
||||
|
||||
_dataMigrationManager.Update("Feature1");
|
||||
@@ -285,8 +286,8 @@ Name: Module1
|
||||
Version: 0.1
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
Feature1:
|
||||
Description: Feature
|
||||
Feature1:
|
||||
Description: Feature
|
||||
");
|
||||
|
||||
_dataMigrationManager.Update("Feature1");
|
||||
@@ -303,8 +304,8 @@ Name: Module1
|
||||
Version: 0.1
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
Feature1:
|
||||
Description: Feature
|
||||
Feature1:
|
||||
Description: Feature
|
||||
");
|
||||
_repository.Create(new DataMigrationRecord {
|
||||
Version = 42,
|
||||
@@ -326,9 +327,9 @@ Name: Module1
|
||||
Version: 0.1
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
Feature1:
|
||||
Description: Feature
|
||||
Dependencies: Feature2
|
||||
Feature1:
|
||||
Description: Feature
|
||||
Dependencies: Feature2
|
||||
");
|
||||
|
||||
_folders.Manifests.Add("Module2", @"
|
||||
@@ -336,8 +337,8 @@ Name: Module2
|
||||
Version: 0.1
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
Feature2:
|
||||
Description: Feature
|
||||
Feature2:
|
||||
Description: Feature
|
||||
");
|
||||
_dataMigrationManager.Update("Feature1");
|
||||
Assert.That(_repository.Table.Count(), Is.EqualTo(2));
|
||||
@@ -355,8 +356,8 @@ Name: Module1
|
||||
Version: 0.1
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
Feature1:
|
||||
Description: Feature
|
||||
Feature1:
|
||||
Description: Feature
|
||||
");
|
||||
|
||||
_dataMigrationManager.Update("Feature1");
|
||||
@@ -373,14 +374,14 @@ Name: Module1
|
||||
Version: 0.1
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
Feature1:
|
||||
Description: Feature
|
||||
Feature2:
|
||||
Description: Feature
|
||||
Feature3:
|
||||
Description: Feature
|
||||
Feature4:
|
||||
Description: Feature
|
||||
Feature1:
|
||||
Description: Feature
|
||||
Feature2:
|
||||
Description: Feature
|
||||
Feature3:
|
||||
Description: Feature
|
||||
Feature4:
|
||||
Description: Feature
|
||||
");
|
||||
|
||||
// even if there is a data migration class, as it is empty there should me no migration to do
|
||||
@@ -422,8 +423,8 @@ Name: Module1
|
||||
Version: 0.1
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
Feature1:
|
||||
Description: Feature
|
||||
Feature1:
|
||||
Description: Feature
|
||||
");
|
||||
|
||||
_dataMigrationManager.Update("Feature1");
|
||||
|
@@ -55,21 +55,6 @@ namespace Orchard.Tests.Environment.Blueprint {
|
||||
Assert.That(result.SerialNumber, Is.EqualTo(42));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void StoreNullWillClearEntry() {
|
||||
var service = _container.Resolve<IShellDescriptorCache>();
|
||||
|
||||
var descriptor1 = new ShellDescriptor { SerialNumber = 6655321 };
|
||||
service.Store("Hello", descriptor1);
|
||||
var result1 = service.Fetch("Hello");
|
||||
Assert.That(result1, Is.Not.Null);
|
||||
|
||||
service.Store("Hello", null);
|
||||
var result2 = service.Fetch("Hello");
|
||||
Assert.That(result2, Is.Null);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void AllDataWillRoundTrip() {
|
||||
var service = _container.Resolve<IShellDescriptorCache>();
|
||||
|
@@ -1,13 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using Orchard.Caching;
|
||||
using Orchard.Environment.Extensions.Folders;
|
||||
using Orchard.FileSystems.WebSite;
|
||||
using Orchard.Tests.Stubs;
|
||||
using Yaml.Grammar;
|
||||
|
||||
namespace Orchard.Tests.Environment.Extensions {
|
||||
[TestFixture]
|
||||
|
@@ -11,6 +11,7 @@ using Orchard.Environment.Extensions.Loaders;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.FileSystems.Dependencies;
|
||||
using Orchard.Tests.Extensions.ExtensionTypes;
|
||||
using Orchard.Tests.Stubs;
|
||||
|
||||
namespace Orchard.Tests.Environment.Extensions {
|
||||
[TestFixture]
|
||||
@@ -25,6 +26,8 @@ namespace Orchard.Tests.Environment.Extensions {
|
||||
_folders = new StubFolders("Module");
|
||||
builder.RegisterInstance(_folders).As<IExtensionFolders>();
|
||||
builder.RegisterType<ExtensionManager>().As<IExtensionManager>();
|
||||
builder.RegisterType<StubCacheManager>().As<ICacheManager>();
|
||||
|
||||
_container = builder.Build();
|
||||
_manager = _container.Resolve<IExtensionManager>();
|
||||
}
|
||||
@@ -42,8 +45,7 @@ namespace Orchard.Tests.Environment.Extensions {
|
||||
public IEnumerable<ExtensionDescriptor> AvailableExtensions() {
|
||||
foreach (var e in Manifests) {
|
||||
string name = e.Key;
|
||||
var parseResult = ExtensionFolders.ParseManifest(Manifests[name]);
|
||||
yield return ExtensionFolders.GetDescriptorForExtension("~/", name, _extensionType, parseResult);
|
||||
yield return ExtensionFolders.GetDescriptorForExtension("~/", name, _extensionType, Manifests[name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -154,8 +156,8 @@ Name: SuperWiki
|
||||
Version: 1.0.3
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
SuperWiki:
|
||||
Description: My super wiki module for Orchard.
|
||||
SuperWiki:
|
||||
Description: My super wiki module for Orchard.
|
||||
");
|
||||
|
||||
var descriptor = _manager.AvailableExtensions().Single();
|
||||
@@ -178,22 +180,22 @@ Website: http://anotherwiki.codeplex.com
|
||||
Version: 1.2.3
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
AnotherWiki:
|
||||
Description: My super wiki module for Orchard.
|
||||
Dependencies: Versioning, Search
|
||||
Category: Content types
|
||||
AnotherWiki Editor:
|
||||
Description: A rich editor for wiki contents.
|
||||
Dependencies: TinyMCE, AnotherWiki
|
||||
Category: Input methods
|
||||
AnotherWiki DistributionList:
|
||||
Description: Sends e-mail alerts when wiki contents gets published.
|
||||
Dependencies: AnotherWiki, Email Subscriptions
|
||||
Category: Email
|
||||
AnotherWiki Captcha:
|
||||
Description: Kills spam. Or makes it zombie-like.
|
||||
Dependencies: AnotherWiki, reCaptcha
|
||||
Category: Spam
|
||||
AnotherWiki:
|
||||
Description: My super wiki module for Orchard.
|
||||
Dependencies: Versioning, Search
|
||||
Category: Content types
|
||||
AnotherWiki Editor:
|
||||
Description: A rich editor for wiki contents.
|
||||
Dependencies: TinyMCE, AnotherWiki
|
||||
Category: Input methods
|
||||
AnotherWiki DistributionList:
|
||||
Description: Sends e-mail alerts when wiki contents gets published.
|
||||
Dependencies: AnotherWiki, Email Subscriptions
|
||||
Category: Email
|
||||
AnotherWiki Captcha:
|
||||
Description: Kills spam. Or makes it zombie-like.
|
||||
Dependencies: AnotherWiki, reCaptcha
|
||||
Category: Spam
|
||||
");
|
||||
|
||||
var descriptor = _manager.AvailableExtensions().Single();
|
||||
@@ -259,13 +261,13 @@ Name: TestModule
|
||||
Version: 1.0.3
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
TestModule:
|
||||
Description: My test module for Orchard.
|
||||
TestFeature:
|
||||
Description: Contains the Phi type.
|
||||
TestModule:
|
||||
Description: My test module for Orchard.
|
||||
TestFeature:
|
||||
Description: Contains the Phi type.
|
||||
");
|
||||
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());
|
||||
var testFeature = extensionManager.AvailableExtensions()
|
||||
.SelectMany(x => x.Features);
|
||||
|
||||
@@ -285,13 +287,13 @@ Name: TestModule
|
||||
Version: 1.0.3
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
TestModule:
|
||||
Description: My test module for Orchard.
|
||||
TestFeature:
|
||||
Description: Contains the Phi type.
|
||||
TestModule:
|
||||
Description: My test module for Orchard.
|
||||
TestFeature:
|
||||
Description: Contains the Phi type.
|
||||
");
|
||||
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());
|
||||
var testFeature = extensionManager.AvailableExtensions()
|
||||
.SelectMany(x => x.Features);
|
||||
|
||||
@@ -304,7 +306,7 @@ Features:
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Test, Ignore("This assertion appears to be inconsistent with the comment in extension manager - an empty feature is returned")]
|
||||
public void ExtensionManagerShouldThrowIfFeatureDoesNotExist() {
|
||||
var featureDescriptor = new FeatureDescriptor { Id = "NoSuchFeature" };
|
||||
Assert.Throws<ArgumentException>(() => _manager.LoadFeatures(new[] { featureDescriptor }));
|
||||
@@ -320,13 +322,13 @@ Name: TestModule
|
||||
Version: 1.0.3
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
TestModule:
|
||||
Description: My test module for Orchard.
|
||||
TestFeature:
|
||||
Description: Contains the Phi type.
|
||||
TestModule:
|
||||
Description: My test module for Orchard.
|
||||
TestFeature:
|
||||
Description: Contains the Phi type.
|
||||
");
|
||||
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());
|
||||
var testFeature = extensionManager.AvailableExtensions()
|
||||
.SelectMany(x => x.Features)
|
||||
.Single(x => x.Id == "TestFeature");
|
||||
@@ -350,13 +352,13 @@ Name: TestModule
|
||||
Version: 1.0.3
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
TestModule:
|
||||
Description: My test module for Orchard.
|
||||
TestFeature:
|
||||
Description: Contains the Phi type.
|
||||
TestModule:
|
||||
Description: My test module for Orchard.
|
||||
TestFeature:
|
||||
Description: Contains the Phi type.
|
||||
");
|
||||
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());
|
||||
var testFeature = extensionManager.AvailableExtensions()
|
||||
.SelectMany(x => x.Features)
|
||||
.Single(x => x.Id == "TestFeature");
|
||||
@@ -378,13 +380,13 @@ Name: TestModule
|
||||
Version: 1.0.3
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
TestModule:
|
||||
Description: My test module for Orchard.
|
||||
TestFeature:
|
||||
Description: Contains the Phi type.
|
||||
TestModule:
|
||||
Description: My test module for Orchard.
|
||||
TestFeature:
|
||||
Description: Contains the Phi type.
|
||||
");
|
||||
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());
|
||||
var testModule = extensionManager.AvailableExtensions()
|
||||
.SelectMany(x => x.Features)
|
||||
.Single(x => x.Id == "TestModule");
|
||||
@@ -408,7 +410,7 @@ Version: 1.0.3
|
||||
OrchardVersion: 1
|
||||
");
|
||||
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());
|
||||
var minimalisticModule = extensionManager.AvailableExtensions().Single(x => x.Id == "Minimalistic");
|
||||
|
||||
Assert.That(minimalisticModule.Features.Count(), Is.EqualTo(1));
|
||||
@@ -427,7 +429,7 @@ Version: 1.0.3
|
||||
OrchardVersion: 1
|
||||
");
|
||||
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());
|
||||
var minimalisticModule = extensionManager.AvailableExtensions().Single(x => x.Id == "Minimalistic");
|
||||
|
||||
Assert.That(minimalisticModule.Features.Count(), Is.EqualTo(1));
|
||||
|
@@ -11,6 +11,7 @@ using Orchard.Environment.Extensions.Loaders;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.FileSystems.Dependencies;
|
||||
using Orchard.Tests.Extensions.ExtensionTypes;
|
||||
using Orchard.Tests.Stubs;
|
||||
|
||||
namespace Orchard.Tests.Environment.Extensions {
|
||||
[TestFixture]
|
||||
@@ -25,6 +26,8 @@ namespace Orchard.Tests.Environment.Extensions {
|
||||
_folders = new StubFolders();
|
||||
builder.RegisterInstance(_folders).As<IExtensionFolders>();
|
||||
builder.RegisterType<ExtensionManager>().As<IExtensionManager>();
|
||||
builder.RegisterType<StubCacheManager>().As<ICacheManager>();
|
||||
|
||||
_container = builder.Build();
|
||||
_manager = _container.Resolve<IExtensionManager>();
|
||||
}
|
||||
@@ -37,7 +40,8 @@ namespace Orchard.Tests.Environment.Extensions {
|
||||
_extensionType = extensionType;
|
||||
}
|
||||
|
||||
public StubFolders() : this("Module") {
|
||||
public StubFolders()
|
||||
: this("Module") {
|
||||
}
|
||||
|
||||
public IDictionary<string, string> Manifests { get; set; }
|
||||
@@ -45,8 +49,7 @@ namespace Orchard.Tests.Environment.Extensions {
|
||||
public IEnumerable<ExtensionDescriptor> AvailableExtensions() {
|
||||
foreach (var e in Manifests) {
|
||||
string name = e.Key;
|
||||
var parseResult = ExtensionFolders.ParseManifest(Manifests[name]);
|
||||
yield return ExtensionFolders.GetDescriptorForExtension("~/", name, _extensionType, parseResult);
|
||||
yield return ExtensionFolders.GetDescriptorForExtension("~/", name, _extensionType, Manifests[name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -157,8 +160,8 @@ Name: SuperWiki
|
||||
Version: 1.0.3
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
SuperWiki:
|
||||
Description: My super wiki module for Orchard.
|
||||
SuperWiki:
|
||||
Description: My super wiki module for Orchard.
|
||||
");
|
||||
|
||||
var descriptor = _manager.AvailableExtensions().Single();
|
||||
@@ -181,22 +184,22 @@ Website: http://anotherwiki.codeplex.com
|
||||
Version: 1.2.3
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
AnotherWiki:
|
||||
Description: My super wiki module for Orchard.
|
||||
Dependencies: Versioning, Search
|
||||
Category: Content types
|
||||
AnotherWiki Editor:
|
||||
Description: A rich editor for wiki contents.
|
||||
Dependencies: TinyMCE, AnotherWiki
|
||||
Category: Input methods
|
||||
AnotherWiki DistributionList:
|
||||
Description: Sends e-mail alerts when wiki contents gets published.
|
||||
Dependencies: AnotherWiki, Email Subscriptions
|
||||
Category: Email
|
||||
AnotherWiki Captcha:
|
||||
Description: Kills spam. Or makes it zombie-like.
|
||||
Dependencies: AnotherWiki, reCaptcha
|
||||
Category: Spam
|
||||
AnotherWiki:
|
||||
Description: My super wiki module for Orchard.
|
||||
Dependencies: Versioning, Search
|
||||
Category: Content types
|
||||
AnotherWiki Editor:
|
||||
Description: A rich editor for wiki contents.
|
||||
Dependencies: TinyMCE, AnotherWiki
|
||||
Category: Input methods
|
||||
AnotherWiki DistributionList:
|
||||
Description: Sends e-mail alerts when wiki contents gets published.
|
||||
Dependencies: AnotherWiki, Email Subscriptions
|
||||
Category: Email
|
||||
AnotherWiki Captcha:
|
||||
Description: Kills spam. Or makes it zombie-like.
|
||||
Dependencies: AnotherWiki, reCaptcha
|
||||
Category: Spam
|
||||
");
|
||||
|
||||
var descriptor = _manager.AvailableExtensions().Single();
|
||||
@@ -262,13 +265,13 @@ Name: TestModule
|
||||
Version: 1.0.3
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
TestModule:
|
||||
Description: My test module for Orchard.
|
||||
TestFeature:
|
||||
Description: Contains the Phi type.
|
||||
TestModule:
|
||||
Description: My test module for Orchard.
|
||||
TestFeature:
|
||||
Description: Contains the Phi type.
|
||||
");
|
||||
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());
|
||||
var testFeature = extensionManager.AvailableExtensions()
|
||||
.SelectMany(x => x.Features);
|
||||
|
||||
@@ -288,13 +291,13 @@ Name: TestModule
|
||||
Version: 1.0.3
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
TestModule:
|
||||
Description: My test module for Orchard.
|
||||
TestFeature:
|
||||
Description: Contains the Phi type.
|
||||
TestModule:
|
||||
Description: My test module for Orchard.
|
||||
TestFeature:
|
||||
Description: Contains the Phi type.
|
||||
");
|
||||
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());
|
||||
var testFeature = extensionManager.AvailableExtensions()
|
||||
.SelectMany(x => x.Features);
|
||||
|
||||
@@ -307,9 +310,9 @@ Features:
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Test, Ignore("This assertion appears to be inconsistent with the comment in extension manager - an empty feature is returned")]
|
||||
public void ExtensionManagerShouldThrowIfFeatureDoesNotExist() {
|
||||
var featureDescriptor = new FeatureDescriptor { Id = "NoSuchFeature" };
|
||||
var featureDescriptor = new FeatureDescriptor { Id = "NoSuchFeature", Extension = new ExtensionDescriptor { Name = "NoSuchFeature" } };
|
||||
Assert.Throws<ArgumentException>(() => _manager.LoadFeatures(new[] { featureDescriptor }));
|
||||
}
|
||||
|
||||
@@ -323,13 +326,13 @@ Name: TestModule
|
||||
Version: 1.0.3
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
TestModule:
|
||||
Description: My test module for Orchard.
|
||||
TestFeature:
|
||||
Description: Contains the Phi type.
|
||||
TestModule:
|
||||
Description: My test module for Orchard.
|
||||
TestFeature:
|
||||
Description: Contains the Phi type.
|
||||
");
|
||||
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());
|
||||
var testFeature = extensionManager.AvailableExtensions()
|
||||
.SelectMany(x => x.Features)
|
||||
.Single(x => x.Id == "TestFeature");
|
||||
@@ -353,13 +356,13 @@ Name: TestModule
|
||||
Version: 1.0.3
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
TestModule:
|
||||
Description: My test module for Orchard.
|
||||
TestFeature:
|
||||
Description: Contains the Phi type.
|
||||
TestModule:
|
||||
Description: My test module for Orchard.
|
||||
TestFeature:
|
||||
Description: Contains the Phi type.
|
||||
");
|
||||
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());
|
||||
var testFeature = extensionManager.AvailableExtensions()
|
||||
.SelectMany(x => x.Features)
|
||||
.Single(x => x.Id == "TestFeature");
|
||||
@@ -381,13 +384,13 @@ Name: TestModule
|
||||
Version: 1.0.3
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
TestModule:
|
||||
Description: My test module for Orchard.
|
||||
TestFeature:
|
||||
Description: Contains the Phi type.
|
||||
TestModule:
|
||||
Description: My test module for Orchard.
|
||||
TestFeature:
|
||||
Description: Contains the Phi type.
|
||||
");
|
||||
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());
|
||||
var testModule = extensionManager.AvailableExtensions()
|
||||
.SelectMany(x => x.Features)
|
||||
.Single(x => x.Id == "TestModule");
|
||||
@@ -411,7 +414,7 @@ Version: 1.0.3
|
||||
OrchardVersion: 1
|
||||
");
|
||||
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());
|
||||
var minimalisticModule = extensionManager.AvailableExtensions().Single(x => x.Id == "Minimalistic");
|
||||
|
||||
Assert.That(minimalisticModule.Features.Count(), Is.EqualTo(1));
|
||||
@@ -429,8 +432,8 @@ Name: Alpha
|
||||
Version: 1.0.3
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
Alpha:
|
||||
Dependencies: Gamma
|
||||
Alpha:
|
||||
Dependencies: Gamma
|
||||
");
|
||||
|
||||
extensionFolder.Manifests.Add("Beta", @"
|
||||
@@ -443,13 +446,13 @@ Name: Gamma
|
||||
Version: 1.0.3
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
Gamma:
|
||||
Dependencies: Beta
|
||||
Gamma:
|
||||
Dependencies: Beta
|
||||
");
|
||||
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());
|
||||
var features = extensionManager.AvailableFeatures();
|
||||
Assert.That(features.Aggregate("<", (a,b)=>a+b.Id+"<"), Is.EqualTo("<Beta<Gamma<Alpha<"));
|
||||
Assert.That(features.Aggregate("<", (a, b) => a + b.Id + "<"), Is.EqualTo("<Beta<Gamma<Alpha<"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -463,8 +466,8 @@ Name: Alpha
|
||||
Version: 1.0.3
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
Alpha:
|
||||
Dependencies: Gamma
|
||||
Alpha:
|
||||
Dependencies: Gamma
|
||||
");
|
||||
|
||||
moduleExtensionFolder.Manifests.Add("Beta", @"
|
||||
@@ -477,8 +480,8 @@ Name: Gamma
|
||||
Version: 1.0.3
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
Gamma:
|
||||
Dependencies: Beta
|
||||
Gamma:
|
||||
Dependencies: Beta
|
||||
");
|
||||
|
||||
moduleExtensionFolder.Manifests.Add("Classic", @"
|
||||
@@ -487,7 +490,7 @@ Version: 1.0.3
|
||||
OrchardVersion: 1
|
||||
");
|
||||
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { moduleExtensionFolder, themeExtensionFolder }, new[] { extensionLoader });
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { moduleExtensionFolder, themeExtensionFolder }, new[] { extensionLoader }, new StubCacheManager());
|
||||
var features = extensionManager.AvailableFeatures();
|
||||
Assert.That(features.Count(), Is.EqualTo(4));
|
||||
}
|
||||
@@ -503,8 +506,8 @@ Name: Alpha
|
||||
Version: 1.0.3
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
Alpha:
|
||||
Dependencies: Gamma
|
||||
Alpha:
|
||||
Dependencies: Gamma
|
||||
");
|
||||
|
||||
moduleExtensionFolder.Manifests.Add("Beta", @"
|
||||
@@ -517,8 +520,8 @@ Name: Gamma
|
||||
Version: 1.0.3
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
Gamma:
|
||||
Dependencies: Beta
|
||||
Gamma:
|
||||
Dependencies: Beta
|
||||
");
|
||||
|
||||
moduleExtensionFolder.Manifests.Add("Classic", @"
|
||||
@@ -526,11 +529,11 @@ Name: Classic
|
||||
Version: 1.0.3
|
||||
OrchardVersion: 1
|
||||
Features:
|
||||
Classic:
|
||||
Dependencies: Alpha
|
||||
Classic:
|
||||
Dependencies: Alpha
|
||||
");
|
||||
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { moduleExtensionFolder, themeExtensionFolder }, new[] { extensionLoader });
|
||||
IExtensionManager extensionManager = new ExtensionManager(new[] { moduleExtensionFolder, themeExtensionFolder }, new[] { extensionLoader }, new StubCacheManager());
|
||||
var features = extensionManager.AvailableFeatures();
|
||||
Assert.That(features.Aggregate("<", (a, b) => a + b.Id + "<"), Is.EqualTo("<Beta<Gamma<Alpha<Classic<"));
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using NUnit.Framework;
|
||||
using Orchard.Environment;
|
||||
using Orchard.FileSystems.Dependencies;
|
||||
using Orchard.Tests.Stubs;
|
||||
|
||||
@@ -10,7 +11,7 @@ namespace Orchard.Tests.FileSystems.Dependencies {
|
||||
public void FolderShouldBeEmptyByDefault() {
|
||||
var clock = new StubClock();
|
||||
var appDataFolder = new StubAppDataFolder(clock);
|
||||
var dependenciesFolder = new DefaultAssemblyProbingFolder(appDataFolder);
|
||||
var dependenciesFolder = new DefaultAssemblyProbingFolder(appDataFolder, new DefaultAssemblyLoader());
|
||||
|
||||
Assert.That(dependenciesFolder.AssemblyExists("foo"), Is.False);
|
||||
}
|
||||
@@ -19,7 +20,7 @@ namespace Orchard.Tests.FileSystems.Dependencies {
|
||||
public void LoadAssemblyShouldNotThrowIfAssemblyNotFound() {
|
||||
var clock = new StubClock();
|
||||
var appDataFolder = new StubAppDataFolder(clock);
|
||||
var dependenciesFolder = new DefaultAssemblyProbingFolder(appDataFolder);
|
||||
var dependenciesFolder = new DefaultAssemblyProbingFolder(appDataFolder, new DefaultAssemblyLoader());
|
||||
|
||||
Assert.That(dependenciesFolder.LoadAssembly("foo"), Is.Null);
|
||||
}
|
||||
@@ -28,7 +29,7 @@ namespace Orchard.Tests.FileSystems.Dependencies {
|
||||
public void GetAssemblyDateTimeUtcShouldThrowIfAssemblyNotFound() {
|
||||
var clock = new StubClock();
|
||||
var appDataFolder = new StubAppDataFolder(clock);
|
||||
var dependenciesFolder = new DefaultAssemblyProbingFolder(appDataFolder);
|
||||
var dependenciesFolder = new DefaultAssemblyProbingFolder(appDataFolder, new DefaultAssemblyLoader());
|
||||
|
||||
Assert.That(() => dependenciesFolder.GetAssemblyDateTimeUtc("foo"), Throws.Exception);
|
||||
}
|
||||
@@ -37,7 +38,7 @@ namespace Orchard.Tests.FileSystems.Dependencies {
|
||||
public void DeleteAssemblyShouldNotThrowIfAssemblyNotFound() {
|
||||
var clock = new StubClock();
|
||||
var appDataFolder = new StubAppDataFolder(clock);
|
||||
var dependenciesFolder = new DefaultAssemblyProbingFolder(appDataFolder);
|
||||
var dependenciesFolder = new DefaultAssemblyProbingFolder(appDataFolder, new DefaultAssemblyLoader());
|
||||
|
||||
Assert.DoesNotThrow(() => dependenciesFolder.DeleteAssembly("foo"));
|
||||
}
|
||||
@@ -51,12 +52,12 @@ namespace Orchard.Tests.FileSystems.Dependencies {
|
||||
var name = assembly.GetName().Name;
|
||||
|
||||
{
|
||||
var dependenciesFolder = new DefaultAssemblyProbingFolder(appDataFolder);
|
||||
var dependenciesFolder = new DefaultAssemblyProbingFolder(appDataFolder, new DefaultAssemblyLoader());
|
||||
dependenciesFolder.StoreAssembly(name, assembly.Location);
|
||||
}
|
||||
|
||||
{
|
||||
var dependenciesFolder = new DefaultAssemblyProbingFolder(appDataFolder);
|
||||
var dependenciesFolder = new DefaultAssemblyProbingFolder(appDataFolder, new DefaultAssemblyLoader());
|
||||
Assert.That(dependenciesFolder.AssemblyExists(name), Is.True);
|
||||
Assert.That(dependenciesFolder.LoadAssembly(name), Is.SameAs(GetType().Assembly));
|
||||
Assert.DoesNotThrow(() => dependenciesFolder.DeleteAssembly(name));
|
||||
|
@@ -153,10 +153,6 @@
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="Yaml, Version=1.0.3370.39839, Culture=neutral, PublicKeyToken=187a3d240e44a135, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\yaml\Yaml.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Caching\CacheScopeTests.cs" />
|
||||
|
@@ -48,25 +48,16 @@
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\aspnetmvc\System.Web.WebPages.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using Orchard.Caching;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Models;
|
||||
using Orchard.Core.Settings.Metadata.Records;
|
||||
@@ -11,6 +12,9 @@ using Orchard.Utility.Extensions;
|
||||
|
||||
namespace Orchard.Core.Settings.Metadata {
|
||||
public class ContentDefinitionManager : Component, IContentDefinitionManager {
|
||||
private const string ContentDefinitionSignal = "ContentDefinitionManager";
|
||||
private readonly ICacheManager _cacheManager;
|
||||
private readonly ISignals _signals;
|
||||
private readonly IRepository<ContentTypeDefinitionRecord> _typeDefinitionRepository;
|
||||
private readonly IRepository<ContentPartDefinitionRecord> _partDefinitionRepository;
|
||||
private readonly IRepository<ContentFieldDefinitionRecord> _fieldDefinitionRepository;
|
||||
@@ -18,11 +22,15 @@ namespace Orchard.Core.Settings.Metadata {
|
||||
private readonly IMapper<SettingsDictionary, XElement> _settingsWriter;
|
||||
|
||||
public ContentDefinitionManager(
|
||||
ICacheManager cacheManager,
|
||||
ISignals signals,
|
||||
IRepository<ContentTypeDefinitionRecord> typeDefinitionRepository,
|
||||
IRepository<ContentPartDefinitionRecord> partDefinitionRepository,
|
||||
IRepository<ContentFieldDefinitionRecord> fieldDefinitionRepository,
|
||||
IMapper<XElement, SettingsDictionary> settingsReader,
|
||||
IMapper<SettingsDictionary, XElement> settingsWriter) {
|
||||
_cacheManager = cacheManager;
|
||||
_signals = signals;
|
||||
_typeDefinitionRepository = typeDefinitionRepository;
|
||||
_partDefinitionRepository = partDefinitionRepository;
|
||||
_fieldDefinitionRepository = fieldDefinitionRepository;
|
||||
@@ -31,33 +39,58 @@ namespace Orchard.Core.Settings.Metadata {
|
||||
}
|
||||
|
||||
public ContentTypeDefinition GetTypeDefinition(string name) {
|
||||
return _typeDefinitionRepository.Fetch(x => x.Name == name).Select(Build).SingleOrDefault();
|
||||
return _cacheManager.Get(name ?? string.Empty, ctx => {
|
||||
MonitorContentDefinitionSignal(ctx);
|
||||
return _typeDefinitionRepository.Fetch(x => x.Name == name).Select(Build).SingleOrDefault();
|
||||
});
|
||||
}
|
||||
|
||||
public ContentPartDefinition GetPartDefinition(string name) {
|
||||
return _partDefinitionRepository.Fetch(x => x.Name == name).Select(Build).SingleOrDefault();
|
||||
return _cacheManager.Get(name ?? string.Empty, ctx => {
|
||||
MonitorContentDefinitionSignal(ctx);
|
||||
return _partDefinitionRepository.Fetch(x => x.Name == name).Select(Build).SingleOrDefault();
|
||||
});
|
||||
}
|
||||
|
||||
public IEnumerable<ContentTypeDefinition> ListTypeDefinitions() {
|
||||
return _typeDefinitionRepository.Fetch(x => !x.Hidden).Select(Build).ToReadOnlyCollection();
|
||||
return _cacheManager.Get(string.Empty, ctx => {
|
||||
MonitorContentDefinitionSignal(ctx);
|
||||
return _typeDefinitionRepository.Fetch(x => !x.Hidden).Select(Build).ToReadOnlyCollection();
|
||||
});
|
||||
}
|
||||
|
||||
public IEnumerable<ContentPartDefinition> ListPartDefinitions() {
|
||||
return _partDefinitionRepository.Fetch(x => !x.Hidden).Select(Build).ToReadOnlyCollection();
|
||||
return _cacheManager.Get(string.Empty, ctx => {
|
||||
MonitorContentDefinitionSignal(ctx);
|
||||
return _partDefinitionRepository.Fetch(x => !x.Hidden).Select(Build).ToReadOnlyCollection();
|
||||
});
|
||||
}
|
||||
|
||||
public IEnumerable<ContentFieldDefinition> ListFieldDefinitions() {
|
||||
return _fieldDefinitionRepository.Fetch(x => true, cfdr => cfdr.Asc(fdr => fdr.Name)).Select(Build).ToReadOnlyCollection();
|
||||
return _cacheManager.Get(string.Empty, ctx => {
|
||||
MonitorContentDefinitionSignal(ctx);
|
||||
return _fieldDefinitionRepository.Fetch(x => true, cfdr => cfdr.Asc(fdr => fdr.Name)).Select(Build).ToReadOnlyCollection();
|
||||
});
|
||||
}
|
||||
|
||||
public void StoreTypeDefinition(ContentTypeDefinition contentTypeDefinition) {
|
||||
TriggerContentDefinitionSignal();
|
||||
Apply(contentTypeDefinition, Acquire(contentTypeDefinition));
|
||||
}
|
||||
|
||||
public void StorePartDefinition(ContentPartDefinition contentPartDefinition) {
|
||||
_signals.Trigger(ContentDefinitionSignal);
|
||||
Apply(contentPartDefinition, Acquire(contentPartDefinition));
|
||||
}
|
||||
|
||||
private void MonitorContentDefinitionSignal(AcquireContext<string> ctx) {
|
||||
ctx.Monitor(_signals.When(ContentDefinitionSignal));
|
||||
}
|
||||
|
||||
private void TriggerContentDefinitionSignal() {
|
||||
_signals.Trigger(ContentDefinitionSignal);
|
||||
}
|
||||
|
||||
private ContentTypeDefinitionRecord Acquire(ContentTypeDefinition contentTypeDefinition) {
|
||||
var result = _typeDefinitionRepository.Fetch(x => x.Name == contentTypeDefinition.Name).SingleOrDefault();
|
||||
if (result == null) {
|
||||
|
@@ -39,20 +39,9 @@
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
@@ -61,15 +50,7 @@
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Extensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Models\LuceneDocumentIndex.cs" />
|
||||
|
@@ -36,37 +36,14 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Extensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Migrations.cs" />
|
||||
|
@@ -41,28 +41,15 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Web.Mobile" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.0">
|
||||
<compilation targetFramework="4.0">
|
||||
<assemblies>
|
||||
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
</assemblies>
|
||||
|
@@ -40,36 +40,14 @@
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Extensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Commands\CodeGenerationCommands.cs" />
|
||||
|
@@ -45,28 +45,15 @@
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Web.Mobile" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@@ -36,38 +36,14 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Extensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Web.Mobile" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
|
@@ -1,6 +1,4 @@
|
||||
using System.Net.Mail;
|
||||
using Orchard.ContentManagement.Records;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Orchard.Email.Models {
|
||||
public class SmtpSettingsPartRecord : ContentPartRecord {
|
||||
|
@@ -41,29 +41,11 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Web.Mobile" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Migrations.cs" />
|
||||
|
@@ -39,37 +39,16 @@
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Extensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
|
@@ -34,25 +34,14 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Module.txt" />
|
||||
|
@@ -44,28 +44,13 @@
|
||||
<HintPath>..\..\..\..\lib\sharpziplib\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Web.Mobile" />
|
||||
<Reference Include="System.XML" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@@ -36,37 +36,14 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Extensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Commands\DataMigrationCommands.cs" />
|
||||
|
@@ -44,29 +44,11 @@
|
||||
<HintPath>..\..\..\..\lib\autofac\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Web.Mobile" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
|
@@ -44,24 +44,11 @@
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Web.Mobile" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
|
@@ -40,40 +40,22 @@
|
||||
<HintPath>..\..\..\..\lib\nuget\NuGet.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Data.Services.Client" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Extensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
|
@@ -36,37 +36,14 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Extensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Drivers\PublishLaterPartDriver.cs" />
|
||||
|
@@ -41,29 +41,12 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Web.Mobile" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
|
@@ -10,7 +10,7 @@ namespace Orchard.Scripting.Services {
|
||||
public ScriptingManager(IScriptingRuntime scriptingRuntime) {
|
||||
_scriptingRuntime = scriptingRuntime;
|
||||
_scope = new Lazy<ScriptScope>(()=>_scriptingRuntime.CreateScope());
|
||||
_operations = new Lazy<ObjectOperations>(()=>_scope.Value.Engine.CreateOperations());
|
||||
_operations = new Lazy<ObjectOperations>(()=>_scope.Value.Engine.Operations);
|
||||
}
|
||||
|
||||
public dynamic GetVariable(string name) {
|
||||
|
@@ -36,36 +36,13 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc">
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Extensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Drivers\SearchFormPartDriver.cs" />
|
||||
|
@@ -51,26 +51,14 @@
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Web.Mobile" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Annotations\SqlDatabaseConnectionStringAttribute.cs" />
|
||||
|
@@ -113,10 +113,10 @@ namespace Orchard.Setup {
|
||||
|
||||
[UsedImplicitly]
|
||||
class SafeModeSiteWorkContextProvider : IWorkContextStateProvider {
|
||||
public Func<T> Get<T>(string name) {
|
||||
public Func<WorkContext, T> Get<T>(string name) {
|
||||
if (name == "CurrentSite") {
|
||||
ISite safeModeSite = new SafeModeSite();
|
||||
return () => (T)safeModeSite;
|
||||
return ctx => (T)safeModeSite;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@@ -41,28 +41,13 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Web.Mobile" />
|
||||
<Reference Include="System.XML" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@@ -39,35 +39,13 @@
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=2.2.4.900, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\autofac\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Web.Mobile" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
|
@@ -1,13 +1,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml.Linq;
|
||||
using Orchard.Commands;
|
||||
using Orchard.Commands;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Aspects;
|
||||
using Orchard.Security;
|
||||
using Orchard.Users.Services;
|
||||
using System.Web.Security;
|
||||
|
||||
namespace Orchard.Users.Commands {
|
||||
public class UserCommands : DefaultOrchardCommandHandler {
|
||||
|
@@ -41,29 +41,16 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Web.Mobile" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@@ -34,10 +34,6 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ClaySharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\claysharp\ClaySharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.Scripting, Version=1.1.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
@@ -45,26 +41,11 @@
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Extensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Configuration" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
|
@@ -2,36 +2,50 @@
|
||||
using System.Linq;
|
||||
using Orchard.Scripting.Services;
|
||||
using Orchard.Widgets.Services;
|
||||
using Microsoft.Scripting.Hosting;
|
||||
using Orchard.Caching;
|
||||
|
||||
namespace Orchard.Widgets.RuleEngine {
|
||||
public class RuleManager : IRuleManager {
|
||||
private readonly IEnumerable<IRuleProvider> _ruleProviders;
|
||||
private readonly IScriptingManager _scriptingManager;
|
||||
private readonly ICacheManager _cacheManager;
|
||||
|
||||
public RuleManager(IEnumerable<IRuleProvider> ruleProviders, IScriptingManager scriptingManager) {
|
||||
public RuleManager(IEnumerable<IRuleProvider> ruleProviders, IScriptingManager scriptingManager, ICacheManager cacheManager) {
|
||||
_ruleProviders = ruleProviders;
|
||||
_scriptingManager = scriptingManager;
|
||||
_cacheManager = cacheManager;
|
||||
}
|
||||
|
||||
public bool Matches(string expression) {
|
||||
object execContextType = _scriptingManager.ExecuteExpression(@"
|
||||
class ExecContext
|
||||
def execute(callbacks, text)
|
||||
@callbacks = callbacks;
|
||||
temp = instance_eval(text.to_s);
|
||||
@callbacks = 0;
|
||||
return temp;
|
||||
end
|
||||
|
||||
def method_missing(name, *args, &block)
|
||||
@callbacks.send(name, args, &block);
|
||||
end
|
||||
end
|
||||
ExecContext
|
||||
");
|
||||
|
||||
object execContext = _scriptingManager.ExecuteOperation(ops => ops.CreateInstance(execContextType));
|
||||
return _scriptingManager.ExecuteOperation(ops => ops.InvokeMember(execContext, "execute", new CallbackApi(this), expression));
|
||||
object execContextType = _cacheManager.Get("---", ctx => (object)_scriptingManager.ExecuteExpression(@"
|
||||
class ExecBlock
|
||||
def initialize(callbacks)
|
||||
@callbacks = callbacks
|
||||
end
|
||||
def method_missing(name, *args, &block)
|
||||
@callbacks.send(name, args, &block);
|
||||
end
|
||||
end
|
||||
class ExecContext
|
||||
class << self
|
||||
def alloc(thing)
|
||||
instance_eval 'self.new {' + thing + '}'
|
||||
end
|
||||
end
|
||||
def initialize(&block)
|
||||
@block = block
|
||||
end
|
||||
def evaluate(callbacks)
|
||||
ExecBlock.new(callbacks).instance_eval(&@block)
|
||||
end
|
||||
end
|
||||
ExecContext
|
||||
"));
|
||||
var ops = _cacheManager.Get("----", ctx => (ObjectOperations)_scriptingManager.ExecuteOperation(x => x));
|
||||
object execContext = _cacheManager.Get(expression, ctx => (object)ops.InvokeMember(execContextType, "alloc", expression));
|
||||
dynamic result = ops.InvokeMember(execContext, "evaluate", new CallbackApi(this));
|
||||
return result;
|
||||
}
|
||||
|
||||
public class CallbackApi {
|
||||
|
@@ -39,35 +39,11 @@
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=2.1.13.813, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\autofac\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Web.Mobile" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Scripts\jquery-1.4.2.js" />
|
||||
@@ -99,10 +75,6 @@
|
||||
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
|
||||
<Name>Orchard.Framework</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Core\Orchard.Core.csproj">
|
||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||
<Name>Orchard.Core</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Module.txt" />
|
||||
|
@@ -40,27 +40,11 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Web.Mobile" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Module.txt" />
|
||||
@@ -138,10 +122,6 @@
|
||||
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
|
||||
<Name>Orchard.Framework</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Core\Orchard.Core.csproj">
|
||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||
<Name>Orchard.Core</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Scripts\plugins\addmedia\addmedia.htm" />
|
||||
|
@@ -70,7 +70,6 @@
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
|
@@ -1,13 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using Orchard.Utility.Extensions;
|
||||
|
||||
namespace Orchard.ContentManagement.MetaData.Models {
|
||||
public class ContentTypeDefinition {
|
||||
public ContentTypeDefinition(string name, string displayName, IEnumerable<ContentTypePartDefinition> parts, SettingsDictionary settings) {
|
||||
Name = name;
|
||||
DisplayName = displayName;
|
||||
Parts = parts;
|
||||
Parts = parts.ToReadOnlyCollection();
|
||||
Settings = settings;
|
||||
}
|
||||
|
||||
|
@@ -9,7 +9,7 @@ using Orchard.Utility;
|
||||
|
||||
namespace Orchard.DisplayManagement.Descriptors {
|
||||
|
||||
public class DefaultShapeTableManager : IShapeTableManager {
|
||||
public class DefaultShapeTableManager : IShapeTableManager, ISingletonDependency {
|
||||
private readonly IEnumerable<Meta<IShapeTableProvider>> _bindingStrategies;
|
||||
private readonly IExtensionManager _extensionManager;
|
||||
|
||||
|
@@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Yaml.Serialization;
|
||||
using Orchard.FileSystems.AppData;
|
||||
using Orchard.Localization;
|
||||
|
||||
@@ -48,44 +47,61 @@ namespace Orchard.Environment.Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
class Content {
|
||||
public string Name { get; set; }
|
||||
public string DataProvider { get; set; }
|
||||
public string DataConnectionString { get; set; }
|
||||
public string DataPrefix { get; set; }
|
||||
public string RequestUrlHost { get; set; }
|
||||
public string RequestUrlPrefix { get; set; }
|
||||
public string State { get; set; }
|
||||
}
|
||||
|
||||
static ShellSettings ParseSettings(string text) {
|
||||
var ser = new YamlSerializer();
|
||||
var content = ser.Deserialize(text, typeof(Content)).Cast<Content>().Single();
|
||||
return new ShellSettings {
|
||||
Name = content.Name,
|
||||
DataProvider = content.DataProvider,
|
||||
DataConnectionString = content.DataConnectionString,
|
||||
DataTablePrefix = content.DataPrefix,
|
||||
RequestUrlHost = content.RequestUrlHost,
|
||||
RequestUrlPrefix = content.RequestUrlPrefix,
|
||||
State = new TenantState(content.State)
|
||||
};
|
||||
var shellSettings = new ShellSettings();
|
||||
if (String.IsNullOrEmpty(text))
|
||||
return shellSettings;
|
||||
|
||||
string[] settings = text.Split(new[] {"\r\n"}, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (var setting in settings) {
|
||||
string[] settingFields = setting.Split(new[] {":"}, StringSplitOptions.RemoveEmptyEntries);
|
||||
int fieldsLength = settingFields.Length;
|
||||
if (fieldsLength != 2)
|
||||
continue;
|
||||
for (int i = 0; i < fieldsLength; i++) {
|
||||
settingFields[i] = settingFields[i].Trim();
|
||||
}
|
||||
if (settingFields[1] != "null") {
|
||||
switch (settingFields[0]) {
|
||||
case "Name":
|
||||
shellSettings.Name = settingFields[1];
|
||||
break;
|
||||
case "DataProvider":
|
||||
shellSettings.DataProvider = settingFields[1];
|
||||
break;
|
||||
case "State":
|
||||
shellSettings.State = new TenantState(settingFields[1]);
|
||||
break;
|
||||
case "DataConnectionString":
|
||||
shellSettings.DataConnectionString = settingFields[1];
|
||||
break;
|
||||
case "DataPrefix":
|
||||
shellSettings.DataTablePrefix = settingFields[1];
|
||||
break;
|
||||
case "RequestUrlHost":
|
||||
shellSettings.RequestUrlHost = settingFields[1];
|
||||
break;
|
||||
case "RequestUrlPrefix":
|
||||
shellSettings.RequestUrlPrefix = settingFields[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return shellSettings;
|
||||
}
|
||||
|
||||
static string ComposeSettings(ShellSettings settings) {
|
||||
if (settings == null)
|
||||
return "";
|
||||
|
||||
var ser = new YamlSerializer();
|
||||
return ser.Serialize(new Content {
|
||||
Name = settings.Name,
|
||||
DataProvider = settings.DataProvider,
|
||||
DataConnectionString = settings.DataConnectionString,
|
||||
DataPrefix = settings.DataTablePrefix,
|
||||
RequestUrlHost = settings.RequestUrlHost,
|
||||
RequestUrlPrefix = settings.RequestUrlPrefix,
|
||||
State = settings.State != null ? settings.State.ToString() : String.Empty
|
||||
});
|
||||
return string.Format("Name: {0}\r\nDataProvider: {1}\r\nDataConnectionString: {2}\r\nDataPrefix: {3}\r\nRequestUrlHost: {4}\r\nRequestUrlPrefix: {5}\r\nState: {6}\r\n",
|
||||
settings.Name,
|
||||
settings.DataProvider,
|
||||
settings.DataConnectionString ?? "null",
|
||||
settings.DataTablePrefix ?? "null",
|
||||
settings.RequestUrlHost ?? "null",
|
||||
settings.RequestUrlPrefix ?? "null",
|
||||
settings.State != null ? settings.State.ToString() : String.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -111,7 +111,7 @@ namespace Orchard.Environment {
|
||||
if (resolver == null) {
|
||||
return () => default(T);
|
||||
}
|
||||
return () => resolver();
|
||||
return () => resolver(this);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using Orchard.Caching;
|
||||
using Orchard.Environment.Descriptor.Models;
|
||||
using Orchard.FileSystems.AppData;
|
||||
using Orchard.Localization;
|
||||
@@ -54,11 +54,7 @@ namespace Orchard.Environment.Descriptor {
|
||||
XmlNode rootNode = xmlDocument.DocumentElement;
|
||||
foreach (XmlNode tenantNode in rootNode.ChildNodes) {
|
||||
if (String.Equals(tenantNode.Name, name, StringComparison.OrdinalIgnoreCase)) {
|
||||
var serializer = new DataContractSerializer(typeof(ShellDescriptor));
|
||||
var reader = new StringReader(tenantNode.InnerText);
|
||||
using (var xmlReader = XmlReader.Create(reader)) {
|
||||
return (ShellDescriptor)serializer.ReadObject(xmlReader, true);
|
||||
}
|
||||
return GetShellDecriptorForCacheText(tenantNode.InnerText);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,24 +72,14 @@ namespace Orchard.Environment.Descriptor {
|
||||
XmlNode rootNode = xmlDocument.DocumentElement;
|
||||
foreach (XmlNode tenantNode in rootNode.ChildNodes) {
|
||||
if (String.Equals(tenantNode.Name, name, StringComparison.OrdinalIgnoreCase)) {
|
||||
var serializer = new DataContractSerializer(typeof(ShellDescriptor));
|
||||
var writer = new StringWriter();
|
||||
using (var xmlWriter = XmlWriter.Create(writer)) {
|
||||
serializer.WriteObject(xmlWriter, descriptor);
|
||||
}
|
||||
tenantNode.InnerText = writer.ToString();
|
||||
tenantNode.InnerText = GetCacheTextForShellDescriptor(descriptor);
|
||||
tenantCacheUpdated = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!tenantCacheUpdated) {
|
||||
XmlElement newTenant = xmlDocument.CreateElement(name);
|
||||
var serializer = new DataContractSerializer(typeof(ShellDescriptor));
|
||||
var writer = new StringWriter();
|
||||
using (var xmlWriter = XmlWriter.Create(writer)) {
|
||||
serializer.WriteObject(xmlWriter, descriptor);
|
||||
}
|
||||
newTenant.InnerText = writer.ToString();
|
||||
newTenant.InnerText = GetCacheTextForShellDescriptor(descriptor);
|
||||
rootNode.AppendChild(newTenant);
|
||||
}
|
||||
|
||||
@@ -103,6 +89,32 @@ namespace Orchard.Environment.Descriptor {
|
||||
|
||||
#endregion
|
||||
|
||||
private static string GetCacheTextForShellDescriptor(ShellDescriptor descriptor) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(descriptor.SerialNumber + "|");
|
||||
foreach (var feature in descriptor.Features) {
|
||||
sb.Append(feature.Name + ";");
|
||||
}
|
||||
sb.Append("|");
|
||||
foreach (var parameter in descriptor.Parameters) {
|
||||
sb.Append(parameter.Component + "," + parameter.Name + "," + parameter.Value);
|
||||
sb.Append(";");
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private static ShellDescriptor GetShellDecriptorForCacheText(string p) {
|
||||
string[] fields = p.Trim().Split(new[] { "|" }, StringSplitOptions.None);
|
||||
ShellDescriptor shellDescriptor = new ShellDescriptor {SerialNumber = Convert.ToInt32(fields[0])};
|
||||
string[] features = fields[1].Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
shellDescriptor.Features = features.Select(feature => new ShellFeature { Name = feature }).ToList();
|
||||
string[] parameters = fields[2].Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
shellDescriptor.Parameters = parameters.Select(parameter => parameter.Split(new[] { "," }, StringSplitOptions.None)).Select(parameterFields => new ShellParameter { Component = parameterFields[0], Name = parameterFields[1], Value = parameterFields[2] }).ToList();
|
||||
|
||||
return shellDescriptor;
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
|
||||
private void VerifyCacheFile() {
|
||||
if (!_appDataFolder.FileExists(DescriptorCacheFileName)) {
|
||||
|
@@ -3,6 +3,7 @@ using System.CodeDom;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Orchard.Environment.Extensions.Loaders;
|
||||
using Orchard.FileSystems.Dependencies;
|
||||
using Orchard.FileSystems.VirtualPath;
|
||||
@@ -18,17 +19,20 @@ namespace Orchard.Environment.Extensions.Compilers {
|
||||
private readonly IProjectFileParser _projectFileParser;
|
||||
private readonly IDependenciesFolder _dependenciesFolder;
|
||||
private readonly IEnumerable<IExtensionLoader> _loaders;
|
||||
private readonly IAssemblyLoader _assemblyLoader;
|
||||
|
||||
public DefaultExtensionCompiler(
|
||||
IVirtualPathProvider virtualPathProvider,
|
||||
IProjectFileParser projectFileParser,
|
||||
IDependenciesFolder dependenciesFolder,
|
||||
IEnumerable<IExtensionLoader> loaders) {
|
||||
IEnumerable<IExtensionLoader> loaders,
|
||||
IAssemblyLoader assemblyLoader) {
|
||||
|
||||
_virtualPathProvider = virtualPathProvider;
|
||||
_projectFileParser = projectFileParser;
|
||||
_dependenciesFolder = dependenciesFolder;
|
||||
_loaders = loaders;
|
||||
_assemblyLoader = assemblyLoader;
|
||||
|
||||
T = NullLocalizer.Instance;
|
||||
Logger = NullLogger.Instance;
|
||||
@@ -60,8 +64,20 @@ namespace Orchard.Environment.Extensions.Compilers {
|
||||
var loader = _loaders.SingleOrDefault(l => l.Name == referenceTemp.LoaderName);
|
||||
if (loader != null) {
|
||||
var assembly = loader.LoadReference(reference);
|
||||
if (assembly != null)
|
||||
if (assembly != null) {
|
||||
context.AssemblyBuilder.AddAssemblyReference(assembly);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load references specified in project file
|
||||
foreach (var assemblyReference in descriptor.References) {
|
||||
var assembly = _assemblyLoader.Load(assemblyReference.FullName);
|
||||
if (assembly != null) {
|
||||
context.AssemblyBuilder.AddAssemblyReference(assembly);
|
||||
}
|
||||
else {
|
||||
Logger.Warning("Assembly reference '{0}' for project '{1}' skipped due to load error", assemblyReference.FullName, context.VirtualPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -40,14 +40,14 @@ namespace Orchard.Environment.Extensions.Compilers {
|
||||
.Elements(ns("ItemGroup"))
|
||||
.Elements(ns("Reference"))
|
||||
.Attributes("Include")
|
||||
.Select(c => new ReferenceDescriptor { AssemblyName = ExtractAssemblyName(c.Value) });
|
||||
.Select(c => new ReferenceDescriptor { SimpleName = ExtractAssemblyName(c.Value), FullName = c.Value });
|
||||
|
||||
var projectReferences = document
|
||||
.Elements(ns("Project"))
|
||||
.Elements(ns("ItemGroup"))
|
||||
.Elements(ns("ProjectReference"))
|
||||
.Attributes("Include")
|
||||
.Select(c => new ReferenceDescriptor { AssemblyName = Path.GetFileNameWithoutExtension(c.Value) });
|
||||
.Select(c => new ReferenceDescriptor { SimpleName = Path.GetFileNameWithoutExtension(c.Value), FullName = Path.GetFileNameWithoutExtension(c.Value) });
|
||||
|
||||
return assemblyReferences.Union(projectReferences);
|
||||
}
|
||||
|
@@ -7,6 +7,7 @@ namespace Orchard.Environment.Extensions.Compilers {
|
||||
public IEnumerable<ReferenceDescriptor> References { get; set; }
|
||||
}
|
||||
public class ReferenceDescriptor {
|
||||
public string AssemblyName { get; set; }
|
||||
public string SimpleName { get; set; }
|
||||
public string FullName { get; set; }
|
||||
}
|
||||
}
|
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using Orchard.Caching;
|
||||
using Orchard.Environment.Extensions.Folders;
|
||||
using Orchard.Environment.Extensions.Loaders;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
@@ -13,15 +14,17 @@ using Orchard.Utility.Extensions;
|
||||
namespace Orchard.Environment.Extensions {
|
||||
public class ExtensionManager : IExtensionManager {
|
||||
private readonly IEnumerable<IExtensionFolders> _folders;
|
||||
private readonly ICacheManager _cacheManager;
|
||||
private readonly IEnumerable<IExtensionLoader> _loaders;
|
||||
private IEnumerable<FeatureDescriptor> _featureDescriptors;
|
||||
|
||||
public Localizer T { get; set; }
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
public ExtensionManager(IEnumerable<IExtensionFolders> folders, IEnumerable<IExtensionLoader> loaders) {
|
||||
public ExtensionManager(IEnumerable<IExtensionFolders> folders, IEnumerable<IExtensionLoader> loaders, ICacheManager cacheManager) {
|
||||
_folders = folders;
|
||||
_loaders = loaders.OrderBy(x => x.Order);
|
||||
_cacheManager = cacheManager;
|
||||
_loaders = loaders.OrderBy(x => x.Order).ToArray();
|
||||
T = NullLocalizer.Instance;
|
||||
Logger = NullLogger.Instance;
|
||||
}
|
||||
@@ -67,35 +70,20 @@ namespace Orchard.Environment.Extensions {
|
||||
item.Dependencies.Any(x => StringComparer.OrdinalIgnoreCase.Equals(x, subject.Id));
|
||||
}
|
||||
|
||||
private IEnumerable<ExtensionEntry> LoadedExtensions() {
|
||||
foreach (var descriptor in AvailableExtensions()) {
|
||||
ExtensionEntry entry = null;
|
||||
try {
|
||||
entry = BuildEntry(descriptor);
|
||||
}
|
||||
catch (HttpCompileException ex) {
|
||||
Logger.Warning(ex, "Unable to load extension {0}", descriptor.Id);
|
||||
}
|
||||
if (entry != null)
|
||||
yield return entry;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<Feature> LoadFeatures(IEnumerable<FeatureDescriptor> featureDescriptors) {
|
||||
return featureDescriptors
|
||||
.Select(LoadFeature)
|
||||
.Select(descriptor => _cacheManager.Get(descriptor.Name, ctx => LoadFeature(descriptor)))
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
private Feature LoadFeature(FeatureDescriptor featureDescriptor) {
|
||||
|
||||
var extensionDescriptor = featureDescriptor.Extension;
|
||||
var featureId = featureDescriptor.Id;
|
||||
var extensionId = extensionDescriptor.Id;
|
||||
|
||||
string extensionId = GetExtensionForFeature(featureId);
|
||||
if (extensionId == null)
|
||||
throw new ArgumentException(T("Feature {0} was not found in any of the installed extensions", featureId).ToString());
|
||||
|
||||
var extension = LoadedExtensions().Where(x => x.Descriptor.Id == extensionId).FirstOrDefault();
|
||||
if (extension == null) {
|
||||
var extensionEntry = _cacheManager.Get(extensionId, ctx => BuildEntry(extensionDescriptor));
|
||||
if (extensionEntry == null) {
|
||||
// If the feature could not be compiled for some reason,
|
||||
// return a "null" feature, i.e. a feature with no exported types.
|
||||
return new Feature {
|
||||
@@ -104,7 +92,7 @@ namespace Orchard.Environment.Extensions {
|
||||
};
|
||||
}
|
||||
|
||||
var extensionTypes = extension.ExportedTypes.Where(t => t.IsClass && !t.IsAbstract);
|
||||
var extensionTypes = extensionEntry.ExportedTypes.Where(t => t.IsClass && !t.IsAbstract);
|
||||
var featureTypes = new List<Type>();
|
||||
|
||||
foreach (var type in extensionTypes) {
|
||||
@@ -120,27 +108,13 @@ namespace Orchard.Environment.Extensions {
|
||||
};
|
||||
}
|
||||
|
||||
private static string GetSourceFeatureNameForType(Type type, string extensionName) {
|
||||
private static string GetSourceFeatureNameForType(Type type, string extensionId) {
|
||||
foreach (OrchardFeatureAttribute featureAttribute in type.GetCustomAttributes(typeof(OrchardFeatureAttribute), false)) {
|
||||
return featureAttribute.FeatureName;
|
||||
}
|
||||
return extensionName;
|
||||
return extensionId;
|
||||
}
|
||||
|
||||
private string GetExtensionForFeature(string featureId) {
|
||||
foreach (var extensionDescriptor in AvailableExtensions()) {
|
||||
if (String.Equals(extensionDescriptor.Id, featureId, StringComparison.OrdinalIgnoreCase)) {
|
||||
return extensionDescriptor.Id;
|
||||
}
|
||||
foreach (var feature in extensionDescriptor.Features) {
|
||||
if (String.Equals(feature.Id, featureId, StringComparison.OrdinalIgnoreCase)) {
|
||||
return extensionDescriptor.Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private ExtensionEntry BuildEntry(ExtensionDescriptor descriptor) {
|
||||
foreach (var loader in _loaders) {
|
||||
ExtensionEntry entry = loader.Load(descriptor);
|
||||
|
@@ -7,15 +7,8 @@ using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.FileSystems.WebSite;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Logging;
|
||||
using Yaml.Grammar;
|
||||
|
||||
namespace Orchard.Environment.Extensions.Folders {
|
||||
public class ParseResult {
|
||||
public string Location { get; set; }
|
||||
public string Name { get; set; }
|
||||
public YamlDocument YamlDocument { get; set; }
|
||||
}
|
||||
|
||||
public class ExtensionFolders : IExtensionFolders {
|
||||
private readonly IEnumerable<string> _paths;
|
||||
private readonly string _manifestName;
|
||||
@@ -51,21 +44,21 @@ namespace Orchard.Environment.Extensions.Folders {
|
||||
ctx.Monitor(_webSiteFolder.WhenPathChanges(ctx.Key));
|
||||
var subfolderPaths = _webSiteFolder.ListDirectories(ctx.Key);
|
||||
var localList = new List<ExtensionDescriptor>();
|
||||
foreach ( var subfolderPath in subfolderPaths ) {
|
||||
var extensionName = Path.GetFileName(subfolderPath.TrimEnd('/', '\\'));
|
||||
foreach (var subfolderPath in subfolderPaths) {
|
||||
var extensionId = Path.GetFileName(subfolderPath.TrimEnd('/', '\\'));
|
||||
var manifestPath = Path.Combine(subfolderPath, _manifestName);
|
||||
ctx.Monitor(_webSiteFolder.WhenPathChanges(manifestPath));
|
||||
try {
|
||||
var descriptor = GetExtensionDescriptor(path, extensionName, manifestPath);
|
||||
if ( descriptor != null )
|
||||
var descriptor = GetExtensionDescriptor(path, extensionId, manifestPath);
|
||||
if (descriptor != null)
|
||||
localList.Add(descriptor);
|
||||
}
|
||||
catch ( Exception ex ) {
|
||||
catch (Exception ex) {
|
||||
// Ignore invalid module manifests
|
||||
Logger.Error(ex, "The module '{0}' could not be loaded. It was ignored.", extensionName);
|
||||
Logger.Error(ex, "The module '{0}' could not be loaded. It was ignored.", extensionId);
|
||||
}
|
||||
}
|
||||
return localList;
|
||||
return localList;
|
||||
});
|
||||
list.AddRange(subList);
|
||||
}
|
||||
@@ -73,99 +66,163 @@ namespace Orchard.Environment.Extensions.Folders {
|
||||
return list;
|
||||
}
|
||||
|
||||
private ExtensionDescriptor GetExtensionDescriptor(string locationPath, string extensionName, string manifestPath) {
|
||||
public static ExtensionDescriptor GetDescriptorForExtension(string locationPath, string extensionId, string extensionType, string manifestText) {
|
||||
Dictionary<string, string> manifest = ParseManifest(manifestText);
|
||||
var extensionDescriptor = new ExtensionDescriptor {
|
||||
Location = locationPath,
|
||||
Id = extensionId,
|
||||
ExtensionType = extensionType,
|
||||
Name = GetValue(manifest, "Name") ?? extensionId,
|
||||
Description = GetValue(manifest, "Description"),
|
||||
Version = GetValue(manifest, "Version"),
|
||||
OrchardVersion = GetValue(manifest, "OrchardVersion"),
|
||||
Author = GetValue(manifest, "Author"),
|
||||
WebSite = GetValue(manifest, "Website"),
|
||||
Tags = GetValue(manifest, "Tags"),
|
||||
AntiForgery = GetValue(manifest, "AntiForgery"),
|
||||
Zones = GetValue(manifest, "Zones"),
|
||||
BaseTheme = GetValue(manifest, "BaseTheme"),
|
||||
};
|
||||
extensionDescriptor.Features = GetFeaturesForExtension(GetValue(manifest, "Features"), extensionDescriptor);
|
||||
|
||||
return extensionDescriptor;
|
||||
}
|
||||
|
||||
private ExtensionDescriptor GetExtensionDescriptor(string locationPath, string extensionId, string manifestPath) {
|
||||
return _cacheManager.Get(manifestPath, context => {
|
||||
|
||||
context.Monitor(_webSiteFolder.WhenPathChanges(manifestPath));
|
||||
|
||||
var manifestText = _webSiteFolder.ReadFile(manifestPath);
|
||||
if (manifestText == null) {
|
||||
if (_manifestIsOptional) {
|
||||
manifestText = string.Format("Name: {0}", extensionName);
|
||||
manifestText = string.Format("Id: {0}", extensionId);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return GetDescriptorForExtension(locationPath, extensionName, ParseManifest(manifestText));
|
||||
return GetDescriptorForExtension(locationPath, extensionId, manifestText);
|
||||
});
|
||||
}
|
||||
|
||||
private ExtensionDescriptor GetDescriptorForExtension(string locationPath, string extensionName, ParseResult parseResult) {
|
||||
return GetDescriptorForExtension(locationPath, extensionName, _extensionType, parseResult);
|
||||
private ExtensionDescriptor GetDescriptorForExtension(string locationPath, string extensionId, string manifestText) {
|
||||
return GetDescriptorForExtension(locationPath, extensionId, _extensionType, manifestText);
|
||||
}
|
||||
|
||||
public static ParseResult ParseManifest(string manifestText) {
|
||||
bool success;
|
||||
var yamlStream = new YamlParser().ParseYamlStream(new TextInput(manifestText), out success);
|
||||
if (yamlStream == null || !success) {
|
||||
return null;
|
||||
}
|
||||
return new ParseResult {
|
||||
Name = manifestText,
|
||||
YamlDocument = yamlStream.Documents.Single()
|
||||
};
|
||||
}
|
||||
private static Dictionary<string, string> ParseManifest(string manifestText) {
|
||||
var manifest = new Dictionary<string, string>();
|
||||
|
||||
public static ExtensionDescriptor GetDescriptorForExtension(string locationPath, string extensionName, string extensionType, ParseResult parseResult) {
|
||||
var mapping = (Mapping)parseResult.YamlDocument.Root;
|
||||
var fields = mapping.Entities
|
||||
.Where(x => x.Key is Scalar)
|
||||
.ToDictionary(x => ((Scalar)x.Key).Text, x => x.Value);
|
||||
|
||||
var extensionDescriptor = new ExtensionDescriptor {
|
||||
Location = locationPath,
|
||||
Id = extensionName,
|
||||
ExtensionType = extensionType,
|
||||
Name = GetValue(fields, "Name") ?? extensionName,
|
||||
Description = GetValue(fields, "Description"),
|
||||
Version = GetValue(fields, "Version"),
|
||||
OrchardVersion = GetValue(fields, "OrchardVersion"),
|
||||
Author = GetValue(fields, "Author"),
|
||||
WebSite = GetValue(fields, "Website"),
|
||||
Tags = GetValue(fields, "Tags"),
|
||||
AntiForgery = GetValue(fields, "AntiForgery"),
|
||||
Zones = GetValue(fields, "Zones"),
|
||||
BaseTheme = GetValue(fields, "BaseTheme"),
|
||||
};
|
||||
|
||||
extensionDescriptor.Features = GetFeaturesForExtension(GetMapping(fields, "Features"), extensionDescriptor);
|
||||
|
||||
return extensionDescriptor;
|
||||
}
|
||||
|
||||
private static IEnumerable<FeatureDescriptor> GetFeaturesForExtension(Mapping features, ExtensionDescriptor extensionDescriptor) {
|
||||
var featureDescriptors = new List<FeatureDescriptor>();
|
||||
if (features != null) {
|
||||
foreach (var entity in features.Entities) {
|
||||
var featureDescriptor = new FeatureDescriptor {
|
||||
Extension = extensionDescriptor,
|
||||
Id = entity.Key.ToString(),
|
||||
};
|
||||
|
||||
if (featureDescriptor.Id == extensionDescriptor.Id) {
|
||||
featureDescriptor.Name = extensionDescriptor.Name;
|
||||
using (StringReader reader = new StringReader(manifestText)) {
|
||||
string line;
|
||||
while ((line = reader.ReadLine()) != null) {
|
||||
string[] field = line.Split(new[] { ":" }, 2, StringSplitOptions.None);
|
||||
int fieldLength = field.Length;
|
||||
if (fieldLength != 2)
|
||||
continue;
|
||||
for (int i = 0; i < fieldLength; i++) {
|
||||
field[i] = field[i].Trim();
|
||||
}
|
||||
|
||||
var featureMapping = (Mapping)entity.Value;
|
||||
foreach (var featureEntity in featureMapping.Entities) {
|
||||
if (featureEntity.Key.ToString() == "Description") {
|
||||
featureDescriptor.Description = featureEntity.Value.ToString();
|
||||
}
|
||||
else if (featureEntity.Key.ToString() == "Category") {
|
||||
featureDescriptor.Category = featureEntity.Value.ToString();
|
||||
}
|
||||
else if (featureEntity.Key.ToString() == "Name") {
|
||||
featureDescriptor.Name = featureEntity.Value.ToString();
|
||||
}
|
||||
else if (featureEntity.Key.ToString() == "Dependencies") {
|
||||
featureDescriptor.Dependencies = ParseFeatureDependenciesEntry(featureEntity.Value.ToString());
|
||||
}
|
||||
switch (field[0]) {
|
||||
case "Name":
|
||||
manifest.Add("Name", field[1]);
|
||||
break;
|
||||
case "Description":
|
||||
manifest.Add("Description", field[1]);
|
||||
break;
|
||||
case "Version":
|
||||
manifest.Add("Version", field[1]);
|
||||
break;
|
||||
case "OrchardVersion":
|
||||
manifest.Add("OrchardVersion", field[1]);
|
||||
break;
|
||||
case "Author":
|
||||
manifest.Add("Author", field[1]);
|
||||
break;
|
||||
case "Website":
|
||||
manifest.Add("Website", field[1]);
|
||||
break;
|
||||
case "Tags":
|
||||
manifest.Add("Tags", field[1]);
|
||||
break;
|
||||
case "AntiForgery":
|
||||
manifest.Add("AntiForgery", field[1]);
|
||||
break;
|
||||
case "Zones":
|
||||
manifest.Add("Zones", field[1]);
|
||||
break;
|
||||
case "BaseTheme":
|
||||
manifest.Add("BaseTheme", field[1]);
|
||||
break;
|
||||
case "Features":
|
||||
manifest.Add("Features", reader.ReadToEnd());
|
||||
break;
|
||||
}
|
||||
featureDescriptors.Add(featureDescriptor);
|
||||
}
|
||||
}
|
||||
|
||||
return manifest;
|
||||
}
|
||||
|
||||
private static IEnumerable<FeatureDescriptor> GetFeaturesForExtension(string featuresText, ExtensionDescriptor extensionDescriptor) {
|
||||
var featureDescriptors = new List<FeatureDescriptor>();
|
||||
if (featuresText != null) {
|
||||
FeatureDescriptor featureDescriptor = null;
|
||||
using (StringReader reader = new StringReader(featuresText)) {
|
||||
string line;
|
||||
while ((line = reader.ReadLine()) != null) {
|
||||
if (IsFeatureDeclaration(line)) {
|
||||
if (featureDescriptor != null) {
|
||||
featureDescriptors.Add(featureDescriptor);
|
||||
featureDescriptor = null;
|
||||
}
|
||||
featureDescriptor = new FeatureDescriptor {
|
||||
Extension = extensionDescriptor
|
||||
};
|
||||
string[] featureDeclaration = line.Split(new[] { ":" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
featureDescriptor.Id = featureDeclaration[0].Trim();
|
||||
if (featureDescriptor.Id == extensionDescriptor.Id) {
|
||||
featureDescriptor.Name = extensionDescriptor.Name;
|
||||
}
|
||||
}
|
||||
else if (IsFeatureFieldDeclaration(line)) {
|
||||
if (featureDescriptor != null) {
|
||||
string[] featureField = line.Split(new[] { ":" }, 2, StringSplitOptions.None);
|
||||
int featureFieldLength = featureField.Length;
|
||||
if (featureFieldLength != 2)
|
||||
continue;
|
||||
for (int i = 0; i < featureFieldLength; i++) {
|
||||
featureField[i] = featureField[i].Trim();
|
||||
}
|
||||
switch (featureField[0]) {
|
||||
case "Name":
|
||||
featureDescriptor.Name = featureField[1];
|
||||
break;
|
||||
case "Description":
|
||||
featureDescriptor.Description = featureField[1];
|
||||
break;
|
||||
case "Category":
|
||||
featureDescriptor.Category = featureField[1];
|
||||
break;
|
||||
case "Dependencies":
|
||||
featureDescriptor.Dependencies = ParseFeatureDependenciesEntry(featureField[1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
string message = string.Format("The line {0} in manifest for extension {1} was ignored", line, extensionDescriptor.Id);
|
||||
throw new ArgumentException(message);
|
||||
}
|
||||
}
|
||||
else {
|
||||
string message = string.Format("The line {0} in manifest for extension {1} was ignored", line, extensionDescriptor.Id);
|
||||
throw new ArgumentException(message);
|
||||
}
|
||||
}
|
||||
if (featureDescriptor != null)
|
||||
featureDescriptors.Add(featureDescriptor);
|
||||
}
|
||||
}
|
||||
|
||||
if (!featureDescriptors.Any(fd => fd.Id == extensionDescriptor.Id)) {
|
||||
featureDescriptors.Add(new FeatureDescriptor {
|
||||
Id = extensionDescriptor.Id,
|
||||
@@ -174,9 +231,31 @@ namespace Orchard.Environment.Extensions.Folders {
|
||||
Extension = extensionDescriptor
|
||||
});
|
||||
}
|
||||
|
||||
return featureDescriptors;
|
||||
}
|
||||
|
||||
private static bool IsFeatureFieldDeclaration(string line) {
|
||||
if (line.StartsWith("\t\t") ||
|
||||
line.StartsWith("\t ") ||
|
||||
line.StartsWith(" ") ||
|
||||
line.StartsWith(" \t"))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool IsFeatureDeclaration(string line) {
|
||||
int lineLength = line.Length;
|
||||
if (line.StartsWith("\t") && lineLength >= 2) {
|
||||
return !Char.IsWhiteSpace(line[1]);
|
||||
}
|
||||
if (line.StartsWith(" ") && lineLength >= 5)
|
||||
return !Char.IsWhiteSpace(line[4]);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static string[] ParseFeatureDependenciesEntry(string dependenciesEntry) {
|
||||
var dependencies = new List<string>();
|
||||
foreach (var s in dependenciesEntry.Split(',')) {
|
||||
@@ -185,14 +264,9 @@ namespace Orchard.Environment.Extensions.Folders {
|
||||
return dependencies.ToArray();
|
||||
}
|
||||
|
||||
private static Mapping GetMapping(IDictionary<string, DataItem> fields, string key) {
|
||||
DataItem value;
|
||||
return fields.TryGetValue(key, out value) ? (Mapping)value : null;
|
||||
}
|
||||
|
||||
private static string GetValue(IDictionary<string, DataItem> fields, string key) {
|
||||
DataItem value;
|
||||
return fields.TryGetValue(key, out value) ? value.ToString() : null;
|
||||
private static string GetValue(IDictionary<string, string> fields, string key) {
|
||||
string value;
|
||||
return fields.TryGetValue(key, out value) ? value : null;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,6 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Yaml.Grammar;
|
||||
|
||||
namespace Orchard.Environment.Extensions.Folders {
|
||||
public interface IExtensionFolders {
|
||||
|
@@ -14,14 +14,6 @@ namespace Orchard.Environment.Extensions {
|
||||
}
|
||||
|
||||
public static class ExtensionManagerExtensions {
|
||||
public static IEnumerable<ExtensionDescriptor> EnabledExtensions(this IExtensionManager extensionManager, ShellDescriptor descriptor) {
|
||||
var enabledFeatures = EnabledFeatures(extensionManager, descriptor);
|
||||
return extensionManager.AvailableExtensions()
|
||||
.Where(extensionDescriptor =>
|
||||
extensionDescriptor.Features.Any(featureDescriptor =>
|
||||
enabledFeatures.Any(availableFeature => featureDescriptor.Id == availableFeature.Id)));
|
||||
}
|
||||
|
||||
public static IEnumerable<FeatureDescriptor> EnabledFeatures(this IExtensionManager extensionManager, ShellDescriptor descriptor) {
|
||||
return extensionManager.AvailableExtensions()
|
||||
.SelectMany(extensionDescriptor => extensionDescriptor.Features)
|
||||
|
@@ -1,15 +1,17 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.FileSystems.Dependencies;
|
||||
using Orchard.Logging;
|
||||
|
||||
namespace Orchard.Environment.Extensions.Loaders {
|
||||
public class AreaExtensionLoader : ExtensionLoaderBase {
|
||||
private readonly string _hostAssemblyName = "Orchard.Web";
|
||||
private readonly IAssemblyLoader _assemblyLoader;
|
||||
|
||||
public AreaExtensionLoader(IDependenciesFolder dependenciesFolder)
|
||||
public AreaExtensionLoader(IDependenciesFolder dependenciesFolder, IAssemblyLoader assemblyLoader)
|
||||
: base(dependenciesFolder) {
|
||||
_assemblyLoader = assemblyLoader;
|
||||
|
||||
Logger = NullLogger.Instance;
|
||||
}
|
||||
@@ -33,7 +35,11 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
protected override ExtensionEntry LoadWorker(ExtensionDescriptor descriptor) {
|
||||
//Logger.Information("Loading extension \"{0}\"", descriptor.Name);
|
||||
|
||||
var assembly = Assembly.Load("Orchard.Web");
|
||||
var assembly = _assemblyLoader.Load(_hostAssemblyName);
|
||||
if (assembly == null) {
|
||||
Logger.Warning("Support for 'Areas' modules disabled because assembly '{0}' could not be loaded", _hostAssemblyName);
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ExtensionEntry {
|
||||
Descriptor = descriptor,
|
||||
@@ -42,8 +48,8 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
};
|
||||
}
|
||||
|
||||
private static bool IsTypeFromModule(Type type, ExtensionDescriptor descriptor) {
|
||||
return (type.Namespace + ".").StartsWith("Orchard.Web.Areas." + descriptor.Id + ".");
|
||||
private bool IsTypeFromModule(Type type, ExtensionDescriptor descriptor) {
|
||||
return (type.Namespace + ".").StartsWith(_hostAssemblyName + ".Areas." + descriptor.Id + ".");
|
||||
}
|
||||
}
|
||||
}
|
@@ -10,9 +10,12 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
/// Load an extension by looking into specific namespaces of the "Orchard.Core" assembly
|
||||
/// </summary>
|
||||
public class CoreExtensionLoader : ExtensionLoaderBase {
|
||||
private readonly string _coreAssemblyName = "Orchard.Core";
|
||||
private readonly IAssemblyLoader _assemblyLoader;
|
||||
|
||||
public CoreExtensionLoader(IDependenciesFolder dependenciesFolder)
|
||||
public CoreExtensionLoader(IDependenciesFolder dependenciesFolder, IAssemblyLoader assemblyLoader)
|
||||
: base(dependenciesFolder) {
|
||||
_assemblyLoader = assemblyLoader;
|
||||
|
||||
Logger = NullLogger.Instance;
|
||||
}
|
||||
@@ -36,7 +39,11 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
protected override ExtensionEntry LoadWorker(ExtensionDescriptor descriptor) {
|
||||
//Logger.Information("Loading extension \"{0}\"", descriptor.Name);
|
||||
|
||||
var assembly = Assembly.Load("Orchard.Core");
|
||||
var assembly = _assemblyLoader.Load(_coreAssemblyName);
|
||||
if (assembly == null) {
|
||||
Logger.Error("Core modules cannot be activated because assembly '{0}' could not be loaded", _coreAssemblyName);
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ExtensionEntry {
|
||||
Descriptor = descriptor,
|
||||
@@ -45,8 +52,8 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
};
|
||||
}
|
||||
|
||||
private static bool IsTypeFromModule(Type type, ExtensionDescriptor descriptor) {
|
||||
return (type.Namespace + ".").StartsWith("Orchard.Core." + descriptor.Id + ".");
|
||||
private bool IsTypeFromModule(Type type, ExtensionDescriptor descriptor) {
|
||||
return (type.Namespace + ".").StartsWith(_coreAssemblyName + "." + descriptor.Id + ".");
|
||||
}
|
||||
}
|
||||
}
|
@@ -109,8 +109,8 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
return projectFile.References.Select(r => new ExtensionReferenceProbeEntry {
|
||||
Descriptor = descriptor,
|
||||
Loader = this,
|
||||
Name = r.AssemblyName,
|
||||
VirtualPath = GetReferenceVirtualPath(projectPath, r.AssemblyName)
|
||||
Name = r.SimpleName,
|
||||
VirtualPath = GetReferenceVirtualPath(projectPath, r.SimpleName)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Orchard.Environment.Extensions.Models {
|
||||
public class ExtensionDescriptor {
|
||||
|
55
src/Orchard/Environment/IAssemblyLoader.cs
Normal file
55
src/Orchard/Environment/IAssemblyLoader.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Orchard.Logging;
|
||||
|
||||
namespace Orchard.Environment {
|
||||
public interface IAssemblyLoader {
|
||||
Assembly Load(string assemblyName);
|
||||
}
|
||||
|
||||
public class DefaultAssemblyLoader : IAssemblyLoader {
|
||||
private readonly ConcurrentDictionary<string, Assembly> _loadedAssemblies = new ConcurrentDictionary<string, Assembly>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
public DefaultAssemblyLoader() {
|
||||
Logger = NullLogger.Instance;
|
||||
}
|
||||
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
public Assembly Load(string assemblyName) {
|
||||
try {
|
||||
return _loadedAssemblies.GetOrAdd(this.ExtractAssemblyName(assemblyName), shortName => LoadWorker(shortName, assemblyName));
|
||||
}
|
||||
catch (Exception e) {
|
||||
Logger.Warning(e, "Error loading assembly '{0}'", assemblyName);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Assembly LoadWorker(string shortName, string fullName) {
|
||||
// If short assembly name, look in list of loaded assemblies first
|
||||
if (shortName == fullName) {
|
||||
var result = AppDomain.CurrentDomain.GetAssemblies()
|
||||
.Where(a => StringComparer.OrdinalIgnoreCase.Equals(shortName, a.GetName().Name))
|
||||
.SingleOrDefault();
|
||||
|
||||
if (result != null)
|
||||
return result;
|
||||
}
|
||||
|
||||
return Assembly.Load(fullName);
|
||||
}
|
||||
}
|
||||
|
||||
public static class AssemblyLoaderExtensions {
|
||||
public static string ExtractAssemblyName(this IAssemblyLoader assemblyLoader, string fullName) {
|
||||
int index = fullName.IndexOf(',');
|
||||
if (index < 0)
|
||||
return fullName;
|
||||
return fullName.Substring(0, index);
|
||||
}
|
||||
}
|
||||
}
|
@@ -15,9 +15,11 @@ namespace Orchard.Environment {
|
||||
|
||||
public class DefaultBuildManager : IBuildManager {
|
||||
private readonly IVirtualPathProvider _virtualPathProvider;
|
||||
private readonly IAssemblyLoader _assemblyLoader;
|
||||
|
||||
public DefaultBuildManager(IVirtualPathProvider virtualPathProvider) {
|
||||
public DefaultBuildManager(IVirtualPathProvider virtualPathProvider, IAssemblyLoader assemblyLoader) {
|
||||
_virtualPathProvider = virtualPathProvider;
|
||||
_assemblyLoader = assemblyLoader;
|
||||
}
|
||||
|
||||
public IEnumerable<Assembly> GetReferencedAssemblies() {
|
||||
@@ -33,7 +35,7 @@ namespace Orchard.Environment {
|
||||
if (!HasReferencedAssembly(name))
|
||||
return null;
|
||||
|
||||
return Assembly.Load(name);
|
||||
return _assemblyLoader.Load(name);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,19 +43,4 @@ namespace Orchard.Environment {
|
||||
return BuildManager.GetCompiledAssembly(virtualPath);
|
||||
}
|
||||
}
|
||||
|
||||
public static class BuildManagerExtensions {
|
||||
public static IEnumerable<string> GetReferencedAssemblyNames(this IBuildManager buildManager) {
|
||||
return buildManager
|
||||
.GetReferencedAssemblies()
|
||||
.Select(a => ExtractAssemblyName(a.FullName));
|
||||
}
|
||||
|
||||
public static string ExtractAssemblyName(string fullName) {
|
||||
int index = fullName.IndexOf(',');
|
||||
if (index < 0)
|
||||
return fullName;
|
||||
return fullName.Substring(0, index);
|
||||
}
|
||||
}
|
||||
}
|
@@ -44,6 +44,7 @@ namespace Orchard.Environment {
|
||||
builder.RegisterType<AppDataFolderRoot>().As<IAppDataFolderRoot>().SingleInstance();
|
||||
builder.RegisterType<DefaultExtensionCompiler>().As<IExtensionCompiler>().SingleInstance();
|
||||
builder.RegisterType<DefaultProjectFileParser>().As<IProjectFileParser>().SingleInstance();
|
||||
builder.RegisterType<DefaultAssemblyLoader>().As<IAssemblyLoader>().SingleInstance();
|
||||
builder.RegisterType<HttpContextAccessor>().As<IHttpContextAccessor>().SingleInstance();
|
||||
|
||||
RegisterVolatileProvider<WebSiteFolder, IWebSiteFolder>(builder);
|
||||
|
@@ -70,6 +70,9 @@ namespace Orchard.Environment.ShellBuilders {
|
||||
registration = registration.As(interfaceType);
|
||||
if (typeof(ISingletonDependency).IsAssignableFrom(interfaceType)) {
|
||||
registration = registration.InstancePerMatchingLifetimeScope("shell");
|
||||
}
|
||||
else if (typeof(IUnitOfWorkDependency).IsAssignableFrom(interfaceType)) {
|
||||
registration = registration.InstancePerMatchingLifetimeScope("work");
|
||||
}
|
||||
else if (typeof(ITransientDependency).IsAssignableFrom(interfaceType)) {
|
||||
registration = registration.InstancePerDependency();
|
||||
|
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using Orchard.Environment;
|
||||
using Orchard.FileSystems.AppData;
|
||||
using Orchard.Logging;
|
||||
|
||||
@@ -7,9 +8,11 @@ namespace Orchard.FileSystems.Dependencies {
|
||||
public class DefaultAssemblyProbingFolder : IAssemblyProbingFolder {
|
||||
private const string BasePath = "Dependencies";
|
||||
private readonly IAppDataFolder _appDataFolder;
|
||||
private readonly IAssemblyLoader _assemblyLoader;
|
||||
|
||||
public DefaultAssemblyProbingFolder(IAppDataFolder appDataFolder) {
|
||||
public DefaultAssemblyProbingFolder(IAppDataFolder appDataFolder, IAssemblyLoader assemblyLoader) {
|
||||
_appDataFolder = appDataFolder;
|
||||
_assemblyLoader = assemblyLoader;
|
||||
|
||||
Logger = NullLogger.Instance;
|
||||
}
|
||||
@@ -39,7 +42,7 @@ namespace Orchard.FileSystems.Dependencies {
|
||||
if (!_appDataFolder.FileExists(path))
|
||||
return null;
|
||||
|
||||
return Assembly.Load(moduleName);
|
||||
return _assemblyLoader.Load(moduleName);
|
||||
}
|
||||
|
||||
public void DeleteAssembly(string moduleName) {
|
||||
|
@@ -14,12 +14,20 @@ namespace Orchard {
|
||||
public interface ISingletonDependency : IDependency {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Base interface for services that may *only* be instantiated in a unit of work.
|
||||
/// This interface is used to guarantee they are not accidentally referenced by a singleton dependency.
|
||||
/// </summary>
|
||||
public interface IUnitOfWorkDependency : IDependency {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Base interface for services that are instantiated per usage.
|
||||
/// </summary>
|
||||
public interface ITransientDependency : IDependency {
|
||||
}
|
||||
|
||||
|
||||
public abstract class Component : IDependency {
|
||||
protected Component() {
|
||||
Logger = NullLogger.Instance;
|
||||
|
@@ -9,9 +9,9 @@ namespace Orchard {
|
||||
WorkContext GetContext();
|
||||
IWorkContextScope CreateWorkContextScope();
|
||||
}
|
||||
|
||||
|
||||
public interface IWorkContextStateProvider : IDependency {
|
||||
Func<T> Get<T>(string name);
|
||||
Func<WorkContext, T> Get<T>(string name);
|
||||
}
|
||||
|
||||
public interface IWorkContextScope : IDisposable {
|
||||
|
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Orchard.Settings;
|
||||
|
||||
namespace Orchard.Localization.Services {
|
||||
public class CurrentCultureWorkContext : IWorkContextStateProvider {
|
||||
private readonly ICultureManager _cultureManager;
|
||||
|
||||
public CurrentCultureWorkContext(ICultureManager cultureManager) {
|
||||
_cultureManager = cultureManager;
|
||||
}
|
||||
|
||||
public Func<WorkContext, T> Get<T>(string name) {
|
||||
if (name == "CurrentCulture") {
|
||||
return ctx => (T)(object)_cultureManager.GetCurrentCulture(ctx.HttpContext);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@@ -11,7 +11,6 @@ using Orchard.FileSystems.WebSite;
|
||||
namespace Orchard.Localization.Services {
|
||||
public class DefaultLocalizedStringManager : ILocalizedStringManager {
|
||||
private readonly IWebSiteFolder _webSiteFolder;
|
||||
private readonly ICultureManager _cultureManager;
|
||||
private readonly IExtensionManager _extensionManager;
|
||||
private readonly ICacheManager _cacheManager;
|
||||
private readonly ShellSettings _shellSettings;
|
||||
@@ -23,13 +22,11 @@ namespace Orchard.Localization.Services {
|
||||
const string TenantLocalizationFilePathFormat = "~/App_Data/Sites/{0}/Localization/{1}/orchard.po";
|
||||
|
||||
public DefaultLocalizedStringManager(
|
||||
ICultureManager cultureManager,
|
||||
IWebSiteFolder webSiteFolder,
|
||||
IWebSiteFolder webSiteFolder,
|
||||
IExtensionManager extensionManager,
|
||||
ICacheManager cacheManager,
|
||||
ShellSettings shellSettings,
|
||||
ISignals signals) {
|
||||
_cultureManager = cultureManager;
|
||||
_webSiteFolder = webSiteFolder;
|
||||
_extensionManager = extensionManager;
|
||||
_cacheManager = cacheManager;
|
||||
@@ -44,45 +41,36 @@ namespace Orchard.Localization.Services {
|
||||
// parent culture as defined in the .net culture hierarchy. e.g. fr-FR will fallback to fr.
|
||||
// In case it's not found anywhere, the text is returned as is.
|
||||
public string GetLocalizedString(string scope, string text, string cultureName) {
|
||||
var cultures = LoadCultures();
|
||||
var culture = LoadCulture(cultureName);
|
||||
|
||||
foreach (var culture in cultures) {
|
||||
if (String.Equals(cultureName, culture.CultureName, StringComparison.OrdinalIgnoreCase)) {
|
||||
string scopedKey = (scope + "|" + text).ToLowerInvariant();
|
||||
if (culture.Translations.ContainsKey(scopedKey)) {
|
||||
return culture.Translations[scopedKey];
|
||||
}
|
||||
|
||||
string genericKey = ("|" + text).ToLowerInvariant();
|
||||
if ( culture.Translations.ContainsKey(genericKey) ) {
|
||||
return culture.Translations[genericKey];
|
||||
}
|
||||
|
||||
return GetParentTranslation(scope, text, cultureName, cultures);
|
||||
}
|
||||
string scopedKey = (scope + "|" + text).ToLowerInvariant();
|
||||
if (culture.Translations.ContainsKey(scopedKey)) {
|
||||
return culture.Translations[scopedKey];
|
||||
}
|
||||
|
||||
return text;
|
||||
string genericKey = ("|" + text).ToLowerInvariant();
|
||||
if (culture.Translations.ContainsKey(genericKey)) {
|
||||
return culture.Translations[genericKey];
|
||||
}
|
||||
|
||||
return GetParentTranslation(scope, text, cultureName);
|
||||
}
|
||||
|
||||
private static string GetParentTranslation(string scope, string text, string cultureName, IEnumerable<CultureDictionary> cultures) {
|
||||
private string GetParentTranslation(string scope, string text, string cultureName) {
|
||||
string scopedKey = (scope + "|" + text).ToLowerInvariant();
|
||||
string genericKey = ("|" + text).ToLowerInvariant();
|
||||
try {
|
||||
CultureInfo cultureInfo = CultureInfo.GetCultureInfo(cultureName);
|
||||
CultureInfo parentCultureInfo = cultureInfo.Parent;
|
||||
if (parentCultureInfo.IsNeutralCulture) {
|
||||
foreach (var culture in cultures) {
|
||||
if (String.Equals(parentCultureInfo.Name, culture.CultureName, StringComparison.OrdinalIgnoreCase)) {
|
||||
if (culture.Translations.ContainsKey(scopedKey)) {
|
||||
return culture.Translations[scopedKey];
|
||||
}
|
||||
if (culture.Translations.ContainsKey(genericKey)) {
|
||||
return culture.Translations[genericKey];
|
||||
}
|
||||
break;
|
||||
}
|
||||
var culture = LoadCulture(parentCultureInfo.Name);
|
||||
if (culture.Translations.ContainsKey(scopedKey)) {
|
||||
return culture.Translations[scopedKey];
|
||||
}
|
||||
if (culture.Translations.ContainsKey(genericKey)) {
|
||||
return culture.Translations[genericKey];
|
||||
}
|
||||
return text;
|
||||
}
|
||||
}
|
||||
catch (CultureNotFoundException) { }
|
||||
@@ -90,22 +78,17 @@ namespace Orchard.Localization.Services {
|
||||
return text;
|
||||
}
|
||||
|
||||
// Loads the culture dictionaries in memory and caches them.
|
||||
// Loads the culture dictionary in memory and caches it.
|
||||
// Cache entry will be invalidated any time the directories hosting
|
||||
// the .po files are modified.
|
||||
private IEnumerable<CultureDictionary> LoadCultures() {
|
||||
return _cacheManager.Get("cultures", ctx => {
|
||||
var cultures = new List<CultureDictionary>();
|
||||
foreach (var culture in _cultureManager.ListCultures()) {
|
||||
cultures.Add(new CultureDictionary {
|
||||
CultureName = culture,
|
||||
Translations = LoadTranslationsForCulture(culture, ctx)
|
||||
});
|
||||
}
|
||||
private CultureDictionary LoadCulture(string culture) {
|
||||
return _cacheManager.Get(culture, ctx => {
|
||||
ctx.Monitor(_signals.When("culturesChanged"));
|
||||
return cultures;
|
||||
return new CultureDictionary {
|
||||
CultureName = culture,
|
||||
Translations = LoadTranslationsForCulture(culture, ctx)
|
||||
};
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Merging occurs from multiple locations:
|
||||
@@ -128,22 +111,22 @@ namespace Orchard.Localization.Services {
|
||||
context.Monitor(_webSiteFolder.WhenPathChanges(corePath));
|
||||
}
|
||||
|
||||
foreach ( var module in _extensionManager.AvailableExtensions() ) {
|
||||
if ( String.Equals(module.ExtensionType, "Module") ) {
|
||||
foreach (var module in _extensionManager.AvailableExtensions()) {
|
||||
if (String.Equals(module.ExtensionType, "Module")) {
|
||||
string modulePath = string.Format(ModulesLocalizationFilePathFormat, module.Id, culture);
|
||||
text = _webSiteFolder.ReadFile(modulePath);
|
||||
if ( text != null ) {
|
||||
if (text != null) {
|
||||
ParseLocalizationStream(text, translations, true);
|
||||
context.Monitor(_webSiteFolder.WhenPathChanges(modulePath));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( var theme in _extensionManager.AvailableExtensions() ) {
|
||||
if ( String.Equals(theme.ExtensionType, "Theme") ) {
|
||||
foreach (var theme in _extensionManager.AvailableExtensions()) {
|
||||
if (String.Equals(theme.ExtensionType, "Theme")) {
|
||||
string themePath = string.Format(ThemesLocalizationFilePathFormat, theme.Id, culture);
|
||||
text = _webSiteFolder.ReadFile(themePath);
|
||||
if ( text != null ) {
|
||||
if (text != null) {
|
||||
ParseLocalizationStream(text, translations, true);
|
||||
context.Monitor(_webSiteFolder.WhenPathChanges(themePath));
|
||||
}
|
||||
@@ -225,7 +208,7 @@ namespace Orchard.Localization.Services {
|
||||
if (poLine.StartsWith("msgstr")) {
|
||||
string translation = ParseTranslation(poLine);
|
||||
// ignore incomplete localizations (empty msgid or msgstr)
|
||||
if ( !String.IsNullOrWhiteSpace(id) && !String.IsNullOrWhiteSpace(translation) ) {
|
||||
if (!String.IsNullOrWhiteSpace(id) && !String.IsNullOrWhiteSpace(translation)) {
|
||||
string scopedKey = (scope + "|" + id).ToLowerInvariant();
|
||||
if (!translations.ContainsKey(scopedKey)) {
|
||||
translations.Add(scopedKey, translation);
|
||||
|
@@ -8,12 +8,13 @@ using Orchard.Logging;
|
||||
namespace Orchard.Localization {
|
||||
public class Text : IText {
|
||||
private readonly string _scope;
|
||||
private readonly ICultureManager _cultureManager;
|
||||
private readonly IWorkContextAccessor _workContextAccessor;
|
||||
private readonly ILocalizedStringManager _localizedStringManager;
|
||||
|
||||
public Text(string scope, ICultureManager cultureManager, ILocalizedStringManager localizedStringManager) {
|
||||
|
||||
public Text(string scope, IWorkContextAccessor workContextAccessor, ILocalizedStringManager localizedStringManager) {
|
||||
_scope = scope;
|
||||
_cultureManager = cultureManager;
|
||||
_workContextAccessor = workContextAccessor;
|
||||
_localizedStringManager = localizedStringManager;
|
||||
Logger = NullLogger.Instance;
|
||||
}
|
||||
@@ -23,7 +24,8 @@ namespace Orchard.Localization {
|
||||
public LocalizedString Get(string textHint, params object[] args) {
|
||||
Logger.Debug("{0} localizing '{1}'", _scope, textHint);
|
||||
|
||||
string currentCulture = HttpContext.Current == null ? _cultureManager.GetSiteCulture() : _cultureManager.GetCurrentCulture(new HttpContextWrapper(HttpContext.Current));
|
||||
var workContext = _workContextAccessor.GetContext();
|
||||
var currentCulture = workContext.CurrentCulture;
|
||||
var localizedFormat = _localizedStringManager.GetLocalizedString(_scope, textHint, currentCulture);
|
||||
|
||||
return args.Length == 0
|
||||
|
@@ -36,11 +36,13 @@ namespace Orchard.Mvc.ViewEngines.Razor {
|
||||
foreach (var entry in entries) {
|
||||
if (entry.directive != null) {
|
||||
if (entry.directive.StartsWith("<%@ Assembly Name=\"")) {
|
||||
provider.AssemblyBuilder.AddAssemblyReference(Assembly.Load(entry.descriptor.Name));
|
||||
var assembly = AssemblyLoader.Load(entry.descriptor.Name);
|
||||
if (assembly != null)
|
||||
provider.AssemblyBuilder.AddAssemblyReference(assembly);
|
||||
}
|
||||
else if (entry.directive.StartsWith("<%@ Assembly Src=\"")) {
|
||||
// Returned assembly may be null if the .csproj file doesn't containt any .cs file, for example
|
||||
Assembly assembly = BuildManager.GetCompiledAssembly(entry.descriptor.VirtualPath);
|
||||
var assembly = BuildManager.GetCompiledAssembly(entry.descriptor.VirtualPath);
|
||||
if (assembly != null)
|
||||
provider.AssemblyBuilder.AddAssemblyReference(assembly);
|
||||
}
|
||||
@@ -57,12 +59,14 @@ namespace Orchard.Mvc.ViewEngines.Razor {
|
||||
set {
|
||||
_hostContainer = value;
|
||||
BuildManager = _hostContainer.Resolve<IBuildManager>();
|
||||
AssemblyLoader = _hostContainer.Resolve<IAssemblyLoader>();
|
||||
DependenciesFolder = _hostContainer.Resolve<IDependenciesFolder>();
|
||||
Loaders = _hostContainer.Resolve<IEnumerable<IExtensionLoader>>();
|
||||
}
|
||||
}
|
||||
|
||||
public IBuildManager BuildManager { get; set; }
|
||||
public IAssemblyLoader AssemblyLoader { get; set; }
|
||||
public IDependenciesFolder DependenciesFolder { get; set; }
|
||||
public IEnumerable<IExtensionLoader> Loaders { get; set; }
|
||||
|
||||
|
@@ -116,9 +116,6 @@
|
||||
</Reference>
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Abstractions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
@@ -140,14 +137,6 @@
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="Yaml, Version=1.0.3370.39839, Culture=neutral, PublicKeyToken=187a3d240e44a135, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\yaml\Yaml.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="YamlSerializer, Version=0.9.0.2, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\yaml\YamlSerializer.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ContentManagement\DefaultContentDisplay.cs" />
|
||||
@@ -167,6 +156,8 @@
|
||||
<Compile Include="Environment\DefaultHostEnvironment.cs" />
|
||||
<Compile Include="Environment\Extensions\Loaders\RawThemeExtensionLoader.cs" />
|
||||
<Compile Include="Environment\Features\FeatureManager.cs" />
|
||||
<Compile Include="Environment\IAssemblyLoader.cs" />
|
||||
<Compile Include="Localization\Services\CurrentCultureWorkContext.cs" />
|
||||
<Compile Include="Localization\Services\DefaultLocalizedStringManager.cs" />
|
||||
<Compile Include="Localization\Services\ILocalizedStringManager.cs" />
|
||||
<Compile Include="Messaging\Services\DefaultMessageManager.cs" />
|
||||
|
@@ -8,9 +8,9 @@ namespace Orchard.Security {
|
||||
_authenticationService = authenticationService;
|
||||
}
|
||||
|
||||
public Func<T> Get<T>(string name) {
|
||||
public Func<WorkContext, T> Get<T>(string name) {
|
||||
if (name == "CurrentUser")
|
||||
return () => (T)_authenticationService.GetAuthenticatedUser();
|
||||
return ctx => (T)_authenticationService.GetAuthenticatedUser();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -8,10 +8,10 @@ namespace Orchard.Settings {
|
||||
_siteService = siteService;
|
||||
}
|
||||
|
||||
public Func<T> Get<T>(string name) {
|
||||
public Func<WorkContext, T> Get<T>(string name) {
|
||||
if (name == "CurrentSite") {
|
||||
var siteSettings = _siteService.GetSiteSettings();
|
||||
return () => (T)siteSettings;
|
||||
return ctx => (T)siteSettings;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@@ -10,10 +10,10 @@ namespace Orchard.UI.Zones {
|
||||
_shapeFactory = shapeFactory;
|
||||
}
|
||||
|
||||
public Func<T> Get<T>(string name) {
|
||||
public Func<WorkContext, T> Get<T>(string name) {
|
||||
if (name == "Layout") {
|
||||
var layout = _shapeFactory.Create("Layout", Arguments.Empty());
|
||||
return () => (T)layout;
|
||||
return ctx => (T)layout;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using System.Web;
|
||||
using System;
|
||||
using System.Web;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Security;
|
||||
using Orchard.Settings;
|
||||
@@ -36,5 +37,10 @@ namespace Orchard {
|
||||
get { return GetState<ExtensionDescriptor>("CurrentTheme"); }
|
||||
set { SetState("CurrentTheme", value); }
|
||||
}
|
||||
|
||||
public string CurrentCulture {
|
||||
get { return GetState<string>("CurrentCulture"); }
|
||||
set { SetState("CurrentCulture", value); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@
|
||||
|
||||
<system.web>
|
||||
|
||||
<compilation debug="true" targetFramework="4.0">
|
||||
<compilation targetFramework="4.0">
|
||||
<assemblies>
|
||||
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
||||
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
||||
|
Reference in New Issue
Block a user