public void Save(Dummy dummy)
 {
     dynamic d = _dummies.CreateRecord(dummy.Id);
     d.Blob = dummy.Blob;
     _context.Attach(d);
     _context.SaveChanges();
 }
Ejemplo n.º 2
0
 public void Save(Dummy dummy)
 {
     using (var session = _store.OpenSession())
     {
         session.Store(dummy);
         session.SaveChanges();
     }
 }
 public void Save(Dummy dummy)
 {
     var command = _connection.CreateCommand();
     command.CommandType = CommandType.StoredProcedure;
     command.CommandText = "InsertDummy";
     command.Parameters.AddWithValue("@_Id", dummy.Id);
     command.Parameters.AddWithValue("@Blob", dummy.Blob);
     command.ExecuteNonQuery();
 }
 public Dummy Get(string id)
 {
     var command = _connection.CreateCommand();
     command.CommandType = CommandType.StoredProcedure;
     command.CommandText = "GetDummy";
     command.Parameters.AddWithValue("@_Id", id);
     var reader = command.ExecuteReader( CommandBehavior.SingleRow);
     if(reader.Read())
     {
         var d = new Dummy()
                	{
                		Id = id,
                     Blob = (byte[]) reader[1]
                	};
         reader.Close();
         return d;
     }
     else
     {
         reader.Close();
         return null;
     }
 }
 public void Save(Dummy dummy)
 {
 }
Ejemplo n.º 6
0
        private static void WriteReadDummy(IBenchmarkDummy benchmarkRunner, BenchmarkOperation operations, Random random)
        {
            var d = new Dummy()
            {
                Id = Guid.NewGuid().ToString("N"),
                Blob = new byte[random.Next(4 * 1024, 20 * 1024)] // 4-20 KB
            };

            random.NextBytes(d.Blob);
            if ((operations & BenchmarkOperation.Insert) == BenchmarkOperation.Insert)
            {
                benchmarkRunner.Save(d);
            }
            if ((operations & BenchmarkOperation.Get) == BenchmarkOperation.Get)
            {
                var d2 = benchmarkRunner.Get(d.Id);
                if (d2 == null)
                    throw new InvalidOperationException("Could not find item");
                if (d2.Id != d.Id)
                    throw new InvalidOperationException("Has a different id: " + d2.Id);

            }

            if ((operations & BenchmarkOperation.GetNonExistent) == BenchmarkOperation.GetNonExistent)
            {
                var d3 = benchmarkRunner.Get(d.Id + 1);
                if (d3 != null)
                    throw new InvalidOperationException("Found a non-existent item");
            }
        }
Ejemplo n.º 7
0
 public void Save(Dummy dummy)
 {
     _collection.Save(dummy);
 }
Ejemplo n.º 8
0
 public void Save(Dummy dummy)
 {
     _connection.Strings.Set(_dbId, dummy.Id, dummy.Blob).Wait();
 }