Skip to content

Commit 9cb2b4a

Browse files
committed
Add non-generic ExecuteQuery
1 parent 918132b commit 9cb2b4a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

SQLiteSharp/ObjectMapper.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public int ExecuteNonQuery() {
111111
/// </remarks>
112112
protected virtual void OnInstanceCreated(object obj) { }
113113

114-
public IEnumerable<T> ExecuteQuery<T>(TableMapping map) {
114+
public IEnumerable<object> ExecuteQuery(TableMapping map) {
115115
Sqlite3Statement statement = Prepare();
116116
try {
117117
while (SQLiteRaw.Step(statement) is SQLiteRaw.Result.Row) {
@@ -132,13 +132,16 @@ public IEnumerable<T> ExecuteQuery<T>(TableMapping map) {
132132
column.SetValue(obj, value);
133133
}
134134
OnInstanceCreated(obj);
135-
yield return (T)obj;
135+
yield return obj;
136136
}
137137
}
138138
finally {
139139
SQLiteRaw.Finalize(statement);
140140
}
141141
}
142+
public IEnumerable<T> ExecuteQuery<T>(TableMapping map) {
143+
return ExecuteQuery(map).Cast<T>();
144+
}
142145
public IEnumerable<T> ExecuteQuery<T>() {
143146
return ExecuteQuery<T>(_connection.GetMapping<T>());
144147
}

0 commit comments

Comments
 (0)