Beispiel #1
0
        public void CreateRecordInDatabase(DbRecord dbRecord)
        {
            string createQuery   = BuildCreateString(dbRecord);
            var    sqlParameters = dbRecord.Values.Select(t => new SqlParameter("@" + t.Key, t.Value)).ToArray();

            using (var sqlWrapper = new MssqlWrapper(connection.GetConnection() as SqlConnection))
            {
                sqlWrapper.ExecuteNonQuery(createQuery, sqlParameters);
            }
        }
Beispiel #2
0
        public void UpdateRecordInDatabase(DbRecord dbRecord)
        {
            string updateQuery         = BuildUpdateString(dbRecord);
            var    sqlColumnParameters = dbRecord.Values.Select(t => new SqlParameter("@" + t.Key, t.Value)).ToArray();
            var    sqlWhereParameters  = dbRecord.Identifiers.Select(t => new SqlParameter("@whereparam_" + t.Key, t.Value)).ToArray();

            using (var sqlWrapper = new MssqlWrapper(connection.GetConnection() as SqlConnection))
            {
                sqlWrapper.ExecuteNonQuery(updateQuery, sqlColumnParameters.Concat(sqlWhereParameters).ToArray());
            }
        }