是否有任何工具可以将SQL Server 2014数据库转换为2012?
我尝试了生成脚本但生成的脚本数据太大而SQL Server Management Studio没有执行它,我需要同时拥有模式和数据.
如何更新与上下文分离的实体AsNoTracking()?
var _agency = agencyRepository.Get(filter: a => a.Id == agency.Id)
.AsQueryable()
.AsNoTracking()
.FirstOrDefault();
agencyRepository.Update(_agency);
Run Code Online (Sandbox Code Playgroud)
并且我的 Update 方法已经设置修改:
public virtual void Update(T entity)
{
dbset.Attach(entity);
dataContext.Entry(entity).State = System.Data.Entity.EntityState.Modified;
}
Run Code Online (Sandbox Code Playgroud)
我可以找到数据上下文附加的前一个实体吗?或者有什么建议可以防止跟踪我的用户实体?
在Asp.net MVC中,我在所有页面上都有一个登录表单(在_Layout页面中),我将我的登录表单作为_Login放在PartialView中的共享文件夹中,如下所示:
@model MyProject.ViewModels.LogInModel
<div id="popover-head" class="hide">Login</div>
<div id="popover-content" class="hide">
@using (Ajax.BeginForm("LogIn", "Account", new AjaxOptions { UpdateTargetId = "login" }))
{
@Html.TextBoxFor(m => m.UserName, new { @class = "input-block-level", placeholder = "username" })
@Html.ValidationMessageFor(m => m.UserName)
@Html.PasswordFor(m => m.Password, new { @class = "input-block-level", placeholder = "password" })
@Html.ValidationMessageFor(m => m.Password)
<input type="submit" name="login" value="login" class="btn btn-primary" />
@Html.CheckBoxFor(m => m.RememberMe)
@Html.LabelFor(m => m.RememberMe)
}
</div>
Run Code Online (Sandbox Code Playgroud)
在我的_Layout页面中:
<a id="popover" href="#" class="btn" data-toggle="popover" data-placement="bottom">Login</a>
<div id="login">
@Html.Partial("_LogIn")
</div>
Run Code Online (Sandbox Code Playgroud)
和AccountController包含: …