예제 #1
0
        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);
        }
예제 #2
0
        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();");
        }
예제 #3
0
        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);
        }
예제 #4
0
        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));
        }
예제 #5
0
        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);
        }
예제 #6
0
 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());
     }
 }
예제 #7
0
        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);
            }
        }
예제 #8
0
        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);
            }
        }
예제 #9
0
 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);
            }
        }
예제 #11
0
        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);
            }
        }
예제 #12
0
 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());
 }
예제 #14
0
        public void UpdateById(IDbConnection cn, T item)
        {
            var p = Mapping(item);

            cn.Execute(SqliteHelpers.GetUpdateQuery(_tableName, p), p);
        }
예제 #15
0
        public virtual void Add(IDbConnection cn, T item)
        {
            var parameters = Mapping(item);

            cn.Execute(SqliteHelpers.GetInsertQuery(_tableName, parameters), parameters);
        }
예제 #16
0
        override public void Add(IDbConnection cn, UserGroupActivity userGroupActivity)
        {
            var parameters = Mapping(userGroupActivity);

            cn.Execute(SqliteHelpers.GetInsertQuery(_tableName, parameters, "id"), parameters);
        }