Azure 저장소 테이블에 C# 개체를 저장할 때 개인 설정 도구를 사용하는 속성은 무시됩니다. setter를 공개하지 않고 테이블에 이러한 속성을 쓸 수 있습니까?개인 설정 도구를 사용하여 Azure 테이블에 POCO 저장
Json.net은 JsonProperty 속성을 통해이 기능을 제공합니다. 스토리지 테이블에 사용할 수있는 속성이 있습니까? 내가 찾을 수있는 유일한 속성은 속성을 무시하는 데 사용되는 IgnorePropertyAttribute입니다.
class TestEntity : TableEntity
{
public TestEntity(string property1, string property2)
{
this.Property1 = property1;
this.Property2 = property2;
}
public string Property1 { get; set; }
public string Property2 { get; private set; }
}
TestEntity testEntity = new TestEntity("Value1", "Value2");
testEntity.PartitionKey = "PartitionKey";
testEntity.RowKey = "RowKey";
TableOperation insertOperation = TableOperation.Insert(testEntity);
table.Execute(insertOperation);
위의 예제에서는 Property1 (Value1) 만 테이블에 저장됩니다. Property2 값은 저장되지 않습니다. setter를 public으로 변경하기 위해이를 저장하는 유일한 방법.
그것은 좋지 않을까 - [mcve]를. – mjwills
이 문제를 보여주는 예제 코드를 추가했습니다. – mtcup
[Azure 테이블 스토리지에 임의의 키 값 쌍을 저장할 수 있습니까?] (https://stackoverflow.com/questions/14595486/how-can-i-store-arbitrary-key-value-pairs-in- azure-table-storage) 거기에 대한 답을 참조하여 Property2를 WriteEntity() 및 ReadEntity() 메소드에 추가하십시오. –