Пример #1
0
        public FindRowIdentityResult FindRowIdentity(FindRowIdentityParameters parameters)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                FindRowIdentityResult result = null;

                using (IDbConnection connection = new DbConnection(ConnectionString))
                {
                    connection.Open();

                    using (IDbCommand command = connection.CreateCommand())
                    {
                        command.CommandText = "RowTracker.Find";
                        ((OracleCommand)command).BindByName = true;

                        foreach (IDbDataParameter parameter in FindRowIdentityTranslator.TranslateParameters(parameters))
                        {
                            command.Parameters.Add(parameter);
                        }

                        command.Prepare();
                        command.CommandType = CommandType.StoredProcedure;
                        command.ExecuteNonQuery();
                        result = FindRowIdentityTranslator.TranslateResult(command.Parameters);
                    }
                }

                scope.Complete();

                return(result);
            }
        }
Пример #2
0
        public static FindRowIdentityResult TranslateResult(IDataParameterCollection resultParameters)
        {
            FindRowIdentityResult result = new FindRowIdentityResult();
            object data;

            data = ((IDbDataParameter)resultParameters["ROWIDENTITY_I"]).Value;

            if (data != DBNull.Value)
            {
                result.RowIdentity = DbTypeConvertor.Convert <string>(data);
            }

            return(result);
        }