Exemplo n.º 1
0
        public SqlDataRecord ToSqlDataRecord()
        {
            var sdr = new SqlDataRecord(
                new SqlMetaData("Name", SqlDbType.VarChar),
                new SqlMetaData("Description", SqlDbType.VarChar),
                new SqlMetaData("TaskStatusId", SqlDbType.Int),
                new SqlMetaData("Created", SqlDbType.DateTime),
                new SqlMetaData("CreatedBy", SqlDbType.VarChar),
                new SqlMetaData("Updated", SqlDbType.DateTime),
                new SqlMetaData("UpdatedBy", SqlDbType.VarChar)
                );

            sdr.SetString(0, Name);
            sdr.SetString(1, Description);
            if (TaskStatusId.HasValue)
            {
                sdr.SetInt32(2, TaskStatusId.GetValueOrDefault());
            }
            else
            {
                sdr.SetDBNull(2);
            }
            if (Created.HasValue)
            {
                sdr.SetDateTime(3, Created.GetValueOrDefault());
            }
            else
            {
                sdr.SetDBNull(3);
            }
            sdr.SetString(4, CreatedBy);
            if (Updated.HasValue)
            {
                sdr.SetDateTime(5, Updated.GetValueOrDefault());
            }
            else
            {
                sdr.SetDBNull(5);
            }
            sdr.SetString(6, UpdatedBy);
            return(sdr);
        }