Exemplo n.º 1
0
        public async Task CreateAsync(ICreationOperation <TEntity> creation)
        {
            var entity = new TEntity();
            var entry  = _appDbContext.Set <TEntity>().Add(entity);

            var entitiesCreated = await _appDbContext.SaveChangesAsync();

            if (entitiesCreated == 1)
            {
                creation.CreatedId = entry.Entity.Id;
            }
        }
Exemplo n.º 2
0
        public async Task CreateAsync(ICreationOperation <TEntity> creation)
        {
            var entity = new TEntity
            {
                Id = new ObjectId()
            };

            creation.Mutation.Invoke(entity);

            await _mongoCollection.InsertOneAsync(entity);

            creation.CreatedId = entity.Id.ToString();
        }