Beispiel #1
0
        public T Update <T>(T entity) where T : class
        {
            var mapper = new Mapper(Session);

            mapper.Update(entity);
            return(entity);
        }
        public void UpdateStreamPost(PostDTO post, List <long> UsersIds)
        {
            using (ISession session = _cluster.Connect(_keyspace))
            {
                Cassandra.Mapping.IMapper mapper = new Cassandra.Mapping.Mapper(session);

                session.UserDefinedTypes.Define(new CommentProfile().Definitions);
                foreach (var user in UsersIds)
                {
                    mapper.Update <StreamDTO>("SET \"Likes\" =? ," +
                                              "\"Dislikes\" =?," +
                                              "\"Comments\"=?," +
                                              "\"Modify_Date\" = ?" +
                                              "where \"User_Id\" = ? and \"Post_Id\" = ? ", post.Likes, post.Dislikes, post.Comments, post.Modify_Date, user, post.Post_Id);
                }
            }
        }