Example #1
0
            /// <summary>
            /// Creates a new row in the <c>EntityTypeSchema</c> table
            /// </summary>
            /// <param name="entityId">The ID of the entity type</param>
            /// <param name="schemaId">The ID of an associated table</param>
            /// <returns>The row inserted into this table</returns>
            internal EntityTypeSchemaRow AddEntityTypeSchemaRow(int entityId, int schemaId)
            {
                EntityTypeSchemaRow result = NewEntityTypeSchemaRow();

                result.EntityId = entityId;
                result.SchemaId = schemaId;
                AddEntityTypeSchemaRow(result);
                return(result);
            }
            /// <summary>
            /// Checks an array of <c>EntityTypeSchemaRow</c> to see if any element refers
            /// to a specific table.
            /// </summary>
            /// <param name="t">The table to look for</param>
            /// <param name="rows">The rows to check</param>
            /// <returns>True if any row refers to the table</returns>
            /// <remarks>This helps to avoid the clumsy syntax of Array.Find, making
            /// calling code a bit more readable.</remarks>
            internal static bool IsTableInArray(ITable t, EntityTypeSchemaRow[] rows)
            {
                int tableId = t.Id;

                foreach (EntityTypeSchemaRow row in rows)
                {
                    if (row.SchemaId == tableId)
                        return true;
                }

                return false;
            }