私は最近、流暢なnhibernate &、特に永続性仕様テストを行っています。流暢なnhibernateマッピングを使った永続性仕様テスト
しかし、この行のテスト用のスキーマ(SessionSource.BuildSchema(Session))を構築するときは、nunitを使用した比較的単純なテストを実行している間、sql liteエラーが発生します。
System.Data.SQLite.SQLiteException:SQLiteのエラーの近くに「/」:構文エラー
私は流暢に比較的新しいですと私が間違っているのかにいくつかのいくつかのガイダンスを探しています。このエラーメッセージのトラブルシューティングを簡単に行う方法はありますか?
public class Contact
{
public int Id { get; protected set; }
// some other properties
public IList<Note> Notes { get; set; }
}
public ContactMapping()
{
Not.LazyLoad();
Id(m => m.Id).GeneratedBy.Identity();
HasMany(x => x.Notes).KeyColumns.Add("ContactId");
}
public class Note
{
public int Id { get; protected set; }
public Contact Contact { get; set; }
public string Title { get; set; }
public string Description { get; set; }
}
public NoteMapping()
{
Not.LazyLoad();
Id(m => m.Id).GeneratedBy.Identity();
Map(m => m.Title).Not.Nullable().Length(250);
Map(m => m.Description).Not.Nullable().Length(2500);
References(x => x.Contact).Column("ContactId").Cascade.All();
}
設定:
public void SetupContext()
{
var cfg = Fluently.Configure()
.Database(SQLiteConfiguration.Standard
.ShowSql()
.InMemory
);
SessionSource = new SessionSource(cfg.BuildConfiguration()
.Properties, PersistenceModel());
Session = SessionSource.CreateSession();
SessionSource.BuildSchema(Session);
}
private static PersistenceModel PersistenceModel()
{
var model = new PersistenceModel();
model.AddMappingsFromAssembly(typeof(Contact).Assembly);
return model;
}
そして最後に持続性テスト:
new PersistenceSpecification<Contact>(Session)
.CheckProperty(c => c.Id, 1)
.CheckProperty(c => c.First, "Coding")
.CheckProperty(c => c.Last, "Quiz")
.CheckProperty(c => c.Email, "[email protected]")
.CheckReference(c => c.Notes, new Note { Title = "Title", Description = "Description" })
.VerifyTheMappings();
ありがとうコール、心に留めておきます。しかし、私の問題は、この行のアクションテストを実行する前に何らかの理由でスキーマの生成が失敗しているようです:SessionSource.BuildSchema(Session) – Jesse