public void ValidateRow(DevExpress.Mvvm.Xpf.RowValidationArgs args) { var item = (EntityFrameworkIssues.Issues.User)args.Item; if (args.IsNewItem) { _Context.Users.Add(item); } _Context.SaveChanges(); }
public void ValidateRow(DevExpress.Mvvm.Xpf.RowValidationArgs args) { var item = (EFCoreIssues.Issues.Issue)args.Item; var context = new EFCoreIssues.Issues.IssuesContext(); context.Entry(item).State = args.IsNewItem ? EntityState.Added : EntityState.Modified; try { context.SaveChanges(); } finally { context.Entry(item).State = EntityState.Detached; } }
public void ValidateRow(DevExpress.Mvvm.Xpf.RowValidationArgs args) { using (var unitOfWork = new DevExpress.Xpo.UnitOfWork()) { var item = args.IsNewItem ? new XPOIssues.Issues.Issue(unitOfWork) : unitOfWork.GetObjectByKey <XPOIssues.Issues.Issue>(DetachedObjectsHelper.GetKey(args.Item)); DetachedObjectsHelper.ApplyProperties(item, args.Item); unitOfWork.CommitChanges(); if (args.IsNewItem) { DetachedObjectsHelper.SetKey(args.Item, item.Oid); } } }
public void ValidateRow(DevExpress.Mvvm.Xpf.RowValidationArgs args) { _UnitOfWork.CommitChanges(); }