IronPython을 다양한 작업을 수행하는 스크립팅 엔진으로 사용하는 프로젝트가 있습니다. 이러한 작업 중 하나는 Azure 테이블 저장소에서 테이블 조회를 수행해야하지만 테이블 레이아웃은 다르고 자주 변경되므로 모델 클래스를 Python으로 정의해야합니다.IronPython의 Azure 테이블 저장소 쿼리
여기에 내가 겪고있는 문제는 쿼리를 실행할 때마다 내 프로젝트의 기본 클래스가 클라이언트 라이브러리에서 지원되지 않는다는 것입니다.
Unhandled Exception: System.InvalidOperationException: The type 'IronPython.NewTypes.IPTest.BaseModelClass_1$1' is not supported by the client library.
파이썬 코드 :
import clr
import System
clr.AddReference("System.Core")
clr.ImportExtensions(System.Linq)
class MyTable(AzureTableService.BaseModelClass):
def __new__(self, partitionKey, rowKey):
self.PartitionKey = partitionKey
self.RowKey = rowKey
return super.__new__(self)
MyTableDetails = "";
#I can manually create an entity, and it recognizes the base class, but not when I try to return from a query
#working = MyTable("10", "10040")
#print working.PartitionKey
y = AzureTableService.GetAzureTableQuery[MyTable]("MyTable")
z = y.Where(lambda c: c.PartitionKey == "10" and c.RowKey == "10040")
print(z.Single())
C# 코드 : 내가 부족 분명 아무것도
public class AzureTableService {
private CloudStorageAccount mStorageAccount;
public AzureTableService() {
CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) => {
var connectionString = ConfigurationManager.AppSettings[configName];
configSetter(connectionString);
});
mStorageAccount = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");
}
private TableServiceContext AzureTableServiceContext {
get {
var context = mStorageAccount.CreateCloudTableClient().GetDataServiceContext();
context.IgnoreResourceNotFoundException = true;
return context;
}
}
public IQueryable<T> GetAzureTableQuery<T>(string TableName) {
return AzureTableServiceContext.CreateQuery<T>(TableName);
}
public class BaseModelClass : TableServiceEntity {
public BaseModelClass(string partitionKey, string rowKey) : base(partitionKey, rowKey) { }
public BaseModelClass() : base(Guid.NewGuid().ToString(), String.Empty) { }
}
}
있습니까? 내 주석이 달린 코드에서는 수동으로 만들 때 기본 클래스 속성을 인식하는 것으로 보이지만 쿼리에서 반환 할 때는 기본 클래스 속성을 인식하지 못합니다.