小编ami*_*taz的帖子

哪一条路?数据库优先,模型优先,仅限代码?

最近我通过Pro Entity Framework 4.0书籍了解了Entity Framework ...

现在,我想通过EF编写项目......有了这些条件,哪种方式更好,更灵活?

我的意见是模型优先!但我想知道你的意见?

谢谢!

entity-framework ef-code-first entity-framework-4.1

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

如何使用Razor在javascript块变量中使用C#变量?

我有一个视图文件(.cshtml)在文件顶部有这个C#块:

@{
List<string> selectedCategories = new List<string>();
Run Code Online (Sandbox Code Playgroud)

}

以及我想在以下javascript块中使用selectedCategories列表

@section scripts{
<script src="../../Scripts/jquery-1.6.4-vsdoc.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $("#list-all-categories").selectable({
            stop: function () {
                var result = $("#selectedCategories").empty();
                @selectedCategories.Clear()
                $(".ui-selected", this).each(function () {
                    var Mytext = $(this).text();

                    @selectedCategories.Add(Mytext.toString());

                });

            }
        });
    });
</script>
Run Code Online (Sandbox Code Playgroud)

}

所以,它不起作用!......一点都没有!

我有这样的错误: - 关闭了条件编译 - 当前上下文中不存在名称'Mytext'-...

我该怎么办?!请帮帮我!

jquery razor asp.net-mvc-3

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

如何从我创建的文件(.cs文件)创建一个exe文件?

这个C#代码用于运行我已合并在一起的Winform应用程序.我想从该C#代码创建一个exe文件.

如何才能做到这一点?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
    public static class Program
    {
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new Form1());
    }
}

public class Form1 : Form
{
    /// <summary>
    /// Required designer variable.
    /// </summary>
    private System.ComponentModel.IContainer components = null;

    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    /// <param name="disposing">true if managed resources should …
Run Code Online (Sandbox Code Playgroud)

c# winforms

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