public void Update(ConfigurationRecord entity)
        {
            var builder = Builders <ConfigurationRecord> .Filter;
            FilterDefinition <ConfigurationRecord> filt = builder.Eq(p => p.GuId, entity.GuId) &
                                                          builder.Eq(p => p.ApplicationName, entity.ApplicationName);

            _collection.ReplaceOne(
                item => item.GuId == entity.GuId,
                entity,
                new UpdateOptions {
                IsUpsert = false
            });
        }
 public void Add(ConfigurationRecord record)
 {
     var document = new ConfigurationRecord()
     {
         ApplicationName = record.ApplicationName,
         IsActive        = true,
         Name            = record.Name,
         Type            = record.Type,
         Value           = record.Value
     };
     var hede   = _collection.InsertOneAsync(document);
     var status = hede.Status;
 }
        public void Remove(string guid)
        {
            ConfigurationRecord entity = null;
            var builder = Builders <ConfigurationRecord> .Filter;
            FilterDefinition <ConfigurationRecord> filt = builder.Eq(p => p.GuId, guid);
            IFindFluent <ConfigurationRecord, ConfigurationRecord> result = _collection.Find <ConfigurationRecord>(filt);

            if (result != null)
            {
                entity = result.FirstOrDefault();
            }
            entity.IsActive = false;
            _collection.ReplaceOne(
                item => item.GuId == entity.GuId,
                entity,
                new UpdateOptions {
                IsUpsert = false
            });
        }
Ejemplo n.º 4
0
 public void Add(ConfigurationRecord record)
 {
     throw new NotImplementedException();
 }