public static AwfulDataContext CreateDataContext(string name) { string connectionString = string.Format("{0}/{1}.sdf", DB_CONNECTION_PREFIX, name); AwfulDataContext context = null; context = new AwfulDataContext(connectionString); return context; }
public void Starting() { using (var db = AwfulDataContext.CreateDataContext(TEST_FILENAME)) { if (db.DatabaseExists()) { db.DeleteDatabase(); } db.CreateDatabase(); } using (var db = new AwfulDataContext()) { if (!db.DatabaseExists()) { db.CreateDatabase(); var dao = new AwfulProfileDAO(db); dao.CreateProfile(StaticParameters.TEST_USERNAME, StaticParameters.TEST_PASSWORD, new List<Cookie>()); } } }
public void Started() { var dao = new AwfulProfileDAO(); var testProfile = dao.GetProfileByUsername(StaticParameters.TEST_USERNAME); if (testProfile != null) { AwfulWebRequest.SetCookieJar(testProfile.GetTokensAsCookies()); if (!AwfulWebRequest.CanAuthenticate) { AwfulAuthenticateByBrowser.LoginSuccessful += (o, a) => { dao.SaveAuthenticationCookiesToProfile(testProfile, a.Cookies); dao.Dispose(); }; } } TestContext = AwfulDataContext.CreateDataContext(TEST_FILENAME); }
private AwfulForumsDAO(AwfulDataContext context, bool disposable) { this._context = context; this._isDisposable = disposable; }
public AwfulForumsDAO(AwfulDataContext context) : this(context, false) { }
public void Dispose() { if (this._isDisposable) { this._context.Dispose(); } this._context = null; }
private AwfulProfileDAO(AwfulDataContext context, Boolean isDisposable) { this._context = context; this._isDataContextDisposable = isDisposable; }
public AwfulProfileDAO(AwfulDataContext context) : this(context, false) { }