public void Delete(int id)
        {
            var stub = new Models.TestEntity{Id=id};
            _context.TestEntities.Attach(stub);

            _context.TestEntities.Remove(stub);
        }
Beispiel #2
0
        public ActionResult Index(Models.TestEntity model, string action, string testText, DateTime?datePicker1)
        {
            FillSampleData();

            return(View(model)
                   .WithInfoSnackbar("submitted: action:{0}", action));
        }
        public void Add(Models.TestEntity entity)
        {
            _testInt.Value    = entity.TestInt;
            _testDate.Value   = entity.TestDate;
            _testString.Value = entity.TestString;

            _insertCommand.ExecuteNonQuery();
        }
        public void Update(int id, string testString, int testInt, DateTime testDateTime)
        {
            var entity = new Models.TestEntity { Id = id };
            _context.TestEntities.Attach(entity);

            entity.TestDate = testDateTime;
            entity.TestInt = testInt;
            entity.TestString = testString;
        }
        public void Add(Models.TestEntity entity)
        {
            var row = _dataToAdd.NewRow();

            row["TestInt"]    = entity.TestInt;
            row["TestDate"]   = entity.TestDate;
            row["TestString"] = entity.TestString;
            _dataToAdd.Rows.Add(row);
        }
Beispiel #6
0
        public void Add(Models.TestEntity entity)
        {
            var e = _context.TestEntities.Create();

            e.TestDate   = entity.TestDate;
            e.TestInt    = entity.TestInt;
            e.TestString = entity.TestString;
            _context.TestEntities.Add(e);
        }
        public void Delete(int id)
        {
            var stub = new Models.TestEntity {
                Id = id
            };

            _context.TestEntities.Attach(stub);

            _context.TestEntities.Remove(stub);
        }
Beispiel #8
0
        public void Add(Models.TestEntity entity)
        {
            _insertCommand.CommandText = string.Format(
                insertString,
                entity.TestDate.ToString("yyyy-MM-dd HH:mm:ss.fff"),
                entity.TestInt,
                entity.TestString);

            _insertCommand.ExecuteNonQuery();
        }
 public void Add(Models.TestEntity entity)
 {
     _context.TestEntities.InsertOnSubmit(
         new TestEntity
     {
         TestDate   = entity.TestDate,
         TestInt    = entity.TestInt,
         TestString = entity.TestString
     });
 }
Beispiel #10
0
        public void Update(int id, string testString, int testInt, DateTime testDateTime)
        {
            var entity = new Models.TestEntity {
                Id = id
            };

            _context.TestEntities.Attach(entity);

            entity.TestDate   = testDateTime;
            entity.TestInt    = testInt;
            entity.TestString = testString;
        }
        public Models.TestEntity Find(int id)
        {
            _connection = new System.Data.SqlClient.SqlConnection(_connectionString.FormattedConnectionString);
            _connection.Open();
            _findByIdCommand.Connection = _connection;
            _testId.Value = id;
            var result = _findByIdCommand.ExecuteReader();

            result.Read();

            var res = new Models.TestEntity
            {
                Id = (int)result["Id"],
                TestDate = (DateTime)result["TestDate"],
                TestInt = (int)result["TestInt"],
                TestString = result["TestString"].ToString()
            };
            result.Close();
            _connection.Close();
            return res;
        }
Beispiel #12
0
        public Models.TestEntity Find(int id)
        {
            _connection = new System.Data.SqlClient.SqlConnection(_connectionString.FormattedConnectionString);
            _connection.Open();
            _findByIdCommand.Connection = _connection;
            _testId.Value = id;
            var result = _findByIdCommand.ExecuteReader();

            result.Read();

            var res = new Models.TestEntity
            {
                Id         = (int)result["Id"],
                TestDate   = (DateTime)result["TestDate"],
                TestInt    = (int)result["TestInt"],
                TestString = result["TestString"].ToString()
            };

            result.Close();
            _connection.Close();
            return(res);
        }
Beispiel #13
0
        public void Add(Models.TestEntity entity)
        {
            counter++;

            //batches of 200 work best due to some crazy SQL server execution plan calculation issue, see http://stackoverflow.com/q/8635818/1070291
            if (counter % 200 == 1)
            {
                insertBuilder.AppendLine(string.Format(
                                             insertStringFirst,
                                             entity.TestDate.ToString("yyyy-MM-dd HH:mm:ss.fff"),
                                             entity.TestInt,
                                             entity.TestString));
            }
            else
            {
                insertBuilder.AppendLine(string.Format(
                                             insertString,
                                             entity.TestDate.ToString("yyyy-MM-dd HH:mm:ss.fff"),
                                             entity.TestInt,
                                             entity.TestString));
            }
        }
Beispiel #14
0
 public void Add(Models.TestEntity entity)
 {
     _session.Insert(new NHTestEntity(entity));
 }
Beispiel #15
0
 public void Add(Models.TestEntity entity)
 {
     _context.TestEntities.Add(entity);
 }
 public void Add(Models.TestEntity entity)
 {
     _entitiesToInsert.Add(new { TestDate = entity.TestDate, TestInt = entity.TestInt, TestString = entity.TestString });
 }
 public void Add(Models.TestEntity entity)
 {
     _database.TestEntities.Insert(new { TestDate = entity.TestDate, TestInt = entity.TestInt, TestString = entity.TestString });
 }
Beispiel #18
0
 public void Add(Models.TestEntity entity)
 {
     _connection.Execute("INSERT TestEntities (TestDate, TestInt, TestString) VALUES (@TestDate, @TestInt, @TestString)",
                         new { TestDate = entity.TestDate, TestInt = entity.TestInt, TestString = entity.TestString }, transaction: _transaction);
 }
 public void Add(Models.TestEntity entity)
 {
     _session.Save(new NHTestEntity(entity));
 }