Beispiel #1
0
    public virtual void Create(T entity)
    {
        //// Save the entity with safe mode (WriteConcern.Acknowledged)
        entity.MyId = IDHelper.GetNextId(typeof(T).Name);
        var result = this.MongoConnectionHandler.MongoCollection.Save(
            entity,
            new MongoInsertOptions
        {
            WriteConcern = WriteConcern.Acknowledged
        });

        if (!result.Ok)
        {
            //// Something went wrong
        }
    }