コード例 #1
0
        /// <summary>
        /// Check if another Db object have same DB name
        /// </summary>
        /// <param name="trigger">Another DB object</param>
        /// <returns>True - objects have same names</returns>
        public bool IsSameDbName(DbObjectTriggerSchema trigger)
        {
            if (trigger == null)
            {
                throw new ArgumentNullException(nameof(trigger));
            }

            return(IsSameDbName(trigger.DbSchemaName, trigger.Name));
        }
コード例 #2
0
        /// <summary>
        /// Compares database stored procedures if schematicly match each other
        /// </summary>
        /// <param name="masterSp">Master database stored procedure (or left)</param>
        /// <param name="checkedSp">Checked database stored procedure (or right)</param>
        /// <returns>Comparison result</returns>
        public static DbSchemaCompareResult DbCompare(DbObjectStoredProcedureSchema masterSp, DbObjectStoredProcedureSchema checkedSp)
        {
            if (masterSp == null)
            {
                throw new ArgumentNullException(nameof(masterSp));
            }

            if (checkedSp == null)
            {
                throw new ArgumentNullException(nameof(checkedSp));
            }

            DbSchemaCompareResult result = DbObjectTriggerSchema.DbCompare(masterSp, checkedSp);

            CompareCollection(result, masterSp.Parameters, checkedSp.Parameters, (left, right) => string.Equals(left.Name, right.Name, StringComparison.Ordinal),
                              DbObjectParameterSchema.DbCompare);

            return(result);
        }
コード例 #3
0
        /// <summary>
        /// Compares database triggers if schematicly match each other
        /// </summary>
        /// <param name="masterObjectTrigger">Master database trigger (or left)</param>
        /// <param name="checkedObjectTrigger">Checked database trigger (or right)</param>
        /// <returns>Comparison result</returns>
        public static DbSchemaCompareResult DbCompare(DbObjectTriggerSchema masterObjectTrigger, DbObjectTriggerSchema checkedObjectTrigger)
        {
            if (checkedObjectTrigger == null)
            {
                throw new ArgumentNullException(nameof(checkedObjectTrigger));
            }

            DbSchemaCompareResult result = new DbSchemaCompareResult(masterObjectTrigger, checkedObjectTrigger);

            if (string.Equals(masterObjectTrigger.ScriptText, checkedObjectTrigger.ScriptText, StringComparison.Ordinal))
            {
                result.CompareResultType = DbSchemaCompareResultType.Equals;
            }
            else
            {
                result.CompareResultType = DbSchemaCompareResultType.Different;
            }

            return(result);
        }