Ejemplo n.º 1
0
 /// <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)
     };
 }
Ejemplo n.º 2
0
 /// <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)
     };
 }
Ejemplo n.º 3
0
        /// <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)
            };
        }