小编Jor*_*Axe的帖子

对象'DF __*'依赖于列'*' - 将int更改为double

基本上我在我的EF数据库中有一个表,它具有以下属性:

public int Id { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public string Image { get; set; }
public string WatchUrl { get; set; }
public int Year { get; set; }
public string Source { get; set; }
public int Duration { get; set; }
public int Rating { get; set; }
public virtual ICollection<Category> Categories { get; set; }
Run Code Online (Sandbox Code Playgroud)

它工作正常但是当我将Rating的int更改为double时,我在更新数据库时遇到以下错误:

对象'DF_ Movies _Rating__48CFD27E'取决于列'评级'.ALTER TABLE ALTER COLUMN评级失败,因为一个或多个对象访问此列.

有什么问题?

sql database sql-server entity-framework entity-framework-4

155
推荐指数
6
解决办法
13万
查看次数

在单个包中包含文件夹中的所有文件

使用时BundleConfig是否可以包含文件夹的所有文件,包括子文件夹的所有文件(及其子文件夹等)?

我发现.IncludeDirectory()但它似乎只包含文件夹本身的文件,而不是子文件夹的文件.

asp.net-mvc visual-studio asp.net-mvc-4

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

Bootstrap图标在本地加载,但在线时不加载

基本上我得到以下HTML:

<button class="disabled btn-primary btn" type="submit" disabled="">
   <i class="glyphicon glyphicon-ban-circle"></i>
   Log in
</button>
Run Code Online (Sandbox Code Playgroud)

在本地,图标在按钮上显示正常,但是当我在Windows Azure上运行时,我得到以下按钮,带有奇怪的外观前缀而不是图标:

在此输入图像描述 考虑到这一点,我意识到当在本地访问我的网站时,浏览器会尝试加载文件:/Content/fonts/glyphicons-halflings-regular.woff(它成功地执行),而当在线(在azure上)它将尝试在以下位置加载:/fonts/glyphicons-halflings-regular.woff

为什么它没有放置它在本地执行的/ Content前缀.

我正在使用标准的bootstrap文件,它是本地和在线运行的完全相同的网站.

我也是通过以下方式捆绑内容:

    bundles.Add(new StyleBundle("~/Content/bootstrapcss").Include(
                "~/Content/bootstrap/bootstrap.css"));
Run Code Online (Sandbox Code Playgroud)

文件结构如下所示:

在此输入图像描述

bootstrap也在寻找这样的文件:

url('../fonts/glyphicons-halflings-regular.woff') 
Run Code Online (Sandbox Code Playgroud)

所以我认为它会在Content文件夹中查找而不是root文件,因为它当前位于Content/bootstrapcss文件夹中.

css image azure twitter-bootstrap twitter-bootstrap-3

7
推荐指数
1
解决办法
1万
查看次数

无法从区域返回部分视图

基本上我刚刚在我的ASP.NET MVC4应用程序中创建了一个Area.这一切都很好,但是当我想返回一个PartialView时,如下所示:

return PartialView("_ImportSessionsTable", viewModel);
Run Code Online (Sandbox Code Playgroud)

(不是从区域(管理员)视图调用上述调用)我收到以下错误:

未找到部分视图"_ImportSessionsTable"或视图引擎不支持搜索的位置.搜索了以下位置:〜/ Views/ImportSessions/_ImportSessionsTable.aspx

〜/查看/ ImportSessions/_ImportSessionsTable.ascx

〜/查看/共享/ _ImportSessionsTable.aspx

〜/查看/共享/ _ImportSessionsTable.ascx

〜/查看/ ImportSessions/_ImportSessionsTable.cshtml

〜/查看/ ImportSessions/_ImportSessionsTable.vbhtml

〜/查看/共享/ _ImportSessionsTable.cshtml

〜/查看/共享/ _ImportSessionsTable.vbhtml

问题是:据我所知,它不是在区域文件夹(admin)中查找我存储视图的视图.我怎么能让它看到那里?每当我调用return View();它工作正常,所以只有当我将视图指定为字符串时.

asp.net-mvc asp.net-mvc-4 visual-studio-2012

4
推荐指数
1
解决办法
5655
查看次数

Generic Get方法不包括FK?

我正在尝试创建一个通用的GetAll方法,该方法适用于我的ASP.NET MVC4项目中的每个模型类.

这是我的代码:

public static List<T> GetAll(params string[] includeProperties)
{
    using (MovieSiteDb db = new MovieSiteDb())
    {
        var entities = db.Set<T>();
        foreach (var includeProperty in includeProperties)
        {
            entities.Include(includeProperty);
        }
        return entities.ToList();
    }
}
Run Code Online (Sandbox Code Playgroud)

现在我用以下方式调用它(Movie继承了GetAll方法):

Movie.GetAll("Category");
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试访问视图模型中的外键"类别"时,出现错误.为什么不包括在内?

c# linq generics entity-framework repository

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

在query.unobtrusive-ajax.js传递给getElementById()的空字符串:16

我正在开发一个ASP.NET MVC4应用程序,并已开始使用jQuery actionlinks.但是,当我运行以下Razor代码(并单击视图票据actionlink)时,我得到一个通用的jQuery错误(两次),说空字符串被传递给getElementById().我不知道这个错误发生在哪里,因为firefox只链接到jQuery代码.这是我的Razor代码:(我知道js函数show和hideticket是空的,但这是为了简化代码):

<script>
function ShowTicket(id) {
    $("#viewTicketButton" + id).hide();
    $("#hideTicketButton" + id).show();
    $("#viewTicket").show();
}

function HideTicket(id) {
    $("#viewTicketButton" + id).show();
    $("#hideTicketButton" + id).hide();
    $("#viewTicket").hide();
}
</script>

<h3>Your tickets</h3>
<table border="1">
    <tr>
        <td>Title:</td>
        <td>Urgency:</td>
        <td>Status:</td>
    </tr>
    @foreach (SupportTicketViewData t in Model.supportTicketViewDataList)
    {
        <tr>
            <td>@t.title</td>
            <td>@t.text</td>
            <td>@t.status</td>
            <td>@Ajax.ActionLink("View Ticket", "ViewTicket", new { id = t.id },
            new AjaxOptions
            {
                HttpMethod = "GET",
                InsertionMode = InsertionMode.Replace,
                UpdateTargetId = "viewTicket",
                OnComplete = "ShowTicket(" + t.id +");"
            }, new { id = "viewTicket" + …
Run Code Online (Sandbox Code Playgroud)

javascript ajax asp.net-mvc jquery razor

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

使用pthread.h发布编译程序

我试图在Linux(Ubuntu)机器上编译以下程序:

#include <pthread.h>
#include <stdio.h>
int sum; /* this data is shared by the thread(s) */
void *runner(void *param); /* threads call this function */
int main(int argc, char *argv[])
{
pthread t tid; /* the thread identifier */
pthread attr t attr; /* set of thread attributes */
if (argc != 2) {
fprintf(stderr,"usage: a.out <integer value>\n");
return -1;
}
if (atoi(argv[1]) < 0) {
fprintf(stderr,"%d must be >= 0\n",atoi(argv[1]));
return -1;
}
/* get the default attributes */ …
Run Code Online (Sandbox Code Playgroud)

c linux ubuntu header-files

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