Example #1
0
        private bool LoadEntityWithId(ITransaction transaction, IColumnTestEntity loadEntity, int id)
        {
            bool loaded = false;

            IDbCommand cmd = transaction.CreateCommand();

            cmd.CommandText = "select * from column_test_entity where id_col = ?";

            IDbDataParameter parameter = cmd.CreateParameter();

            cmd.Parameters.Add(parameter);
            parameter.DbType    = DbType.Int32;
            parameter.Direction = ParameterDirection.Input;
            parameter.Value     = id;

            IDataReader dataReader = cmd.ExecuteReader();

            if (dataReader.Read())
            {
                loadEntity.Retrieve(dataReader, transaction);
                loaded = true;
            }

            return(loaded);
        }
Example #2
0
        private void AssertTwoEntitiesEquals(IColumnTestEntity entityA, IColumnTestEntity entityB)
        {
            Assert.AreEqual(entityA.IdCol, entityB.IdCol);

            Assert.AreEqual(entityA.CharNotNull, entityB.CharNotNull);
            Assert.AreEqual(entityA.CharNull, entityB.CharNull);
            Assert.AreEqual(entityA.DateNotNull, entityB.DateNotNull);
            Assert.AreEqual(entityA.DateNull, entityB.DateNull);
            Assert.AreEqual(entityA.DoubleNotNull, entityB.DoubleNotNull);
            Assert.AreEqual(entityA.DoubleNull, entityB.DoubleNull);
            Assert.AreEqual(entityA.FloatNotNull, entityB.FloatNotNull);
            Assert.AreEqual(entityA.FloatNull, entityB.FloatNull);
            Assert.AreEqual(entityA.IntNotNull, entityB.IntNotNull);
            Assert.AreEqual(entityA.IntNull, entityB.IntNull);
            Assert.AreEqual(entityA.LongNotNull, entityB.LongNotNull);
            Assert.AreEqual(entityA.LongNull, entityB.LongNull);
            Assert.AreEqual(entityA.TimestampNotNull, entityB.TimestampNotNull);
            Assert.AreEqual(entityA.TimestampNull, entityB.TimestampNull);
            Assert.AreEqual(entityA.VarcharNotNull, entityB.VarcharNotNull);
            Assert.AreEqual(entityA.VarcharNull, entityB.VarcharNull);
            Assert.AreEqual(entityA.GuidNotNull, entityB.GuidNotNull);
            Assert.AreEqual(entityA.GuidNull, entityB.GuidNull);
        }
Example #3
0
 private void UpdateEntityWithNullValues(IColumnTestEntity entity)
 {
     entity.BooleanNotNull   = false;
     entity.BooleanNull      = null;
     entity.CharNotNull      = 'C';
     entity.CharNull         = null;
     entity.DateNotNull      = DateTime.Now;
     entity.DateNull         = null;
     entity.DoubleNotNull    = 53D;
     entity.DoubleNull       = null;
     entity.FloatNotNull     = 20465F;
     entity.FloatNull        = null;
     entity.IntNotNull       = 35424;
     entity.IntNull          = null;
     entity.LongNotNull      = 3565535L;
     entity.LongNull         = null;
     entity.TimestampNotNull = DateTime.Now;
     entity.TimestampNull    = null;
     entity.VarcharNotNull   = "notNull string";
     entity.VarcharNull      = null;
     entity.GuidNotNull      = Guid.NewGuid();
     entity.GuidNull         = null;
 }
Example #4
0
 private void CreateEntityWithNullValues(IColumnTestEntity entity)
 {
     entity.BooleanNotNull   = true;
     entity.BooleanNull      = null;
     entity.CharNotNull      = 'A';
     entity.CharNull         = null;
     entity.DateNotNull      = DateTime.Now;
     entity.DateNull         = null;
     entity.DoubleNotNull    = 5D;
     entity.DoubleNull       = null;
     entity.FloatNotNull     = 20F;
     entity.FloatNull        = null;
     entity.IntNotNull       = 24;
     entity.IntNull          = null;
     entity.LongNotNull      = 356L;
     entity.LongNull         = null;
     entity.TimestampNotNull = DateTime.Now;
     entity.TimestampNull    = null;
     entity.VarcharNotNull   = "notNull";
     entity.VarcharNull      = null;
     entity.GuidNotNull      = Guid.NewGuid();
     entity.GuidNull         = null;
 }