异常为: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: 意思是拥有相同的数据库标识符(代表数据库中的同一条记录),但是具有不同的持久化标识符. 解决办法 1 做一个动作将session关闭 调用Session的 close方法 ,Session的缓存被清空,其中的所有持久化对象都变为…
内容来自:https://codereview.stackexchange.com/questions/20871/single-instance-wpf-application 第一步:添加System.RunTime.Remoting引用 第二步:新建一个类class1.cs(按自己想法命名) using System; using System.Collections; using System.Collections.Generic; using System.ComponentMode…
使用WPF的Popup的时候会发现有一个问题,它总是会置顶,只要Popup的StayOpen不设置为False,它就一直呆在最顶端,挡住其他的窗口. 解决方案是继承Popup重新定义控件PopupEx. public class PopupEx : Popup { public static DependencyProperty TopmostProperty = Window.TopmostProperty.AddOwner(typeof(PopupEx ), new Fr…