コード例 #1
0
        public void UpdateWithTransaction(T currentObj, T expectedObj, string[] primaryKeyNames, IFactory factory)
        {
            string    query = GenerateQuery.CommandTextUpdate(currentObj, primaryKeyNames);
            DbCommand cmd   = factory.MakeCommand(query);

            GenerateQuery.PrepareParametersUpdate(cmd, currentObj, expectedObj, primaryKeyNames);
            factory.ExecuteNonQuery(cmd);
        }
コード例 #2
0
        public void UpdateDoub(T currentObj, T expectedObj, string[] primaryKeyNames, string[] primaryKeyNames2)
        {
            IFactory factory = DBHelper.CreateFactory();

            try
            {
                string    query = GenerateQuery.CommandTextUpdate(currentObj, primaryKeyNames, primaryKeyNames2);
                DbCommand cmd   = factory.MakeCommand(query);
                GenerateQuery.PrepareParametersUpdate(cmd, currentObj, expectedObj, primaryKeyNames, primaryKeyNames2);
                cmd.CommandTimeout = 10;
                factory.ExecuteNonQuery(cmd);
            }
            catch (Exception ex)
            {
                Write2Log.WriteLogs("Generic<T>", string.Format("Update({0} currentObj, {0} expectedObj, string[] primaryKeyNames)", typeof(T).Name), ex.Message);
            }
            finally
            {
                factory.Release();
            }
        }