我已经和vs 2010一起安装了vs 2011开发人员预览版.现在当我在vs 2010中运行我的asp.net mvc 3项目时,我在我的项目中遇到以下错误,我正在使用ModelClientValidationRule.
System.Web.Mvc.ModelClientValidationRule类型存在于c:\ Program Files\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\System.Web.Mvc.dll和c:\ Program Files\Microsoft ASP.NET\ASP.NET网页\ v2.0\Assemblies\System.Web.WebPages.dll
这与vs 2011与vs 2010或其他内容相关
asp.net asp.net-mvc visual-studio-2010 visual-studio asp.net-mvc-3
有没有人对asp.net mvc 3中的多项目区域支持有任何想法?因为它在mvc 2中降级为未来状态.如果它仍未包括在内,那么我们是否应该通过MvcContrib期待ASP.Net MVC Portable Areas.你可以分享你的经历吗?
管理大型应用程序的推荐方法是什么?我读到了MEF.在什么情况下建议使用MEF?
asp.net-mvc visual-studio-2010 mvccontrib asp.net-mvc-3 asp.net-mvc-2
我正在涉及表格序列化,但令人惊讶的是它没有序列化表格.这是代码:
<div id="content">
</div>
<form id= "myform">
<input type="text" id="inp"value="mytext">
<input type="button" id="btn" value="serialize"/>
</form>
Run Code Online (Sandbox Code Playgroud)
这是我正在使用的jQuery代码:
$("form").submit(function(e){
e.preventDefault();
var v= $(this).serialize();
console.log(v);
});
Run Code Online (Sandbox Code Playgroud)
这是小提琴
我想使用javascript将日期添加到给定日期.我有以下代码
function onChange(e) {
var datepicker = $("#DatePicker").val();
alert(datepicker);
var joindate = new Date(datepicker);
alert(joindate);
var numberOfDaysToAdd = 1;
joindate.setDate(joindate + numberOfDaysToAdd);
var dd = joindate.getDate();
var mm = joindate.getMonth() + 1;
var y = joindate.getFullYear();
var joinFormattedDate = dd + '/' + mm + '/' + y;
$('.new').val(joinFormattedDate);
}
Run Code Online (Sandbox Code Playgroud)
在第一个警报我得到日期,24/06/2011
但在第二个警报我得到Thu Dec 06 2012 00:00:00 GMT+0500 (Pakistan Standard Time)
哪个是错的我希望它保持,24/06/2011
以便我可以添加天数.在我的代码中,我想要我的最终输出25/06/2011
我在员工和团队之间有很多很多关系.遵循linq声明
int[] GroupIDs = {6,7};
var result = from g in umGroups
join empGroup in umEmployeeGroups on g.GroupID equals empGroup.GroupID
where GroupIDs.Contains(g.GroupID)
select new { GrpId = g.GroupID,EmployeeID = empGroup.EmployeeID };
Run Code Online (Sandbox Code Playgroud)
返回groupid和employeeid.结果是
GrpId | EmployeeID
6 | 18
6 | 20
7 | 19
7 | 20
Run Code Online (Sandbox Code Playgroud)
我需要删除employeeid重复的行,例如employeeid = 20中的任何一行
谢谢
我在生产服务器上随机获得此错误,这里是错误的堆栈跟踪.我正在使用linq到sql和.net 4.0
System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Data.Linq.DataContext.GetTable(MetaTable metaTable)
at System.Data.Linq.DataContext.GetTable[TEntity]()
at UserManagement.Models.EvoletDataContext.get_sysModules() in D:\MyProj\Models\datamdl.designer.cs:line 1294
at UserManagement.Models.FilterRepository.GetModuleHead(String actionName) in D:\MyProj\Models\FilterRepository.cs:line 14
at UserManagement.Models.DummyAttrib.OnAuthorization(AuthorizationContext filterContext) in D:\MyProj\Models\Filters.cs:line 44
at Glimpse.Net.Plumbing.GlimpseAuthorizationFilter.OnAuthorization(AuthorizationContext filterContext)
at System.Web.Mvc.ControllerActionInvoker.InvokeAuthorizationFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor)
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
at System.Web.Mvc.Controller.ExecuteCore()
at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
at System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext)
at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<>c__DisplayClassb.<BeginProcessRequest>b__5()
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0()
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
at System.Web.Mvc.MvcHandler.<>c__DisplayClasse.<EndProcessRequest>b__d()
at …
Run Code Online (Sandbox Code Playgroud) 我正在使用SQL Server 2008编写ASP.NET MVC应用程序.不幸的是,我可以连接到该数据库的唯一方法是在我的生产环境中通过dsn或ODBC.在开发中,我使用了Linq2SQL层来访问数据库中的数据.有没有办法可以强制Linq2SQL使用ODBC进行连接而不是SQL客户端连接?
我使用下面的查询从Entity Framework调用存储过程(返回数据)
from sp in db.GetSale(bID, SID,m,y).Where(x => x.isActive == true)
select sp
Run Code Online (Sandbox Code Playgroud)
如果我直接运行此过程,只需2秒,但是当我通过EF调用此存储过程时,需要10到15秒.
任何改善情况的指导?我在这里看过其他帖子,但没有成功
编辑
这是我的程序的sqlplan https://skydrive.live.com/redir?resid=87DCBD5D3E9AAA57!374
我有这个简单的LINQ查询
from e in Employees
where e.DesignationID !=558
select e
Run Code Online (Sandbox Code Playgroud)
这DesignationID
是一个可以为空的字段:
在objectcontext
查询中被翻译为:
SELECT
[Extent1].[EmployeeID] AS [EmployeeID],
[Extent1].[EmployeeCode] AS [EmployeeCode],
[Extent1].[EmployeeName] AS [EmployeeName],
[Extent1].[DesignationID] AS [DesignationID]
FROM [dbo].[setupEmployees] AS [Extent1]
WHERE 558 <> [Extent1].[DesignationID]
Run Code Online (Sandbox Code Playgroud)
虽然其中的相同查询dbcontext
被翻译为:
SELECT
[Extent1].[EmployeeID] AS [EmployeeID],
[Extent1].[EmployeeCode] AS [EmployeeCode],
[Extent1].[EmployeeName] AS [EmployeeName],
[Extent1].[DesignationID] AS [DesignationID]
FROM [dbo].[setupEmployees] AS [Extent1]
WHERE NOT ((558 = [Extent1].[DesignationID]) AND ([Extent1].[DesignationID] IS NOT NULL))
Run Code Online (Sandbox Code Playgroud)
为什么objectcontext
处理NULL不同于dbcontext
?
我在共享主机上部署了asp.net mvc 3站点.我的问题是我的网站经常在5到10分钟后自动注销用户.虽然我已经在web.config和application_start中将时间设置为200分钟,如下所示
<forms loginUrl="~/Account.mvc/index" slidingExpiration="true" timeout="200" protection="All" />
HttpCookie authCookie = FormsAuthentication.GetAuthCookie(userName, rememberMe);
FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value);
FormsAuthenticationTicket newTicket = new FormsAuthenticationTicket(1, userName, DateTime.Now, DateTime.Now.AddMinutes(200), rememberMe, CurrentUser.UserID +"|"+ CurrentUser.EmployeeID);
authCookie.Value = FormsAuthentication.Encrypt(newTicket);
Response.Cookies.Add(authCookie);
Run Code Online (Sandbox Code Playgroud) asp.net-mvc asp.net-membership membership-provider asp.net-mvc-3
asp.net-mvc ×4
linq-to-sql ×3
asp.net ×2
c# ×2
jquery ×2
linq ×2
.net ×1
date ×1
dbcontext ×1
javascript ×1
mvccontrib ×1
odbc ×1