0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SQLiteとSystem.Data.Linq.Mappingで自動インクリメント

Last updated at Posted at 2017-02-08

C#のSystem.Data.Linq.MappingでSQLiteを操作しようとして右往左往したのでメモ

INTEGER PRIMARY KEY AUTOINCREMENT

生のSQLを実行する場合は、AUTOINCREMENTを付けてないと自動インクリメントされない。

Linq

C#のSystem.Data.Linq.Mappingで自動インクリメントさせたい場合は、DB側でAUTOINCREMENTを外して、C#側でIsDbGenerated = trueを外して型をNullableにする。

参考

c# - Error using System.Data.Linq.Mapping and auto incrementing the primary key in a sqlite db - Stack Overflow:

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?