Changeset 2390
- Timestamp:
- 09/25/09 11:11:12 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DatabaseService.cs
r2389 r2390 121 121 using (ModelingDataContext ctx = new ModelingDataContext(connection)) { 122 122 Model m = (Model)model; 123 Model orginal = ctx.Models.GetOriginalEntityState(m); 124 if (orginal == null) 125 ctx.Models.Attach(m); 126 ctx.Refresh(RefreshMode.KeepCurrentValues, m); 123 //check if model has to be updated or inserted 124 if (ctx.Models.Any(x => x.Id == model.Id)) { 125 Model orginal = ctx.Models.GetOriginalEntityState(m); 126 if (orginal == null) 127 ctx.Models.Attach(m); 128 ctx.Refresh(RefreshMode.KeepCurrentValues, m); 129 } else 130 ctx.Models.InsertOnSubmit(m); 127 131 ctx.SubmitChanges(); 128 132 }
Note: See TracChangeset
for help on using the changeset viewer.