public T GetOrCreateIdModel <T>(LiteQueryable <T> col, ObjectId id, Action <T> save) where T : ModelBase, new() { lock (DataLock) { var d = col.FirstOrDefault(x => x.Id == id); if (d != null) { return(d); } d = new T { Id = id }; save.Invoke(d); return(d); } }
public T FirstOrDefault() { return(_query.FirstOrDefault()); }