小编cpo*_*ign的帖子

从model中为datepickerfor(model => model.date)创建自定义Html帮助器

我正在为我的datepicker创建自定义html帮助器.
我想传递内部模式,因为它是TextBoxFor(model => model.name)

所以我需要的是,但我不知道该怎么做

  1. 该字段的名称
  2. 该领域的价值

我创造了

public static string DatePickerFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper,Expression<Func<TModel, TProperty>> expression){

//return object.name
var expressionText = ExpressionHelper.GetExpressionText(expression);


}
Run Code Online (Sandbox Code Playgroud)

html-helper asp.net-mvc-2

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

通过 uniqueidentifier 选择后使用 dapper 更新多条记录

我有许多从数据库加载的记录,我想在返回它们之前更新设置的值。唯一的主要要求是我不希望多个命令一一更新每条记录。

请注意我的 ID 是 GUID(唯一标识符)

到目前为止我的代码是

public IEnumerable<Person> GetUnprocessedPeople(int batchSize)
    {
        List<Queue_ImportQueue> list;
        using (IDbConnection db = OpenedConnection)
        {
            string peopleList = $"SELECT TOP({batchSize}) * FROM [dbo].[Person]";

            list = db.Query<Person>(peopleList).ToList();
            using (IDbTransaction transactionScope = db.BeginTransaction(IsolationLevel.Serializable))
            {
                string updateQuery = $"UPDATE [dbo].[Person] SET Created = GETDATE() WHERE Id ='@ids'";

                try
                {
                    db.Execute(updateQuery, new { Id = list.Select(x => x.Id) }, transactionScope);
                    transactionScope.Commit();
                }
                catch (Exception ex)
                {
                    transactionScope.Rollback();
                    throw;
                }
            }
        }
        return list;
    }
Run Code Online (Sandbox Code Playgroud)

c# dapper

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

将报告绑定到web mvc2中的reportviewer

我有asp.net MVC2应用程序.我正在使用VS2008,并希望将生成的报告从我的控制器连接到reportviewer.

有任何想法吗?

到目前为止我有这个代码"控制器"

//should pass data to report
 public ActionResult GenerateReport()
      {


        LocalReport report = new LocalReport();
        report.ReportPath = Server.MapPath("~/Reports/KingsCourt.rdlc");

        List<InvoiceRow> rows = new List<InvoiceRow>();

        rows.Add(new InvoiceRow { name = "Testing item", value = (decimal)25.85 });
        rows.Add(new InvoiceRow { name = "Testing item2", value = (decimal)5.15 });
        ReportDataSource source = new ReportDataSource("InvoiceRow", rows);
        report.DataSources.Add(source);

        ViewData["InvoiceRow"] = report;
        return View();
      }
Run Code Online (Sandbox Code Playgroud)

和查看页面:

 <form id="form1" runat="server">

  <h2>GenerateReport</h2>
  <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" 
      Font-Size="8pt" Height="400px" Width="400px">
    <LocalReport ReportPath="Reports\KingsCourt.rdlc">
      <DataSources>
        <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="InvoiceRow" /> …
Run Code Online (Sandbox Code Playgroud)

reportviewer visual-studio-2008 asp.net-mvc-2

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

使用Installutil安装服务

我有WCF服务要安装在Windows上.

现在我想在运行Windows的服务器上安装它并安装了v3.5 .net框架.

这个服务已经在框架4中编写了,因此它不会运行.

我的问题是我可以使用框架3.5中的"installutil"来安装服务吗?为什么?

===更新===

我有运行wcf的Windows服务.

.net c# wcf installutil

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

特定分支的门控办理登机手续

我有多个分支,每个人都有特定的构建过程.如何为特定分支设置门控构建过程?

开发分支 - >快速开发人员构建过程这有主要的整合测试

发布分支 - >生产前签到.包含负载测试和记录步骤包含自动UI测试

现在,对于我的开发,我希望每次开发人员提交更改时都运行测试.但我不希望每次都运行发布版本.

我该如何设置?

tfs tfs2010

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