我是一个独立的开发人员,Pluralsight是我帮助我理解Repository和IoC之类的东西,我正在学习.但是我发现这种模式很难使用.
所以我使用Unity IoC,然后ModelContainer上课;
public static class ModelContainer
{
private static IUnityContainer instance;
static ModelContainer()
{
instance = new UnityContainer();
}
public static IUnityContainer Instance
{
get
{
instance.RegisterType<ISCD_CallDiaryRepository, SCD_CallDiaryRepository>(new HierarchicalLifetimeManager());
instance.RegisterType<ICompanyRepository, CompanyRepository>(new HierarchicalLifetimeManager());
instance.RegisterType<ISubcontractorRepository, SubcontractorRepository>(new HierarchicalLifetimeManager());
instance.RegisterType<ITradeRepository, TradeRepository>(new HierarchicalLifetimeManager());
instance.RegisterType<IEmployeeRepository, EmployeeRepository>(new HierarchicalLifetimeManager());
instance.RegisterType<ISubcontractorTradeRepository, SubcontractorTradeRepository>(new HierarchicalLifetimeManager());
instance.RegisterType<ICountyRepository, CountyRepository>(new HierarchicalLifetimeManager());
instance.RegisterType<IAddressLineRepository, AddressLineRepository>(new HierarchicalLifetimeManager());
return instance;
}
}
}
Run Code Online (Sandbox Code Playgroud)
允许我在我的控制器的构造函数中实例化存储库类;
public SubcontractorController(
ISubcontractorRepository subcontractorRepository,
ISubcontractorTradeRepository subcontractorTradeRepository,
ICompanyRepository companyRepository,
ISCD_CallDiaryRepository scdCallDiaryRepository,
ITradeRepository tradeRepository,
IAddressLineRepository addressLineRepository)
{
this.SubcontractorRepository = subcontractorRepository;
this.SubcontractorTradeRepository = subcontractorTradeRepository; …Run Code Online (Sandbox Code Playgroud) 我正在尝试安装Unity.Mvc4但是我收到此错误消息;
无法加载文件或程序集"Microsoft.Practices.Unity,Version = 2.1.505.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35"或其依赖项之一.定位的程序集的清单定义与程序集引用不匹配.(HRESULT异常:0x80131040)
我的Microsoft.Practices.Unity版本是3.0.0.0.为什么我要一个旧版本?
我是一个单独的开发人员,我现在正在使用TFS 2010,直到最近才使用VSS.我没有发现为初学者准备任何书籍以帮助我使用它很容易.所以我现在在源代码管理中得到了我的项目.但是当我办理登机手续时,我会获得一些我不再使用的文件的引用.如何从TFS源代码管理存储库中删除文件?
因此,在下面的示例中,您可以看到我不想看到的来自不同项目的大量文件.

我有一个Html辅助方法,在我的控制器上调用Delete方法.
public static MvcHtmlString DeleteEmployeeOtherLeave(this HtmlHelper html, string linkText, Leave _leave)
{
return html.RouteLink(linkText, "Default",
new { _employeeOtherLeaveId = _leave.LeaveId, action = "Delete" },
new { onclick = "$.post(this.href); return false;" });
}
Run Code Online (Sandbox Code Playgroud)
在我的控制器上我有;
[AcceptVerbs(HttpVerbs.Delete)]
public ActionResult Delete(int _employeeOtherLeaveId)
{
EmployeeOtherLeaf.Delete(_employeeOtherLeaveId);
return RedirectToAction("Payroll");
}
Run Code Online (Sandbox Code Playgroud)
但我收到此运行时错误消息;
System.Web.HttpException: A public action method 'Delete' was not found on controller
Run Code Online (Sandbox Code Playgroud) 我已经部署了我的MVC应用程序但是当我从IIS浏览时,我发现表单身份验证似乎阻止了CSS.这不会发生在我的开发服务器上.为什么会这样?我的主页看起来像这样;
<head id="Head1" runat="server">
<title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
<script src="http://code.jquery.com/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.js" type="text/javascript" language="javascript"></script>
<script src="http://nje.github.com/jquery-tmpl/jquery.tmpl.js" type="text/javascript"></script>
<script src="<%=Url.Content("~/Scripts/jquery.form.js")%>" type="text/javascript"></script>
<!-- note that the order scripts are included in is important -->
<script src="<%=Url.Content("~/Scripts/jquery.Validate.js")%>" type="text/javascript"></script>
<script src="<%=Url.Content("~/Scripts/MicrosoftMvcJQueryValidation.js")%>" type="text/javascript"></script>
<script src="<%=Url.Content("~/Scripts/ConfusedValidation.js")%>" type="text/javascript"></script>
<script src="<%=Url.Content("~/Scripts/Awesome.js")%>" type="text/javascript"></script>
<script src="<%=Url.Content("~/Scripts/MicrosoftAjax.debug.js") %>" type="text/javascript"></script>
<script src="<%=Url.Content("~/Scripts/MicrosoftMvcAjax.debug.js") %>" type="text/javascript"></script>
<script src="<%=Url.Content("~/Scripts/jquery.jcacher-1.0.0.min.js")%>" type="text/javascript"></script>
<link href="<%=Url.Content("~/Content/jquery.ui.autocomplete.css")%>" rel="stylesheet" type="text/css" />
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/themes/overcast/jquery-ui.css"
type="text/css" rel="Stylesheet" class="ui-theme" />
<link href="<%=Url.Content("~/Scripts/Awesome.css")%>" rel="stylesheet" type="text/css" />
Run Code Online (Sandbox Code Playgroud)
*编辑* 在Firebug中我得到了消息; …
我一直想将我的SSRS报告部署到测试服务器.但是我发现在该服务器上SSRS服务已经停止,我不得不更改设置,以便它使用内置的网络服务帐户.在这之后,我发现我可以开始服务.但是,当我在浏览器中键入ReportService URL时,出现上述错误消息.
我将设置更改为网络服务帐户时遇到的一个问题是我收到了错误消息:
"无法通过提供的信息建立连接.点击"确定"以更改连接设置.建立与SQL Server的连接时发生与网络相关或特定于实例的错误.未找到服务器或无法访问服务器.验证实例名称正确,并且SQL Server配置为允许远程连接.(提供程序:名为Pipes Privider,错误:40 - 无法打开与SQL Server的连接)"
即便如此,这并没有阻止服务的启动.由于这一切,我仍然无法部署我的报告.我该如何解决?
我无法在以下代码中获取data属性(data-scd-editUrl)的值;
@foreach (var item in Model)
{
<tr data-pkey="@item.TradeId">
<td style="text-align:left;vertical-align:top;height:20px;">
<div style="width:100%;height:100%;overflow:hidden;">
@Html.DisplayFor(modelItem => item.TradeName)
</div>
</td>
<td class="rowControl hidden" style="text-align:left;vertical-align:top;height:20px;">
<div style="width:100%;height:100%;overflow:hidden;">
<img src="@Url.Content("~/Images/Pencil.ico")" style="height:15px;width:15px" title="edit" alt="edit" class="makeRowEditable"
data-scd-editUrl="@Url.Action("Edit", new { id = item.TradeId})"/> |
<img src="@Url.Content("~/Images/icon-delete.gif")" style="height:15px;width:15px" title="delete" alt="delete" class="deleteRow"
data-scd-editUrl="@Url.Action("Delete", new { id = item.TradeId})"/>
</div>
</td>
</tr>
}
Run Code Online (Sandbox Code Playgroud)
Jquery是;
gridContext.delegate('.makeRowEditable', 'click', function (e) {
var editUrl = $('this').data("scd-editUrl");
var row = $(this).parents('tr');
makeRowEditable(row, editUrl);
e.preventDefault();
});
Run Code Online (Sandbox Code Playgroud)
使用委托是因为此代码是网格的一行,并通过Ajax动态重新加载新页面.我在上面的代码中放了一个断点,editUrl为null.那为什么会这样?
在我的MVC应用程序中,我使用了自动完成功能来填写一些输入框。在我的一种观点中,这很好。但是在模式弹出窗口中,它不起作用。进行了aajax调用,以从数据库中获取列表,但该列表未出现在搜索框下方。
从这里调用弹出窗口;
<a class="btn btn-info btn-xxs get-tender"
href="#edit-tender-form"
data-toggle="modal"
data-tac-tender-url="/Tender/Get"
data-tac-tender-status="2,Unsuccessful"
data-tac-tender-id="5">Edit</a>
Run Code Online (Sandbox Code Playgroud)
在“编辑投标”表单中,搜索输入框
<span class="ui-helper-hidden-accessible" role="status" aria-live="polite">10 results are available, use up and down arrow keys to navigate.</span>
<input style="width: 300px;" id="searchTerm" class="input-validation-error" name="searchTerm" type="search" data-tac-autocomplete="/Company/AutocompleteCompany" autocomplete="off">
Run Code Online (Sandbox Code Playgroud)
以下javascript为包含data-tac-autocomplete属性的所有输入搜索框连接了自动完成功能;
var createAutocomplete = function () {
var $input = $(this);
var options = {
source: $input.attr("data-tac-autocomplete"),
select: updateAutocompleteForm,
close: errorAutocompleteForm
};
$(".errorNotSelected").hide();
$input.autocomplete(options);
};
$("input[data-tac-autocomplete]").each(createAutocomplete);
Run Code Online (Sandbox Code Playgroud)
服务器代码上的断点表明它可以按预期工作;
[Authorize]
public ActionResult AutocompleteCompany(string term)
{
var companyTypeId = this.GetCompanyTypeId();
var model =
this.TacUoW.GetCompanyAutocomplete(term, companyTypeId).Take(10).Select(
x …Run Code Online (Sandbox Code Playgroud) 在我的MVC项目中,我有这个编辑模板.我无法在IE Developer Tools中调试它,因为它在弹出窗口中.我无法访问其他浏览器.所以我的jquery没有获取url,employeeId和businessUnitId的值.
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<SHP.Models.BusinessUnitSelected>" %>
<tr>
<td><%: Model.BusinessUnit.BusinessUnitName %></td>
<td>
<%: Html.CheckBoxFor(
x => x.Selected,
new RouteValueDictionary
{
{ "data-url", Url.Action("AddBusinessUnitForEmployee", "DataService") },
{ "data-employeeId", Model.EmployeeId },
{ "data-businessUnitId", Model.BusinessUnit.BusinessUnitId }
}
) %>
</td>
</tr>
<script type="text/javascript">
$(document).ready(function () {
$('tr input[type="checkbox"]').click(function () {
var elementId = $(this).attr('id');
alert("elementId = " + elementId);
var url = $(this).val('data-url');
alert("url = " + url);
var employeeId = $(this).val('data-employeeId');
alert("employeeId = " + employeeId);
var businessUnitId = $(this).val('data-businessUnitId');
alert("businessunitId …Run Code Online (Sandbox Code Playgroud) 这个查询有什么问题?
var model =
SessionObjectsMSurvey.ContractList
.Where(y => y.ContractTitle.ToUpper().Contains(upper))
.GroupBy(g => new
{
g.BriefTitle,
g.ContractId
})
.Select(
x => new
{
label = x.BriefTitle,
id = x.ContractId.ToString()
}).Take(20);
Run Code Online (Sandbox Code Playgroud)
SessionObjectsMSurvey.ContractList 是一个 IEnumerable 集合。
我明白了,这不会编译;
错误 13“System.Linq.IGrouping”不包含“BriefTitle”的定义,并且找不到接受“System.Linq.IGrouping”类型的第一个参数的扩展方法“BriefTitle”(您是否缺少 using 指令或装配参考?)
asp.net-mvc ×7
jquery ×3
autocomplete ×1
azure-devops ×1
c# ×1
css ×1
git ×1
javascript ×1
jquery-ui ×1
linq ×1
nuget ×1
repository ×1
tfs2010 ×1