我们使用window.location.href将用户导航到页面.此外,我们已配置window.onbeforeunload事件,以便在存在任何未保存的更改时提醒用户.
window.onbeforeunload = confirmBeforeClose;
function confirmBeforeClose() {
if (jwd.global.inEditMode)
return "Your changes will not be saved :) and you will be punished to death";
}
Run Code Online (Sandbox Code Playgroud)
在有未保存更改的地方,我尝试使用window.location.href导航用户,我收到警报消息.
如果我在弹出窗口中单击"确定",它可以正常工作.但是,如果我单击CANCEL,JS会在window.location.href处抛出一个未指定的错误.
任何帮助表示赞赏.
我们的应用程序(使用NHibernate和ASP.NET MVC)在进行压力测试时会抛出大量的NHibernate事务错误.主要类型是:
有人可以帮助我找出异常1的原因吗?我知道我必须处理代码中的其他异常.有人能指出我可以帮助我以有效的方式处理这些错误的资源吗?
问:我们如何管理会话和交易?
答:我们正在使用Autofac.对于每个服务器请求,我们创建一个新的请求容器,其中包含容器生命周期范围内的会话.在激活会话时,我们开始交易.请求完成后,我们提交事务.在某些情况下,交易可能很大.为简化起见,每个服务器请求都包含在事务中.
JQuery Dialog最近给了我很多痛苦.我有以下div我想要弹出.(忽略类没有在语法中显示双引号)
TABLE class=widget-title-table border=0 cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD class=widget-title><SPAN class=widget-title>Basic Info</SPAN></TD>
<TD class=widget-action>
<DIV id=edit-actions jQuery1266325647362="3">
<UL class="linkbutton-menu read-mode">
<LI class="control-actions">
<A id="action-button" class="mouse-over-pointer linkbutton">Delete this stakeholder</A>
<DIV id="confirmation" class="confirmation-dialog title=Confirmation">
Are you sure you want to delete this stakeholder?
</DIV>
</LI></UL></DIV></TD></TR></TBODY></TABLE>
Run Code Online (Sandbox Code Playgroud)
这个JQuery是......
$(document).ready(function() {
$('#confirmation').dialog({
bgiframe: true, modal: true, autoOpen: false, closeOnEscape: false,
draggable: true, position: 'center', resizable: false, width: 400, height: 150
});
});
Run Code Online (Sandbox Code Playgroud)
对话框是"开放的"
var confirmationBox = $('#confirmation',actionContent);
if (confirmationBox.length > 0) {
//Confirmation Needed …Run Code Online (Sandbox Code Playgroud) 我正在使用SchemaUpdate根据某些配置对数据库进行更改.添加新表或列时,它可以正常工作.但是,删除列或删除表时,它不起作用.映射文件确实反映了这些更改,但SchemaUpdate似乎没有认识到这一点.我不想删除表并重新创建它们,因为我希望保留数据.
有谁知道SchemaUpdate是否支持这种"删除和删除"功能?
谢谢
我在我的应用程序中使用NHibernate并具有以下情况.(请注意,为了便于理解,这里的情况要简化得多)
从数据库中查询对象.它使用编辑和更新Session.Update().然后Session.Evict(obj)在提交事务之前从会话(使用)中逐出该对象.预期的结果是更改将持久保存到数据库中.
当我将我的Id列作为NHibernate identity列时,这常常工作正常.最近,我们将Id列更改为非身份.因此,除非我Session.Flush()在Evict之前明确调用,否则上述方案不会持久存储到数据库中.
有人能指出/向我解释这种行为的原因吗?
这个链接,NHibernate Session.Flush&Evict vs Clear,提到了一些关于Evict和身份栏的内容,这对我来说不是很清楚.