3
創建表我研究的SQLite。
我已經拿出了幾個問題:與SQLite的網庫
的表每模型創建,然後以創建此代碼應使用表:
var db = new SQLiteConnection("foofoo"); db.CreateTable<Stock>(); db.CreateTable<Valuation>();
問題是,在MVVM方法中,這是寫在哪裏的? 我想過bootstrapper.cs,但我不太確定它的效果如何。
在其中一個例子,這是一個特定模型的示例代碼:
public class Valuation { [PrimaryKey, AutoIncrement] public int Id { get; set; } [Indexed] public int StockId { get; set; } public DateTime Time { get; set; } public decimal Price { get; set; } }
是否
[Indexed]
聲明適用ONLY到StockId
,或所有三個StockId
,Time
和Price
?
屬性(這是'[Indexed]'是)只適用於一個屬性。 – 2013-05-14 09:02:05