Пример #1
0
        public int Delete(object keyValue)
        {
            var keyName = GetPrimaryKey();
            var q       =
                QueryAdapter
                .CreateQueryDelete(
                    GetTableName()
                    , keyName
                    );

            q.Parameters.Add(keyName, keyValue);
            return(QueryAdapter.Execute(q));
        }
Пример #2
0
        public int Insert(
            T entity
            )
        {
            var fields =
                entity
                .GetFields()
                .Where(p => !p.IsIdentity)
                .ToList();

            return
                (QueryAdapter
                 .Execute(
                     QueryAdapter
                     .CreateQueryInsert(
                         GetTableName()
                         , fields
                         )
                     ));
        }
Пример #3
0
        public int Update(
            T row
            , IDbTransaction transaction
            )
        {
            var fields =
                row
                .GetFields()
                .ToList();

            return
                (QueryAdapter
                 .Execute(
                     QueryAdapter
                     .CreateQueryUpdate(
                         GetTableName()
                         , fields
                         , transaction
                         )
                     ));
        }