File tree Expand file tree Collapse file tree 1 file changed +19
-9
lines changed
Expand file tree Collapse file tree 1 file changed +19
-9
lines changed Original file line number Diff line number Diff line change @@ -39,18 +39,28 @@ private IEnumerable<ColumnStatement> CreateColumnStatements()
3939 }
4040 } ;
4141
42- if ( ! property . Nullable && property . StoreGeneratedPattern != StoreGeneratedPattern . Identity ) // Only mark it as NotNull if it should not be generated.
43- columnStatement . ColumnConstraints . ColumnConstraints . Add ( new NotNullConstraint ( ) ) ;
44-
45- if ( property . StoreGeneratedPattern == StoreGeneratedPattern . Identity )
46- {
47- 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- }
42+ AddNullConstraintIfNecessary ( property , columnStatement ) ;
43+ AddPrimaryKeyIfNecessary ( property , columnStatement ) ;
5144
5245 yield return columnStatement ;
5346 }
5447 }
48+
49+ private static void AddPrimaryKeyIfNecessary ( EdmProperty property , ColumnStatement columnStatement )
50+ {
51+ if ( property . StoreGeneratedPattern == StoreGeneratedPattern . Identity )
52+ {
53+ columnStatement . ColumnConstraints . ColumnConstraints . Add ( new PrimaryKeyConstraint ( ) ) ;
54+ // Must be INTEGER else SQLite will not generate the Ids
55+ columnStatement . TypeName = columnStatement . TypeName . ToLower ( ) == "int" ? "INTEGER" : columnStatement . TypeName ;
56+ }
57+ }
58+
59+ private static void AddNullConstraintIfNecessary ( EdmProperty property , ColumnStatement columnStatement )
60+ {
61+ if ( ! property . Nullable && property . StoreGeneratedPattern != StoreGeneratedPattern . Identity )
62+ // Only mark it as NotNull if it should not be generated.
63+ columnStatement . ColumnConstraints . ColumnConstraints . Add ( new NotNullConstraint ( ) ) ;
64+ }
5565 }
5666}
You can’t perform that action at this time.
0 commit comments