public void Add(IDbConnection cn, int userGetId, Military relative) { var parameters = _mapper.Map <MilitaryDb>(relative); parameters.UserGetId = userGetId; cn.Execute(SqliteHelpers.GetInsertQuery(_tableName, parameters), parameters); }
public override void Add(IDbConnection cn, UserGroups item) { var parameters = Mapping(item); cn.Execute(SqliteHelpers.GetInsertQuery(_tableName, parameters, "id"), parameters); item.id = cn.QuerySingle <int>("SELECT last_insert_rowid();"); }
public void Add(IDbConnection cn, int userGetId, Career career) { var parameters = _mapper.Map <CareerDb>(career); parameters.UserGetId = userGetId; cn.Execute(SqliteHelpers.GetInsertQuery(_tableName, parameters), parameters); }
private GeneralRepo CreateRepo() { var connectionString = $"Data Source={fname};Compress=True;foreign keys=true;DateTimeFormat=Ticks;UTF8Encoding=True;FailIfMissing=False;"; SqliteHelpers.EnsureCreated(connectionString); return(new GeneralRepo(connectionString)); }
public void Add(IDbConnection cn, int userGetId, WallPost wallPost) { var parameters = _mapper.Map <WallPostDb>(wallPost); parameters.UserGetId = userGetId; cn.Execute(SqliteHelpers.GetInsertQuery(_tableName, parameters, "id"), parameters); }
private void setDataGridViewPKs() { if (Utils.IsDbEmbedded(GetServer().db_type)) { sqlbox.commons.DbType type = Utils._convert(GetServer().db_type); if (type == sqlbox.commons.DbType.SQLITE) { dataGridViewPKs.DataSource = SqliteHelpers.GetDatabasePrimaryKeysDataSource(GetServer(), GetSqlConnection()); } } else { dataGridViewPKs.DataSource = DbDataHelper.getDataTableData(GetSqlConnection(), new SqlBuilderFactory(GetServer()).Create(GetSqlConnection().Database).getDatabasePrimaryKeys()); } }
public void Add_FindById() { var repo = this.CreateRepo(); var stub = _fixture.Create <Country>(); using (var cn = SqliteHelpers.CreateAndOpenConnection(connectionString)) { repo.Add(cn, stub); } using (var cn = SqliteHelpers.CreateAndOpenConnection(connectionString)) { var stored = repo.FindById(cn, stub.id); stored.ShouldBeEquivalentTo(stub); } }
public void Add_FindById() { var repo = this.CreateRepo(); var stub = _fixture.Create <Relative>(); using (var cn = SqliteHelpers.CreateAndOpenConnection(connectionString)) { repo.Add(cn, 123, stub); } using (var cn = SqliteHelpers.CreateAndOpenConnection(connectionString)) { var stored = repo.FindAll(cn).First(); stored.id = stub.id; stored.ShouldBeEquivalentTo(stub); } }
public override void Load() { Bind <ILogger>().ToConstant(LogHelper.InitLog()); Bind <IProxyProvider>().To <ProxyProvider>().InSingletonScope().WithConstructorArgument("fineproxyUrl", Config.Default.FineproxyUrl); Bind <UnitsProvider>().ToSelf().InSingletonScope().WithConstructorArgument("vkKeys", Config.Default.VkKeys.Cast <string>().ToArray()).WithConstructorArgument("userAgents", Config.Default.UserAgents.Cast <string>().ToArray()); Bind <GeneralRepo>().ToMethod(z => { var connectionString = $"Data Source={Config.Default.DBPath};Compress=True;foreign keys=false;DateTimeFormat=Ticks;UTF8Encoding=True;FailIfMissing=False;"; if (!File.Exists(Config.Default.DBPath)) { SqliteHelpers.EnsureCreated(connectionString); } return(new GeneralRepo(connectionString)); }); Bind <IHandleMessages <MessageExtractWallPostsCommand> >().To <HandleExtractWallPostsCommand>(); Bind <IHandleMessages <MessageWallPostLikesRepostsComments> >().To <HandleMessageWallPostLikesRepostsComments>(); Bind <IHandleMessages <MessageUserGet> >().To <HandleMessageUserGet>(); }
public void Add3_Get3() { var repo = this.CreateRepo(); using (var cn = SqliteHelpers.CreateAndOpenConnection(connectionString)) { for (int i = 0; i < 3; i++) { var stub = _fixture.Create <FriendsFollowersSubscriptions>(); repo.Add(cn, stub); } } using (var cn = SqliteHelpers.CreateAndOpenConnection(connectionString)) { var stored = repo.FindAll(cn); stored.Should().HaveCount(3); } }
public void Add() { var repo = Create(); var userget = _fixture.Build <UserGet>() .With(z => z.Friends, new List <UserGet>()) .With(z => z.Subscriptions, new List <UserGet>()) .With(z => z.Followers, new List <UserGet>()) .With(z => z.Groups, new List <GroupData>()) .Create(); var id = userget.id; using (var cn = SqliteHelpers.CreateAndOpenConnection(connectionString)) { repo.Add(cn, userget); } using (var cn = SqliteHelpers.CreateAndOpenConnection(connectionString)) { var stored = repo.FindById(cn, userget.id); stored.ShouldBeEquivalentTo(userget); } }
public override IQueryBuilder <TDatabase> GetQueryBuilder <TDatabase>() => SqliteHelpers.GetQueryBuilder <TDatabase>();
private FriendsFollowersSubscriptionsRepo CreateRepo() { connectionString = $"Data Source={fname};Compress=True;foreign keys=false;DateTimeFormat=Ticks;UTF8Encoding=True;FailIfMissing=False;"; SqliteHelpers.EnsureCreated(connectionString); return(new FriendsFollowersSubscriptionsRepo()); }
public void UpdateById(IDbConnection cn, T item) { var p = Mapping(item); cn.Execute(SqliteHelpers.GetUpdateQuery(_tableName, p), p); }
public virtual void Add(IDbConnection cn, T item) { var parameters = Mapping(item); cn.Execute(SqliteHelpers.GetInsertQuery(_tableName, parameters), parameters); }
override public void Add(IDbConnection cn, UserGroupActivity userGroupActivity) { var parameters = Mapping(userGroupActivity); cn.Execute(SqliteHelpers.GetInsertQuery(_tableName, parameters, "id"), parameters); }