小编Aza*_*ndi的帖子

是否有自动方式在MVC中查找未使用的视图?

有没有人知道找出项目中未使用的视图的方法?与Resharper或没有它.任何想法比写下所有的观点更容易,并通过所有控制器和手动检查是赞赏:)谢谢

model-view-controller resharper asp.net-mvc-3 asp.net-mvc-2

9
推荐指数
1
解决办法
1923
查看次数

ASP.NET MVC中htmlAttributes的匿名类和IDictionary <string,object>之间的区别?

例如,如果检查这两个扩展方法,唯一的区别是htmlAttributes的类型,因此您可以通过两种不同的方式传递htmlAttributes:

public static MvcHtmlString TextBoxFor<TModel, TProperty>(
    this HtmlHelper<TModel> htmlHelper,
    Expression<Func<TModel, TProperty>> expression,
    IDictionary<string, object> htmlAttributes);

public static MvcHtmlString TextBoxFor<TModel, TProperty>(
    this HtmlHelper<TModel> htmlHelper,
    Expression<Func<TModel, TProperty>> expression,
    object htmlAttributes);
Run Code Online (Sandbox Code Playgroud)

并以下列方式之一使用它们:

@Html.TextBoxFor(model => model.TagLine,
    new { @placeholder = "We live to make art." })

@Html.TextBoxFor(model => model.TagLine,
    new Dictionary<string, object> { 
        { "placeholder", "We live to make art." } })
Run Code Online (Sandbox Code Playgroud)

我检查过MVC源代码,我知道在后台他们使用相同的方法,但是接受匿名对象的方法HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)用于使匿名对象成为字典.

在我看来,使用匿名对象的视图更清晰.你们觉得怎么样?使用匿名对象有什么缺点吗?

c# asp.net-mvc idictionary asp.net-mvc-3

5
推荐指数
1
解决办法
3229
查看次数

缺少sitecore节点下的布局,系统和模板项

正如你在两张图片中看到的那样!我缺少布局,系统和模板.当我用sitecore rock打开它时,它说"已修改 - 必须序列化".我想知道是否有人之前有这个问题以及你如何解决它.

在此输入图像描述

在此输入图像描述

sitecore sitecore7 sitecore-rocks

3
推荐指数
1
解决办法
2256
查看次数

在矩形(多边形)中查找sql​​地理点

我有一个有趣/恼人的问题,在矩形边界内找到纬度和长标记.我相信我的两点在我的矩形边界内.但是你可以测试自己第一个选择的结果是假的而不是真的!

DECLARE @boundingRect varchar(1000)
DECLARE @maxLat VARCHAR(20)
DECLARE @minLong VARCHAR(20)
DECLARE @minLat VARCHAR(20)
DECLARE @maxLong VARCHAR(20)


set @maxLat ='-36.06631759541187'
set @minLong ='125.23310677812492'
set @minLat ='-44.43329881450396'
set @maxLong='167.04707162187492'


SET @boundingRect = 'POLYGON((' +   @minLong + ' '  + @minLat + ', ' +
                                        @maxLong + ' ' + @minLat + ', ' + 
                                        @maxLong + ' ' + @maxLat + ', ' + 
                                        @minLong + ' ' + @maxLat + ', ' + 
                                        @minLong + ' ' + @minLat + '))' …
Run Code Online (Sandbox Code Playgroud)

t-sql sql-server spatial sqlgeography

2
推荐指数
1
解决办法
1307
查看次数

如何迭代ViewBag或如何将ViewBag的值从一个Action复制到另一个Action

我有一个基本的控制器,如下所示

 public abstract class BaseController
    {

        protected ActionResult LogOn(LogOnViewModel viewModel)
        {
            SaveTestCookie();

            var returnUrl = "";
            if (HttpContext != null && HttpContext.Request != null && HttpContext.Request.UrlReferrer != null)
            {
                returnUrl = HttpContext.Request.UrlReferrer.LocalPath;
            }

            TempData["LogOnViewModel"] = viewModel;


            return RedirectToAction("ProceedLogOn", new { returnUrl });
        }

        public ActionResult ProceedLogOn(string returnUrl)
        {
            if (CookiesEnabled() == false)
            {
                return RedirectToAction("logon", "Account", new { area = "", returnUrl, actionType, cookiesEnabled = false });
            }
            var viewModel = TempData["LogOnViewModel"] as LogOnViewModel;

            if (viewModel == null)
            {
                throw …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc-3

0
推荐指数
1
解决办法
2614
查看次数