private bool AppliesToCurrentTable(WithAccessOptionalTableAttribute access) { return access.Table == currentTable; }
private JoinedTableModel ObtainJoinedTableIfPresent(MemberInfo propertyOrField, WithAccessOptionalTableAttribute access) { String tableName = access.Table; if (tableName == null) return null; if (currentModel.IsNestedType) { throw new ActiveRecordException( String.Format("{0} {1} references table \"{2}\" which is not allowed on nested types.", propertyOrField is PropertyInfo ? "Property" : "Field", propertyOrField.Name, tableName)); } if (tableName == String.Empty || tableName == currentModel.ActiveRecordAtt.Table) { access.Table = null; return null; } JoinedTableModel joinedTable = null; foreach (JoinedTableModel jtm in currentModel.JoinedTables) { if (jtm.JoinedTableAttribute.Table == tableName) { joinedTable = jtm; break; } } if (joinedTable == null) { throw new ActiveRecordException( String.Format("{0} {1} references table \"{2}\", which does not have a corresponding [JoinedTable] on the class.", propertyOrField is PropertyInfo ? "Property" : "Field", propertyOrField.Name, tableName)); } return joinedTable; }