/// <summary>
        /// Returns a prepared statement to execute (in case of virtual stored procedures)
        /// or the name of a stored procedure to execute (in case of stored procedures executed from the database)
        /// </summary>
        /// <param name="StoredProcedureName"></param>
        private string GetCommandText(string storedProcedureName, out CommandType commandType)
        {
            string val;
            ProcedureStorageLocationType procedureStorageLocationType = ProcedureStorageLocationProvider.GetLocation(storedProcedureName);

            if (procedureStorageLocationType == ProcedureStorageLocationType.None) //Get default
            {
                procedureStorageLocationType = GetSPOption();
            }

            switch (procedureStorageLocationType)
            {
            case ProcedureStorageLocationType.Db:
                commandType = CommandType.StoredProcedure;
                val         = storedProcedureName;
                break;

            case ProcedureStorageLocationType.Resource:
                commandType = CommandType.Text;
                val         = LookUpText(storedProcedureName);
                break;

            case ProcedureStorageLocationType.None:
            default:
                throw new InvalidOperationException(string.Format("specified option not implemented. Option was {0}", procedureStorageLocationType));
            }

            return(val);
        }
示例#2
0
        public static ProcedureStorageLocationType GetLocation(string commandName)
        {
            ProcedureStorageLocationType val = ProcedureStorageLocationType.None;

            if (_LocationCache.ContainsKey(commandName))
            {
                val = _LocationCache[commandName];
            }

            return(val);
        }