Exemplo n.º 1
0
        /// <summary>
        /// Compares database data-types if schematicly match each other
        /// </summary>
        /// <param name="masterObjectType">Master database data type (or left)</param>
        /// <param name="checkedObjectType">Checked database data type (or right)</param>
        /// <returns>Comparison result</returns>
        public static DbSchemaCompareResult DbCompare(DbObjectTypeSchema masterObjectType, DbObjectTypeSchema checkedObjectType)
        {
            if (masterObjectType == null)
            {
                throw new ArgumentNullException(nameof(masterObjectType));
            }

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

            bool equal = masterObjectType.SqlType == checkedObjectType.SqlType && masterObjectType.Lenght == checkedObjectType.Lenght &&
                         masterObjectType.Precision == checkedObjectType.Precision && masterObjectType.Scale == checkedObjectType.Scale && masterObjectType.AllowNull == checkedObjectType.AllowNull;

            DbSchemaCompareResult result = new DbSchemaCompareResult(masterObjectType, checkedObjectType);

            if (equal)
            {
                result.CompareResultType = DbSchemaCompareResultType.Equals;
            }
            else
            {
                result.CompareResultType = DbSchemaCompareResultType.Different;
            }

            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Compares database parameters if schematicly match each other
        /// </summary>
        /// <param name="masterParam">Master database catalog (or left)</param>
        /// <param name="checkedParam">Checked database catalog (or right)</param>
        /// <returns>Comparison result</returns>
        public static DbSchemaCompareResult DbCompare(DbObjectParameterSchema?masterParam, DbObjectParameterSchema?checkedParam)
        {
            DbSchemaCompareResult result = new DbSchemaCompareResult(masterParam, checkedParam);

            if (checkedParam == null || masterParam == null)
            {
                result.CompareResultType = DbSchemaCompareResultType.Different;
            }
            else
            {
                result.InnerResults.Add(DbObjectTypeSchema.DbCompare(masterParam.DbObjectType, checkedParam.DbObjectType));
                if (masterParam.FakeOrderId == checkedParam.FakeOrderId)
                {
                    result.CompareResultType = DbSchemaCompareResultType.Equals;
                }
                else
                {
                    result.CompareResultType = DbSchemaCompareResultType.Different;
                }
            }

            return(result);
        }
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="name">Name of the object</param>
 /// <param name="dbObjectType">Database type of this parameter</param>
 /// <param name="collation">Column collation</param>
 public DbObjectTableColumnSchema(string name, DbObjectTypeSchema dbObjectType, string collation) : base(name, dbObjectType)
 {
     Collation = collation;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Ctor
 /// </summary>
 public DbObjectParameterSchema()
 {
     DbObjectType = new DbObjectTypeSchema();
 }
Exemplo n.º 5
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="name">Name of the object</param>
 /// <param name="dbObjectType">Database type of this parameter</param>
 public DbObjectParameterSchema(string name, DbObjectTypeSchema dbObjectType) : base(name)
 {
     DbObjectType = dbObjectType;
 }