public IRecord FindRecordById(string id) { Property idprop = _config.GetIdentityProperties()[0]; foreach (IRecord r in _maintracker.Lookup(idprop, id)) { if (r.GetValue(idprop.Name) == id) { return(r); } } return(null); // not found }
/// <summary> /// Add the record to the index. /// </summary> /// <param name="record"></param> public void Index(IRecord record) { foreach (Property p in _config.GetIdentityProperties()) { List <String> values = record.GetValues(p.Name); if (values == null) { continue; } foreach (string value in values) { _idindex.Add(value, record); } } _records.Add(record); }
// Internals private bool IsSameAs(IRecord r1, IRecord r2) { foreach (Property idp in _config.GetIdentityProperties()) { List <string> vs2 = r2.GetValues(idp.Name); List <string> vs1 = r1.GetValues(idp.Name); if (vs1 == null) { continue; } foreach (string v1 in vs1) { if (vs2.Contains(v1)) { return(true); } } } return(false); }