Beispiel #1
0
        protected void ThrowInvalidObjectNameException(DatabaseObject databaseObject)
        {
            string message;

            switch (Constants.DatabaseObjectTypes[databaseObject.GetType()])
            {
            case DatabaseObjectType.Table:
                message = ExceptionMessages.InvalidTableName;
                break;

            case DatabaseObjectType.View:
                message = ExceptionMessages.InvalidViewName;
                break;

            case DatabaseObjectType.TableValuedFunction:
                message = ExceptionMessages.InvalidTableValuedFunctionName;
                break;

            case DatabaseObjectType.ScalarFunction:
                message = ExceptionMessages.InvalidScalarFunctionName;
                break;

            case DatabaseObjectType.StoredProcedure:
                message = ExceptionMessages.InvalidStoredProcedureName;
                break;

            default:
                throw new NotImplementedException();
            }

            throw new SchemaException(String.Format(message, databaseObject.ToString()));
        }