Exemplo n.º 1
0
        /// <summary>
        /// Calculates and returns the integer hashcode which
        /// should be unique for any combination of type and operation
        /// </summary>
        /// <param name="type"></param>
        /// <param name="op"></param>
        /// <returns></returns>
        public static int GetHashCode(DBSchemaTypes type, DBSchemaOperation op)
        {
            int val = (int)type;

            val  = val << 16;
            val += (int)op;
            return(val);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Check if this database supports a specific operation on the database.
 /// </summary>
 /// <param name="schema"></param>
 /// <param name="op"></param>
 /// <returns></returns>
 public bool CheckSupports(DBSchemaTypes schema, DBSchemaOperation op)
 {
     if (this.UnsupportedOps.Contains(schema, op))
     {
         return(false);
     }
     else
     {
         return(CheckSupports(schema));
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Returns true if this collection contains a TypedOperation that matches the parameters
        /// </summary>
        /// <param name="type"></param>
        /// <param name="operation"></param>
        /// <returns></returns>
        public bool Contains(DBSchemaTypes type, DBSchemaOperation operation)
        {
            TypedOperation value;
            int            hash = TypedOperation.GetHashCode(type, operation);

            if (_ops.TryGetValue(hash, out value))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Create a new TypedOperation
 /// </summary>
 /// <param name="type"></param>
 /// <param name="op"></param>
 public TypedOperation(DBSchemaTypes type, DBSchemaOperation op)
 {
     this.Type      = type;
     this.Operation = op;
 }
Exemplo n.º 5
0
        /// <summary>
        /// Removes a TypedOperation from this collection that has a type and operation matching the parameters
        /// </summary>
        /// <param name="type"></param>
        /// <param name="operation"></param>
        public void Remove(DBSchemaTypes type, DBSchemaOperation operation)
        {
            TypedOperation value = new TypedOperation(type, operation);

            this.Remove(value);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Adds a new TypedOperation to the collection based on the type and operation
        /// </summary>
        /// <param name="type"></param>
        /// <param name="operation"></param>
        public void Add(DBSchemaTypes type, DBSchemaOperation operation)
        {
            TypedOperation value = new TypedOperation(type, operation);

            this.Add(value);
        }