/// <summary> /// Register a custom Auto Id generator function for a type /// </summary> public void RegisterAutoId <T>(Func <T, bool> isEmpty, Func <LiteCollection <BsonDocument>, T> newId) { _autoId[typeof(T)] = new AutoId { IsEmpty = o => isEmpty((T)o), NewId = c => newId(c) }; }
/// <summary> /// Register a custom Auto Id generator function for a type /// </summary> public void RegisterAutoId <T>(Func <T, bool> isEmpty, Func <LiteEngine, string, T> newId) { _autoId[typeof(T)] = new AutoId { IsEmpty = o => isEmpty((T)o), NewId = (db, col) => newId(db, col) }; }
/// <summary> /// Register a custom Auto Id generator function for a type /// </summary> public void RegisterAutoId <T>(Func <T, bool> isEmpty, Func <LiteEngine, string, T> newId) { if (isEmpty == null) { throw new ArgumentNullException("isEmpty"); } if (newId == null) { throw new ArgumentNullException("newId"); } _autoId[typeof(T)] = new AutoId { IsEmpty = o => isEmpty((T)o), NewId = (db, col) => newId(db, col) }; }