Skip to content

Commit 76ce0b5

Browse files
committed
Misc fixes. Remove old sqlite tests.
1 parent 967515d commit 76ce0b5

18 files changed

Lines changed: 467 additions & 1534 deletions

SQLitePCL.pretty.Orm/TableMapping.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,10 @@ private static TableColumnMetadata CreateColumnMetadata(this PropertyInfo This)
235235
}
236236

237237
// Though technically not required to be not null by SQLite, we enforce that the primary key is always not null
238-
var hasNotNullConstraint = isPK || This.HasNotNullConstraint() || columnType.GetTypeInfo().IsValueType;
238+
var hasNotNullConstraint =
239+
isPK ||
240+
This.HasNotNullConstraint() ||
241+
(columnType.GetTypeInfo().IsValueType && !columnType.IsNullable());
239242

240243
return new TableColumnMetadata(columnType.GetSQLiteType().ToSQLDeclaredType(), collation, hasNotNullConstraint, isPK, isAutoInc);
241244
}

SQLitePCL.pretty.Orm/TableQuery.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,25 +205,25 @@ private TableQuery<T> AddOrderBy<TValue>(Expression<Func<T, TValue>> orderExpr,
205205

206206
public TableQuery<T> OrderBy<TValue>(Expression<Func<T, TValue>> orderExpr)
207207
{
208-
// FIXME: Throw an exception if order by is not empty?
208+
if (this._orderBy.Count != 0) { throw new NotSupportedException("OrderBy can only be called once"); };
209209
return AddOrderBy(orderExpr, true);
210210
}
211211

212212
public TableQuery<T> OrderByDescending<TValue>(Expression<Func<T, TValue>> orderExpr)
213213
{
214-
// FIXME: Throw an exception if order by is not empty?
214+
if (this._orderBy.Count != 0) { throw new NotSupportedException("OrderBy can only be called once"); };
215215
return AddOrderBy(orderExpr, false);
216216
}
217217

218218
public TableQuery<T> ThenBy<TValue>(Expression<Func<T, TValue>> orderExpr)
219219
{
220-
// FIXME: Throw an exception if order by is empty?
220+
if (this._orderBy.Count == 0) { throw new NotSupportedException("Must call OrderBy before ThenBy"); };
221221
return AddOrderBy(orderExpr, true);
222222
}
223223

224224
public TableQuery<T> ThenByDescending<TValue>(Expression<Func<T, TValue>> orderExpr)
225225
{
226-
// FIXME: Throw an exception if order by is empty?
226+
if (this._orderBy.Count == 0) { throw new NotSupportedException("Must call OrderBy before ThenBy"); };
227227
return AddOrderBy(orderExpr, false);
228228
}
229229

SQLitePCL.pretty.tests/Orm/ContainsTest.cs

Lines changed: 0 additions & 107 deletions
This file was deleted.

SQLitePCL.pretty.tests/Orm/CreateTableTests.cs

Lines changed: 0 additions & 59 deletions
This file was deleted.

SQLitePCL.pretty.tests/Orm/DateTimeOffsetTest.cs

Lines changed: 0 additions & 64 deletions
This file was deleted.

SQLitePCL.pretty.tests/Orm/DateTimeTest.cs

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)