社区-MyPage.ImageGallery始终为null

时间:2018-11-14 13:57:25

标签: episerver

每当我尝试获取用户myPage时,该myPage的ImageGallery始终为null,因此,我无法添加potrait并更新myPage。下面是我的代码。

Image portraitImage = new Image(null, imageName, String.Empty, author, memoryStream);
portraitImage.Status = EntityStatus.Approved;
// Update the user's my page with the new image
MyPage myPage = (MyPage)MyPageHandler.Instance.GetMyPage(commonUser).CreateWritableClone();
myPage.Portrait = portraitImage;
MyPageHandler.Instance.UpdateMyPage(myPage); 

MyPageHandler.Instance.UpdateMyPage(myPage)总是抛出错误,说myPage.ImageGallery为空。

1 个答案:

答案 0 :(得分:1)

您没有在代码中的任何地方设置#include <stdio.h> #include <string.h> #include <stdbool.h> const char numbered_letters[10][5] = {"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"}; bool startsWith(const char *pre, const char *str) { size_t lenpre = strlen(pre), lenstr = strlen(str); return lenstr < lenpre ? false : strncmp(pre, str, lenpre) == 0; } void isEqual(char input[]) { int i = 0; //input[strlen(input)] = 0; startsWith(input, input); printf("check: %s\n", input); //creating file FILE *fp = fopen("words_alpha.txt", "r"); char str[32]; /* Handles largest possible string in the list which is: dichlorodiphenyltrichloroethane*/ //fseek(fp, 0, SEEK_SET); if (fp == NULL) { printf("Error! No file!\n"); } else { //printf("Enter a number to be converted into a word-list"); //scanf("%s", str); while (!feof(fp)) { fscanf(fp, "%s", str); i = strncmp(input, str, 32); if (i == 0) { printf("HIT: %s \n", input); break; } else { printf(""); } //if (strncmp(str, "hello", 32 ) == 0) { /*if strncmp finds the word and returns true, print */ // printf("%s\n", str); } //printf("%s\n", str); //compareNums(num); } fclose(fp); } void printWordsUtil(int number[], int curr_digit, char output[], int n) { // Base case, if current output word is prepared int i; if (curr_digit == n) { //printf("%s ", output); isEqual(output); return; } // Try all possible characters for current digit in number[] // and recur for remaining digits for (i = 0; i < strlen(numbered_letters[number[curr_digit]]); i++) { output[curr_digit] = numbered_letters[number[curr_digit]][i]; printWordsUtil(number, curr_digit + 1, output, n);/* recursive call */ if (number[curr_digit] == 0 || number[curr_digit] == 1) return; } } // A wrapper over printWordsUtil(). It creates an output array and // calls printWordsUtil() void printWords(int number[], int n) { char result[n + 1]; result[n] = '\0'; printWordsUtil(number, 0, result, n); } //Driver program int main(void) { int number[] = {4, 3, 9}; int n = sizeof(number) / sizeof(number[0]); printWords(number, n); return 0; } 属性。您设置的唯一属性是ImageGallery

Portrait