mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-24 13:33:34 +08:00
Documenting the (object) cast to avoid dynamic invocation.
--HG-- branch : dev
This commit is contained in:
@@ -67,6 +67,7 @@ namespace Orchard.Core.Containers.Controllers {
|
||||
.Pager(pagerShape)
|
||||
.ShowPager(container.As<ContainerPart>().Record.Paginated);
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)viewModel);
|
||||
}
|
||||
}
|
||||
|
@@ -97,6 +97,7 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
.Options(model.Options)
|
||||
.TypeDisplayName(model.TypeDisplayName ?? "");
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)viewModel);
|
||||
}
|
||||
|
||||
@@ -176,6 +177,7 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
ActionResult CreatableTypeList() {
|
||||
dynamic viewModel = Shape.ViewModel(ContentTypes: GetCreatableTypes());
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View("CreatableTypeList", (object)viewModel);
|
||||
}
|
||||
|
||||
@@ -189,6 +191,7 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
dynamic model = _contentManager.BuildEditor(contentItem);
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
}
|
||||
|
||||
@@ -218,6 +221,7 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
dynamic model = _contentManager.UpdateEditor(contentItem, this);
|
||||
if (!ModelState.IsValid) {
|
||||
_transactionManager.Cancel();
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
}
|
||||
|
||||
@@ -239,6 +243,7 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
dynamic model = _contentManager.BuildEditor(contentItem);
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
}
|
||||
|
||||
@@ -269,6 +274,7 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
dynamic model = _contentManager.UpdateEditor(contentItem, this);
|
||||
if (!ModelState.IsValid) {
|
||||
_transactionManager.Cancel();
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View("Edit", (object)model);
|
||||
}
|
||||
|
||||
|
@@ -19,6 +19,7 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
public ActionResult Display(int id) {
|
||||
var contentItem = _contentManager.Get(id, VersionOptions.Published);
|
||||
dynamic model = _contentManager.BuildDisplay(contentItem);
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
}
|
||||
|
||||
@@ -31,6 +32,7 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
|
||||
var contentItem = _contentManager.Get(id, versionOptions);
|
||||
dynamic model = _contentManager.BuildDisplay(contentItem);
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View("Display", (object)model);
|
||||
}
|
||||
}
|
||||
|
@@ -49,6 +49,7 @@ namespace Orchard.Core.Routable.Controllers {
|
||||
}
|
||||
|
||||
dynamic model = _contentManager.BuildDisplay(hits.Single());
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
}
|
||||
|
||||
|
@@ -35,7 +35,7 @@ namespace Orchard.Core.Settings.Controllers {
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
dynamic model = Services.ContentManager.BuildEditor(_siteService.GetSiteSettings());
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ namespace Orchard.Core.Settings.Controllers {
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
Services.TransactionManager.Cancel();
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
}
|
||||
|
||||
|
@@ -55,6 +55,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
return HttpNotFound();
|
||||
|
||||
dynamic model = Services.ContentManager.BuildEditor(blog);
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
}
|
||||
|
||||
@@ -70,6 +71,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
_transactionManager.Cancel();
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
}
|
||||
|
||||
@@ -88,6 +90,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
return HttpNotFound();
|
||||
|
||||
dynamic model = Services.ContentManager.BuildEditor(blog);
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
}
|
||||
|
||||
@@ -103,6 +106,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
dynamic model = Services.ContentManager.UpdateEditor(blog, this);
|
||||
if (!ModelState.IsValid) {
|
||||
Services.TransactionManager.Cancel();
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
}
|
||||
|
||||
@@ -140,7 +144,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
|
||||
dynamic viewModel = Services.New.ViewModel()
|
||||
.ContentItems(list);
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)viewModel);
|
||||
}
|
||||
|
||||
@@ -162,6 +166,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
var totalItemCount = _blogPostService.PostCount(blogPart, VersionOptions.Latest);
|
||||
blog.Content.Add(Shape.Pager(pager).TotalItemCount(totalItemCount), "Content:after");
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)blog);
|
||||
}
|
||||
|
||||
|
@@ -46,6 +46,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
dynamic viewModel = Shape.ViewModel()
|
||||
.ContentItems(list);
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)viewModel);
|
||||
}
|
||||
|
||||
@@ -70,6 +71,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
var totalItemCount = _blogPostService.PostCount(blogPart);
|
||||
blog.Content.Add(Shape.Pager(pager).TotalItemCount(totalItemCount), "Content:after");
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)blog);
|
||||
}
|
||||
}
|
||||
|
@@ -37,6 +37,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
return HttpNotFound();
|
||||
|
||||
dynamic model = Services.ContentManager.BuildEditor(blogPost);
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
}
|
||||
|
||||
@@ -92,6 +93,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
return HttpNotFound();
|
||||
|
||||
dynamic model = Services.ContentManager.BuildEditor(post);
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
}
|
||||
|
||||
|
@@ -51,7 +51,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
return HttpNotFound();
|
||||
|
||||
dynamic model = _services.ContentManager.BuildDisplay(postPart);
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
}
|
||||
|
||||
@@ -77,6 +77,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
//todo: (heskew) add back
|
||||
//.ArchiveData(archive) <-- ??
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)viewModel);
|
||||
}
|
||||
}
|
||||
|
@@ -60,6 +60,7 @@ namespace Orchard.Users.Controllers {
|
||||
dynamic model = Services.ContentManager.BuildEditor(user);
|
||||
model.Content.Add(editor);
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
}
|
||||
|
||||
@@ -97,6 +98,7 @@ namespace Orchard.Users.Controllers {
|
||||
editor.Metadata.Position = "2";
|
||||
model.Content.Add(editor);
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
}
|
||||
|
||||
@@ -114,6 +116,7 @@ namespace Orchard.Users.Controllers {
|
||||
dynamic model = Services.ContentManager.BuildEditor(user);
|
||||
model.Content.Add(editor);
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
}
|
||||
|
||||
@@ -144,6 +147,7 @@ namespace Orchard.Users.Controllers {
|
||||
editor.Metadata.Position = "2";
|
||||
model.Content.Add(editor);
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
}
|
||||
|
||||
|
@@ -112,6 +112,7 @@ namespace Orchard.Widgets.Controllers {
|
||||
|
||||
widgetPart.LayerPart = _widgetsService.GetLayer(layerId);
|
||||
dynamic model = Services.ContentManager.BuildEditor(widgetPart);
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
@@ -155,6 +156,7 @@ namespace Orchard.Widgets.Controllers {
|
||||
return HttpNotFound();
|
||||
|
||||
dynamic model = Services.ContentManager.BuildEditor(layerPart);
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
@@ -200,6 +202,7 @@ namespace Orchard.Widgets.Controllers {
|
||||
}
|
||||
|
||||
dynamic model = Services.ContentManager.BuildEditor(layerPart);
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
@@ -265,6 +268,7 @@ namespace Orchard.Widgets.Controllers {
|
||||
}
|
||||
|
||||
dynamic model = Services.ContentManager.BuildEditor(widgetPart);
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
|
@@ -66,6 +66,7 @@ namespace Orchard.Environment {
|
||||
}
|
||||
|
||||
IEnumerable<object> IDependencyResolver.GetServices(Type serviceType) {
|
||||
return Resolve<IEnumerable>(typeof(IEnumerable<>).MakeGenericType(serviceType), Enumerable.Empty<object>()).Cast<object>();
|
||||
return Resolve<IEnumerable>(typeof(IEnumerable<>).MakeGenericType(serviceType), Enumerable.Empty<object>()).Cast<object>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user