나는 다음과 같은 데이터 구조를 가지고 :TableServiceContext는 ValueObjects를 직렬화하지 않습니다
[DataServiceEntity]
public class User
{
public string RowKey { get; set; }
public string PartitionKey { get; set; }
public DateTime Timestamp { get; set; }
public AddressValueObject Address { get; set; }
}
[DataServiceEntity]
public class AddressValueObject
{
public string City { get; set; }
public string Street { get; set; }
}
가 지금은 사용자 클래스의 새 인스턴스를 생성하고 다음과 같은 방법을 사용하여 윈도우 Azure 테이블 스토리지 에뮬레이터로 지속하려고 해요을 :
void CreateAndSaveNewUser()
{
var userInstance = new User
{
RowKey = "SomeRowKey",
PartitionKey = "SomePartitionKey",
Address = new AddressValueObject
{
City = "SomeCity",
Street = "SomeStreet"
}
};
var tableServiceContext = CloudStorageAccount
.DevelopmentStorageAccount
.CreateCloudTableClient()
.GetDataServiceContext();
tableServiceContext.AddObject("UserTable", userInstance);
tableServiceContext.SaveChanges();
}
이제 AddressValueObject가 올바르게 serialize되지 않는 문제가 있습니다. 저장소에는 AddressValueObject라는 emtpy라는 열 하나만 있습니다.
AddressValueObject_City 및 AddressValueObject_Street에 대한 열을 만들지 않습니다.
내가 뭘 잘못하고 있니? 어떤 속성이 누락 되었습니까?
Azure 테이블 저장소는 참조 된 ValueObjects도 지원합니까 ??
감사합니다.