Changeset 1449 for trunk/sources/HeuristicLab.DataAccess.ADOHelper
- Timestamp:
- 03/27/09 14:04:47 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.DataAccess.ADOHelper
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.DataAccess.ADOHelper/CachedDataAdapter.cs
r1377 r1449 145 145 protected abstract bool PutInCache(ObjT obj); 146 146 147 protected abstract RowT FindCachedById( longid);147 protected abstract RowT FindCachedById(Guid id); 148 148 149 149 public void SyncWithDb() { … … 169 169 cacheLock.EnterReadLock(); 170 170 171 bool cached = FindCachedById(( long)row[row.Table.PrimaryKey[0]]) != null;171 bool cached = FindCachedById((Guid)row[row.Table.PrimaryKey[0]]) != null; 172 172 173 173 cacheLock.ExitReadLock(); … … 177 177 } 178 178 179 protected override RowT GetRowById( longid) {179 protected override RowT GetRowById(Guid id) { 180 180 cacheLock.EnterReadLock(); 181 181 … … 227 227 if (obj != null) { 228 228 RowT row = null; 229 long locked = default(long);230 231 if (obj.Id != default(long)) {229 Guid locked = Guid.Empty; 230 231 if (obj.Id != Guid.Empty) { 232 232 LockRow(obj.Id); 233 233 locked = obj.Id; 234 234 235 235 row = GetRowById(obj.Id); 236 } else { 237 obj.Id = Guid.NewGuid(); 236 238 } 237 239 … … 241 243 } else { 242 244 row = InsertNewRow(obj); 245 UpdateRow(row); 243 246 } 244 245 UpdateRow(row); 246 obj.Id = (long)row[row.Table.PrimaryKey[0]]; 247 } 248 249 if (locked == default(long)) { 247 } 248 249 if (locked == Guid.Empty) 250 { 250 251 LockRow(obj.Id); 251 252 locked = obj.Id; -
trunk/sources/HeuristicLab.DataAccess.ADOHelper/DataAdapterBase.cs
r1377 r1449 92 92 protected abstract void UpdateRow(RowT row); 93 93 94 protected abstract IEnumerable<RowT> FindById( longid);94 protected abstract IEnumerable<RowT> FindById(Guid id); 95 95 96 96 protected abstract IEnumerable<RowT> FindAll(); … … 154 154 } 155 155 156 protected virtual RowT GetRowById( longid) {156 protected virtual RowT GetRowById(Guid id) { 157 157 return FindSingleRow( 158 158 delegate() { … … 164 164 if (obj != null) { 165 165 RowT row = null; 166 long locked = default(long); 167 168 if (obj.Id != default(long)) { 169 LockRow(obj.Id); 170 locked = obj.Id; 171 172 row = GetRowById(obj.Id); 173 } 166 Guid locked = Guid.Empty; 167 168 if (obj.Id != Guid.Empty) { 169 LockRow(obj.Id); 170 locked = obj.Id; 171 172 row = GetRowById(obj.Id); 173 } else { 174 obj.Id = Guid.NewGuid(); 175 } 174 176 175 177 if (row == null) { 176 178 row = InsertNewRow(obj); 177 179 UpdateRow(row); 178 179 obj.Id = (long)row[row.Table.PrimaryKey[0]]; 180 } 181 182 if (locked == default(long)) { 180 } 181 182 if (locked == Guid.Empty) { 183 183 LockRow(obj.Id); 184 184 locked = obj.Id; … … 192 192 } 193 193 194 public virtual ObjT GetById( longid) {194 public virtual ObjT GetById(Guid id) { 195 195 return FindSingle(delegate() { 196 196 return FindById(id);
Note: See TracChangeset
for help on using the changeset viewer.