Back porting Pager shapes from dev branch

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2011-11-01 16:07:20 -07:00
parent d7f258b830
commit 2760db08b2
13 changed files with 1998 additions and 1808 deletions

View File

@@ -388,7 +388,6 @@
<Content Include="Routable\Views\Parts.RoutableTitle.cshtml" />
<Content Include="Routable\Views\Routable.HomePage.cshtml" />
<Content Include="Contents\Views\Content.Summary.cshtml" />
<Content Include="Shapes\Views\Pager.cshtml" />
<Content Include="Contents\Views\Content.SaveButton.cshtml" />
<Content Include="Contents\Views\Content.PublishButton.cshtml" />
<Content Include="Shapes\Scripts\Web.config">

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
@@ -6,10 +7,12 @@ using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Html;
using System.Web.Routing;
using Orchard.DisplayManagement;
using Orchard.DisplayManagement.Descriptors;
using Orchard.DisplayManagement.Descriptors.ResourceBindingStrategy;
using Orchard.Environment;
using Orchard.Localization;
using Orchard.Mvc;
using Orchard.Settings;
using Orchard.UI;
@@ -33,8 +36,12 @@ namespace Orchard.Core.Shapes {
_workContext = workContext;
_resourceManager = resourceManager;
_httpContextAccessor = httpContextAccessor;
T = NullLocalizer.Instance;
}
public Localizer T { get; set; }
public void Discover(ShapeTableBuilder builder) {
// the root page shape named 'Layout' is wrapped with 'Document'
// and has an automatic zone creating behavior
@@ -103,6 +110,73 @@ namespace Orchard.Core.Shapes {
menuItem.Metadata.Alternates.Add("LocalMenuItem__" + menu.MenuName);
});
#region Pager alternates
builder.Describe("Pager")
.OnDisplaying(displaying => {
var pager = displaying.Shape;
string pagerId = pager.PagerId;
if (!String.IsNullOrWhiteSpace(pagerId))
displaying.Shape.Metadata.Alternates.Add("Pager__" + EncodeAlternateElement(pagerId));
});
builder.Describe("Pager_Gap")
.OnDisplaying(displaying => {
var pager = displaying.Shape.Pager;
string pagerId = pager.PagerId;
if (!String.IsNullOrWhiteSpace(pagerId))
pager.Metadata.Alternates.Add("Pager_Gap__" + EncodeAlternateElement(pagerId));
});
builder.Describe("Pager_First")
.OnDisplaying(displaying => {
var pager = displaying.Shape.Pager;
string pagerId = pager.PagerId;
if (!String.IsNullOrWhiteSpace(pagerId))
displaying.Shape.Metadata.Alternates.Add("Pager_First__" + EncodeAlternateElement(pagerId));
});
builder.Describe("Pager_Previous")
.OnDisplaying(displaying => {
var pager = displaying.Shape.Pager;
string pagerId = pager.PagerId;
if (!String.IsNullOrWhiteSpace(pagerId))
displaying.Shape.Metadata.Alternates.Add("Pager_Previous__" + EncodeAlternateElement(pagerId));
});
builder.Describe("Pager_Next")
.OnDisplaying(displaying => {
var pager = displaying.Shape.Pager;
string pagerId = pager.PagerId;
if (!String.IsNullOrWhiteSpace(pagerId))
displaying.Shape.Metadata.Alternates.Add("Pager_Next__" + EncodeAlternateElement(pagerId));
});
builder.Describe("Pager_Last")
.OnDisplaying(displaying => {
var pager = displaying.Shape.Pager;
string pagerId = pager.PagerId;
if (!String.IsNullOrWhiteSpace(pagerId))
displaying.Shape.Metadata.Alternates.Add("Pager_Last__" + EncodeAlternateElement(pagerId));
});
builder.Describe("Pager_CurrentPage")
.OnDisplaying(displaying => {
var pager = displaying.Shape.Pager;
string pagerId = pager.PagerId;
if (!String.IsNullOrWhiteSpace(pagerId))
displaying.Shape.Metadata.Alternates.Add("Pager_CurrentPage__" + EncodeAlternateElement(pagerId));
});
builder.Describe("Pager_Links")
.OnDisplaying(displaying => {
var pager = displaying.Shape;
string pagerId = pager.PagerId;
if (!String.IsNullOrWhiteSpace(pagerId))
displaying.Shape.Metadata.Alternates.Add("Pager_Links__" + EncodeAlternateElement(pagerId));
});
#endregion
// 'List' shapes start with several empty collections
builder.Describe("List")
.OnCreated(created => {
@@ -240,12 +314,12 @@ namespace Orchard.Core.Shapes {
[Shape]
public void Style(TextWriter Output, ResourceDefinition Resource, string Url, string Condition, Dictionary<string, string> TagAttributes) {
UI.Resources.ResourceManager.WriteResource(Output, Resource, Url, Condition, TagAttributes);
ResourceManager.WriteResource(Output, Resource, Url, Condition, TagAttributes);
}
[Shape]
public void Resource(TextWriter Output, ResourceDefinition Resource, string Url, string Condition, Dictionary<string, string> TagAttributes) {
UI.Resources.ResourceManager.WriteResource(Output, Resource, Url, Condition, TagAttributes);
ResourceManager.WriteResource(Output, Resource, Url, Condition, TagAttributes);
}
private static void WriteLiteralScripts(TextWriter output, IEnumerable<string> scripts) {
@@ -296,6 +370,206 @@ namespace Orchard.Core.Shapes {
}
}
[Shape]
public IHtmlString Pager_Links(dynamic Shape, dynamic Display,
int Page,
int PageSize,
double TotalItemCount,
int? Quantity,
object FirstText,
object PreviousText,
object NextText,
object LastText,
object GapText,
string PagerId
// parameter omitted to workaround an issue where a NullRef is thrown
// when an anonymous object is bound to an object shape parameter
/*object RouteValues*/) {
var currentPage = Page;
if (currentPage < 1)
currentPage = 1;
var pageSize = PageSize;
if (pageSize < 1)
pageSize = _workContext.Value.CurrentSite.PageSize;
var numberOfPagesToShow = Quantity ?? 0;
if (Quantity == null || Quantity < 0)
numberOfPagesToShow = 7;
var totalPageCount = Math.Ceiling(TotalItemCount / pageSize);
var firstText = FirstText ?? T("<<");
var previousText = PreviousText ?? T("<");
var nextText = NextText ?? T(">");
var lastText = LastText ?? T(">>");
var gapText = GapText ?? T("...");
// workaround: get it from the shape instead of parameter
var RouteValues = (object)Shape.RouteValues;
var RouteData = RouteValues is RouteValueDictionary ? (RouteValueDictionary) RouteValues : new RouteValueDictionary(RouteValues);
var queryString = _workContext.Value.HttpContext.Request.QueryString;
if (queryString != null) {
foreach (var key in from string key in queryString.Keys where key != null && !RouteData.ContainsKey(key) let value = queryString[key] select key) {
RouteData[key] = queryString[key];
}
}
if (Shape.RouteData != null) {
var shapeRouteData = Shape.RouteData is RouteValueDictionary ? (RouteValueDictionary) RouteValues : new RouteValueDictionary(RouteValues);
foreach (var rd in shapeRouteData) {
shapeRouteData[rd.Key] = rd.Value;
}
}
if (RouteData.ContainsKey("id"))
RouteData.Remove("id");
// HACK: MVC 3 is adding a specific value in System.Web.Mvc.Html.ChildActionExtensions.ActionHelper
// when a content item is set as home page, it is rendered by using Html.RenderAction, and the routeData is altered
// This code removes this extra route value
var removedKeys = RouteData.Keys.Where(key => RouteData[key] is DictionaryValueProvider<object>).ToList();
foreach (var key in removedKeys) {
RouteData.Remove(key);
}
var firstPage = Math.Max(1, Page - (numberOfPagesToShow / 2));
var lastPage = Math.Min(totalPageCount, Page + (numberOfPagesToShow / 2));
var pageKey = String.IsNullOrEmpty(PagerId) ? "page" : PagerId;
Shape.Classes.Add("pager");
Shape.Metadata.Alternates.Clear();
Shape.Metadata.Type = "List";
// first and previous pages
if (Page > 1) {
if (RouteData.ContainsKey(pageKey)) {
RouteData.Remove(pageKey); // to keep from having "page=1" in the query string
}
// first
Shape.Add(Display.Pager_First(Value: firstText, RouteValues: RouteData, Pager: Shape));
// previous
if (currentPage > 2) { // also to keep from having "page=1" in the query string
RouteData[pageKey] = currentPage - 1;
}
Shape.Add(Display.Pager_Previous(Value: previousText, RouteValues: RouteData, Pager: Shape));
}
// gap at the beginning of the pager
if (firstPage > 1 && numberOfPagesToShow > 0) {
Shape.Add(Display.Pager_Gap(Value: gapText, Pager: Shape));
}
// page numbers
if (numberOfPagesToShow > 0) {
for (var p = firstPage; p <= lastPage; p++) {
if (p == currentPage) {
Shape.Add(Display.Pager_CurrentPage(Value: p, RouteValues: RouteData, Pager: Shape));
}
else {
if (p == 1)
RouteData.Remove(pageKey);
else
RouteData[pageKey] = p;
Shape.Add(Display.Pager_Link(Value: p, RouteValues: RouteData, Pager: Shape));
}
}
}
// gap at the end of the pager
if (lastPage < totalPageCount && numberOfPagesToShow > 0) {
Shape.Add(Display.Pager_Gap(Value: gapText, Pager: Shape));
}
// next and last pages
if (Page < totalPageCount) {
// next
RouteData[pageKey] = Page + 1;
Shape.Add(Display.Pager_Next(Value: nextText, RouteValues: RouteData, Pager: Shape));
// last
RouteData[pageKey] = totalPageCount;
Shape.Add(Display.Pager_Last(Value: lastText, RouteValues: RouteData, Pager: Shape));
}
return Display(Shape);
}
[Shape]
public IHtmlString Pager(dynamic Shape, dynamic Display) {
Shape.Metadata.Alternates.Clear();
Shape.Metadata.Type = "Pager_Links";
return Display(Shape);
}
[Shape]
public IHtmlString Pager_First(dynamic Shape, dynamic Display) {
Shape.Metadata.Alternates.Clear();
Shape.Metadata.Type = "Pager_Link";
return Display(Shape);
}
[Shape]
public IHtmlString Pager_Previous(dynamic Shape, dynamic Display) {
Shape.Metadata.Alternates.Clear();
Shape.Metadata.Type = "Pager_Link";
return Display(Shape);
}
[Shape]
public IHtmlString Pager_CurrentPage(HtmlHelper Html, dynamic Display, object Value) {
var tagBuilder = new TagBuilder("span");
tagBuilder.InnerHtml = Html.Encode(Value is string ? (string)Value : Display(Value));
return MvcHtmlString.Create(tagBuilder.ToString());
}
[Shape]
public IHtmlString Pager_Next(dynamic Shape, dynamic Display) {
Shape.Metadata.Alternates.Clear();
Shape.Metadata.Type = "Pager_Link";
return Display(Shape);
}
[Shape]
public IHtmlString Pager_Last(dynamic Shape, dynamic Display) {
Shape.Metadata.Alternates.Clear();
Shape.Metadata.Type = "Pager_Link";
return Display(Shape);
}
[Shape]
public IHtmlString Pager_Link(dynamic Shape, dynamic Display) {
Shape.Metadata.Alternates.Clear();
Shape.Metadata.Type = "ActionLink";
return Display(Shape);
}
[Shape]
public IHtmlString ActionLink(HtmlHelper Html, dynamic Shape, dynamic Display, object Value) {
var RouteValues = (object)Shape.RouteValues;
RouteValueDictionary rvd;
if (RouteValues == null) {
rvd = new RouteValueDictionary();
}
else {
rvd = RouteValues is RouteValueDictionary ? (RouteValueDictionary)RouteValues : new RouteValueDictionary(RouteValues);
}
string value = Html.Encode(Value is string ? (string)Value : Display(Value));
return @Html.ActionLink(value, (string)rvd["action"], (string)rvd["controller"], rvd, null);
}
[Shape]
public IHtmlString Pager_Gap(HtmlHelper Html, dynamic Display, object Value) {
var tagBuilder = new TagBuilder("span");
tagBuilder.InnerHtml = Html.Encode(Value is string ? (string)Value : Display(Value));
return MvcHtmlString.Create(tagBuilder.ToString());
}
[Shape]
public void List(
dynamic Display,
@@ -311,7 +585,8 @@ namespace Orchard.Core.Shapes {
if (Items == null)
return;
var count = Items.Count();
var itemDisplayOutputs = Items.Select(item => Display(item)).Where(output => !string.IsNullOrWhiteSpace(output.ToHtmlString())).ToList();
var count = itemDisplayOutputs.Count();
if (count < 1)
return;
@@ -322,14 +597,14 @@ namespace Orchard.Core.Shapes {
Output.Write(listTag.ToString(TagRenderMode.StartTag));
var index = 0;
foreach (var item in Items) {
foreach (var itemDisplayOutput in itemDisplayOutputs) {
var itemTag = GetTagBuilder(itemTagName, null, ItemClasses, ItemAttributes);
if (index == 0)
itemTag.AddCssClass("first");
if (index == count - 1)
itemTag.AddCssClass("last");
Output.Write(itemTag.ToString(TagRenderMode.StartTag));
Output.Write(Display(item));
Output.Write(itemDisplayOutput);
Output.Write(itemTag.ToString(TagRenderMode.EndTag));
++index;
}
@@ -386,5 +661,13 @@ namespace Orchard.Core.Shapes {
public ViewDataDictionary ViewData { get; set; }
}
/// <summary>
/// Encodes dashed and dots so that they don't conflict in filenames
/// </summary>
/// <param name="alternateElement"></param>
/// <returns></returns>
private string EncodeAlternateElement(string alternateElement) {
return alternateElement.Replace("-", "__").Replace(".", "_");
}
}
}

View File

@@ -1,54 +0,0 @@
@{
var nextText = HasText(Model.NextText) ? Model.NextText : T("Older").Text;
var previousText = HasText(Model.PreviousText) ? Model.PreviousText : T("Newer").Text;
var routeData = new RouteValueDictionary(ViewContext.RouteData.Values);
var queryString = ViewContext.HttpContext.Request.QueryString;
if (queryString != null) {
foreach (string key in queryString.Keys) {
if (key != null && !routeData.ContainsKey(key)) {
var value = queryString[key];
routeData[key] = queryString[key];
}
}
}
if (routeData.ContainsKey("id") && !HasText(routeData["id"])) {
routeData.Remove("id");
}
// HACK: MVC 3 is adding a specific value in System.Web.Mvc.Html.ChildActionExtensions.ActionHelper
// when a content item is set as home page, it is rendered by using Html.RenderAction, and the routeData is altered
// This code removes this extra route value
var removedKeys = routeData.Keys.Where(key => routeData[key] is DictionaryValueProvider<object>).ToList();
foreach(string key in removedKeys) {
routeData.Remove(key);
}
var hasNextPage = (Model.Page * Model.PageSize) < Model.TotalItemCount;
Model.Classes.Add("pager");
Model.Classes.Add("group");
var tag = Tag(Model, "ul");
}
@if (hasNextPage || Model.Page > 1) {
@tag.StartElement
if(hasNextPage) {
routeData["page"] = Model.Page + 1;
<li class="page-next">
@Html.ActionLink((string)nextText, (string)routeData["action"], (string)routeData["controller"], routeData, null)
</li>
}
if(Model.Page > 1) {
routeData["page"] = Model.Page - 1;
// don't render the page parameter as default is 1
if (Model.Page - 1 == 1) {
routeData.Remove("page");
}
<li class="page-previous">
@Html.ActionLink((string)previousText, (string)routeData["action"], (string)routeData["controller"], routeData, null)
</li>
}
@tag.EndElement
}

View File

@@ -14,6 +14,11 @@ namespace Orchard.DesignerTools.Services {
public UrlAlternatesFactory(IHttpContextAccessor httpContextAccessor) {
_httpContextAccessor = httpContextAccessor;
var httpContext = _httpContextAccessor.Current();
if(httpContext == null) {
return;
}
var request = _httpContextAccessor.Current().Request;
@@ -32,6 +37,9 @@ namespace Orchard.DesignerTools.Services {
}
public override void Displaying(ShapeDisplayingContext context) {
if (_urlAlternates == null || !_urlAlternates.Any()) {
return;
}
context.ShapeMetadata.OnDisplaying(displayedContext => {
// appends Url alternates to current ones

View File

@@ -965,14 +965,14 @@ table.items td .add
/* Pager
***************************************************************/
.pager-footer { width: 500px; }
.pager-footer { }
.page-size-options {
float: left;
padding-right: 40px;
margin-left: auto;
}
html.dyn #submit-pager, html.dyn .apply-bulk-actions-auto { display:none; }
.pager { list-style: none; padding: 0; margin: 2px 0 0 0;}
.pager { list-style: none; padding: 0; margin: 2px 0 0 0; overflow: hidden; }
.pager li {
float: left;
padding: 0 0 0 0;

View File

@@ -1,7 +1,6 @@
@{
var window = 7; // number of simultaneously displayed pages
var nextText = HasText(Model.NextText) ? Model.NextText : T(">").Text;
var previousText = HasText(Model.PreviousText) ? Model.PreviousText : T("<").Text;
Model.PreviousText = T("<");
Model.NextText = T(">");
var routeData = new RouteValueDictionary(ViewContext.RouteData.Values);
var queryString = ViewContext.HttpContext.Request.QueryString;
@@ -19,11 +18,9 @@
}
var totalPageCount = (int)Math.Ceiling((double)Model.TotalItemCount / Model.PageSize);
var firstPage = Math.Max(1, (int)Model.Page - (window / 2));
var lastPage = Math.Min(totalPageCount, (int)Model.Page + (window / 2));
Model.Classes.Add("pager");
var pageTag = Tag(Model, "ul");
Model.Metadata.Type = "Pager_Links";
IHtmlString pagerLinks = Display(Model);
Model.Classes.Add("selector");
var pageSizeTag = Tag(Model, "ul");
@@ -34,7 +31,7 @@
}
}
var pageSizes = new List<int?>() { 10, 50, 100 };
var pageSizes = new List<int?> { 10, 50, 100 };
var defaultPageSize = WorkContext.CurrentSite.PageSize;
if (!pageSizes.Contains(defaultPageSize)) {
pageSizes.Add(defaultPageSize);
@@ -54,7 +51,7 @@
@if ((int)Model.PageSize == 0) {
<li class="selected"><span>@T("All").ToString()</span></li>
} else {
<li>@Html.ActionLink(T("All").ToString(), (string)routeData["action"], (string)routeData["controller"], routeData, null)</li>
<li>@Display.ActionLink(Value: T("All"), Action: (string)routeData["action"], Controller: (string)routeData["controller"], RouteValues: routeData)</li>
}
@foreach (int size in pageSizes.OrderBy(p => p)) {
@@ -63,7 +60,7 @@
if ((int)Model.PageSize == size) {
<li class="selected"><span>@size.ToString()</span></li>
} else {
<li>@Html.ActionLink(size.ToString(), (string)routeData["action"], (string)routeData["controller"], routeData, null)</li>
<li>@Display.ActionLink(Value: size, Action: (string)routeData["action"], Controller: (string)routeData["controller"], RouteValues: routeData)</li>
}
}
@@ -73,74 +70,7 @@
<span class="page-results">@T("Showing items {0} - {1} of {2}", (Model.Page - 1) * (int)Model.PageSize + 1, Model.PageSize == 0 ? Model.TotalItemCount : Math.Min(Model.TotalItemCount, (Model.Page) * (int)Model.PageSize), Model.TotalItemCount)</span>
@if (totalPageCount > 1) {
routeData["pageSize"] = Model.PageSize;
@pageTag.StartElement
// first
if (firstPage > 1) {
if (routeData.ContainsKey("page")) {
routeData.Remove("page");
}
<li class="page-first">
@Html.ActionLink(T("<<").Text, (string)routeData["action"], (string)routeData["controller"], routeData, null)
</li>
}
// previous page
if (Model.Page > 1) {
if (Model.Page == 2 && routeData.ContainsKey("page")) {
routeData.Remove("page");
}
else {
routeData["page"] = Model.Page - 1;
}
<li class="page-previous">
@Html.ActionLink((string)previousText, (string)routeData["action"], (string)routeData["controller"], routeData, null)
</li>
}
// page numbers
for (var p = firstPage; p <= lastPage; p++) {
<li class="page-@p">
@if (p == Model.Page) {
<span>@p</span>
}
else {
if (p == 1) {
routeData.Remove("page");
}
else {
routeData["page"] = p;
}
@Html.ActionLink(p.ToString(), (string)routeData["action"], (string)routeData["controller"], routeData, null)
}
</li>
}
// next page
if (Model.Page < totalPageCount) {
routeData["page"] = Model.Page + 1;
<li class="page-next">
@Html.ActionLink((string)nextText, (string)routeData["action"], (string)routeData["controller"], routeData, null)
</li>
}
// last page
if (lastPage < totalPageCount) {
routeData["page"] = totalPageCount;
<li class="page-last">
@Html.ActionLink(T(">>").Text, (string)routeData["action"], (string)routeData["controller"], routeData, null)
</li>
}
@pageTag.EndElement
}
@pagerLinks
</div>
}
@using (Script.Foot()) {

View File

@@ -299,21 +299,21 @@ nav ul
.zone-header { padding: 30px 0 30px 12px; position: relative; }
.zone-navigation { padding: 0; }
.zone-featured {}
.zone-beforemain {}
.zone-asidefirst {}
.zone-before-main {}
.zone-aside-first {}
.zone-messages {}
.zone-beforecontent {}
.zone-before-content {}
.zone-content {}
.zone-aftercontent {}
.zone-asidesecond {}
.zone-aftermain {}
.zone-zone-tripelfirst {}
.zone-zone-tripelsecond {}
.zone-zone-tripelthird {}
.zone-footerquadfirst {}
.zone-footerquadsecond {}
.zone-footerquadthird {}
.zone-footerquadfourth {}
.zone-after-content {}
.zone-aside-second {}
.zone-after-main {}
.zone-tripel-first {}
.zone-tripel-second {}
.zone-tripel-third {}
.zone-footer-quad-first {}
.zone-footer-quad-second {}
.zone-footer-quad-third {}
.zone-footer-quad-fourth {}
.zone-footer { color: #999999; }
@@ -450,9 +450,9 @@ nav ul
.pager { list-style: none; padding: 0; margin: 12px 0 0 0; }
.pager li { float: left; padding: 0 12px 0 0; margin: 0; }
.pager a { font-size: 1.077em; display: block; background-color: #dbdbdb; padding: 6px 6px; color: #434343;}
.pager a, .pager span { font-size: 1.077em; display: block; background-color: #dbdbdb; padding: 6px 6px; color: #434343;}
.pager a:hover { background-color: #434343; color: #fff; }
.pager span { background-color:inherit; }
/* Misc

View File

@@ -0,0 +1 @@


View File

@@ -0,0 +1 @@


View File

@@ -0,0 +1,9 @@
@{
Model.Quantity = 0;
Model.PreviousText = T("Newer");
Model.NextText = T("Older");
Model.Classes.Add("group");
Model.Metadata.Alternates.Clear();
Model.Metadata.Type = "Pager_Links";
}
@Display(Model)

View File

@@ -146,6 +146,15 @@
<Private>True</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="TheAdmin\Views\_Pager.CurrentPage.cshtml" />
<Content Include="TheAdmin\Views\_Pager.Gap.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="TheThemeMachine\Views\Pager.cshtml" />
<Content Include="TheThemeMachine\Views\Pager.First.cshtml" />
<Content Include="TheThemeMachine\Views\Pager.Last.cshtml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@@ -8,6 +8,10 @@ namespace Orchard.Environment.Extensions.Compilers {
OrchardHostContainerRegistry.RegisterShim(this);
_codeCompilerType = GetDefaultCompilerTypeForLanguage("C#");
// define a precompilation flag so that module can adapt for older version
var orchardVersion = typeof (IDependency).Assembly.GetName().Version;
_codeCompilerType.CompilerParameters.CompilerOptions += string.Format("/define:ORCHARD_{0}_{1}", orchardVersion.Major, orchardVersion.Minor) ;
}
public IOrchardHostContainer HostContainer { get; set; }