File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
SQLiteEfCodeFirstDbCreator/Builder Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -39,11 +39,15 @@ private IEnumerable<ColumnStatement> CreateColumnStatements()
3939 }
4040 } ;
4141
42- if ( ! property . Nullable )
42+ if ( ! property . Nullable && property . StoreGeneratedPattern != StoreGeneratedPattern . Identity ) // Only mark it as NotNull if it should not be generated.
4343 columnStatement . ColumnConstraints . ColumnConstraints . Add ( new NotNullConstraint ( ) ) ;
4444
45- if ( property . StoreGeneratedPattern == StoreGeneratedPattern . Identity )
45+ if ( property . StoreGeneratedPattern == StoreGeneratedPattern . Identity )
46+ {
4647 columnStatement . ColumnConstraints . ColumnConstraints . Add ( new PrimaryKeyConstraint ( ) ) ;
48+ // Must be INTEGER else SQLite will not generate the Ids
49+ columnStatement . TypeName = columnStatement . TypeName . ToLower ( ) == "int" ? "INTEGER" : columnStatement . TypeName ;
50+ }
4751
4852 yield return columnStatement ;
4953 }
You can’t perform that action at this time.
0 commit comments