Exemplo n.º 1
0
        public virtual void Add <T>(T entity, IAddCommandInterceptor addInterceptor) where T : class
        {
            Check.NotNull(entity, "entity");
            Check.NotNull(addInterceptor, "addInterceptor");

            addInterceptor.Add(this, Add, entity);
        }
 protected override void AddEntityActioned <T>(T entity, IAddCommandInterceptor addCommandInterceptor)
 {
     addCommandInterceptor.Add(
         this,
         new Action <T>(p =>
     {
         var collectionName = CollectionHelpers.CollectionNameFromEntity(entity);
         var result         = MongoDatabase.GetCollection <T>(collectionName).Insert(entity);
         RaiseEvent(new MongoDbEntityAddedEvent(this, entity, result));
     }),
         entity);
 }