private ForeignKeyAssociationMappingConfiguration(ForeignKeyAssociationMappingConfiguration source)
        {
            Contract.Requires(source != null);

            _keyColumnNames.AddRange(source._keyColumnNames);
            _tableName = source._tableName;
        }
コード例 #2
0
        public static void SetTableName(this DbTableMetadata table, DatabaseName tableName)
        {
            //Contract.Requires(table != null);
            //Contract.Requires(tableName != null);

            table.Annotations.SetAnnotation(TableNameAnnotation, tableName);
        }
コード例 #3
0
        public void Equals_returns_false_when_names_equal_and_schemas_not_equal()
        {
            var databaseName1 = new DatabaseName("T", "S1");
            var databaseName2 = new DatabaseName("T", "S2");

            Assert.NotEqual(databaseName1, databaseName2);
        }
コード例 #4
0
        public void Equals_returns_true_when_names_equal_and_no_schema_specified()
        {
            var databaseName1 = new DatabaseName("T");
            var databaseName2 = new DatabaseName("T");

            Assert.Equal(databaseName1, databaseName2);
        }
        /// <summary>
        ///     Configures the join table name and schema for the relationship.
        /// </summary>
        /// <param name = "tableName">Name of the table.</param>
        /// <param name = "schemaName">Schema of the table.</param>
        /// <returns>The same ManyToManyAssociationMappingConfiguration instance so that multiple calls can be chained.</returns>
        public ManyToManyAssociationMappingConfiguration ToTable(string tableName, string schemaName)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(tableName));

            _tableName = new DatabaseName(tableName, schemaName);

            return this;
        }
        private ManyToManyAssociationMappingConfiguration(ManyToManyAssociationMappingConfiguration source)
        {
            Contract.Requires(source != null);

            _leftKeyColumnNames.AddRange(source._leftKeyColumnNames);
            _rightKeyColumnNames.AddRange(source._rightKeyColumnNames);
            _tableName = source._tableName;
        }
コード例 #7
0
        public bool Equals(DatabaseName other)
        {
            if (ReferenceEquals(null, other))
            {
                return false;
            }

            if (ReferenceEquals(this, other))
            {
                return true;
            }

            return string.Equals(other._name, _name, StringComparison.Ordinal)
                   && string.Equals(other._schema, _schema, StringComparison.Ordinal);
        }
コード例 #8
0
        public static DbTableMetadata FindTableByName(this DbDatabaseMetadata database, DatabaseName tableName)
        {
            //Contract.Requires(database != null);
            //Contract.Requires(tableName != null);

            return database.Schemas.Single().Tables.SingleOrDefault(
                t =>
                    {
                        var databaseName = t.GetTableName();
                        return databaseName != null
                                   ? databaseName.Equals(tableName)
                                   : string.Equals(t.Name, tableName.Name, StringComparison.Ordinal);
                    });
        }
コード例 #9
0
        public void ToString_returns_table_name_when_no_schema_specified()
        {
            var databaseName = new DatabaseName("T");

            Assert.Equal("T", databaseName.ToString());
        }