The new C# driver is totally Async and in my understanding twists a little bit the old design patterns such as DAL in n-tier architecture.
In my Mongo DALs I use to do:
public T Insert(T entity){
_collection.Insert(entity);
return entity;
}
This way I can get the persisted ObjectId
.
Today, everything is Async such as InsertOneAsync
.
How would Insert
method will now return the entity
when the InsertOneAsync
will be done? Can you show an example?