我正在尝试使用 QuickBooks .NET REST API v2 库创建客户。在调用 dataservice 对象的 Add() 方法提交请求时,我收到一条我不理解的错误消息:
"EntityManager must be access within a transaction"
谷歌搜索错误消息会发现一些关于 Java 的点击,但没有一个看起来像他们真正解决了这个问题,我也没有在 Intuit-Partner-Platform 文档中找到任何关于该消息的文档。
using Intuit.Ipp.Data.Qbd;
OAuthRequestValidator oauthValidator = new OAuthRequestValidator(accessToken, accessTokenSecret, Constants.CONSUMER_KEY, Constants.CONSUMER_SECRET);
ServiceContext context = new ServiceContext(oauthValidator, Constants.APP_TOKEN, realmID, IntuitServicesType.QBD);
DataServices dataServices = new DataServices(context);
var writeCust = new Customer()
{
Name = "Carlos Verdona",
TypeOf = partyType.Person,
Address = new PhysicalAddress[]
{
new PhysicalAddress()
{
Line1 = "217 Tarboro Highway",
Line2 = "Apt. D",
City = "Langleyville",
CountrySubDivisionCode = "NC",
PostalCode = "55712",
Tag = new string[]{"Billing"}
}
},
Phone = new TelephoneNumber[]
{
new TelephoneNumber()
{
DeviceType = "Work",
FreeFormNumber = "111-345-3456"
},
new TelephoneNumber()
{
DeviceType = "Mobile",
FreeFormNumber = "111-345-3457"
}
},
WebSite = new WebSiteAddress[]
{
new WebSiteAddress()
{
URI = "http://www.HorseBrains.com"
}
},
Email = new EmailAddress[]
{
new EmailAddress()
{
Address = "CVerdona@HorseBrains.com"
}
},
GivenName = "",
MiddleName = "",
FamilyName = "",
DBAName = "",
ShowAs = "Carlos Verdona",
//CustomField = new CustomField[]
//{
// new BooleanTypeCustomField()
// {
// DefinitionId = "Bill With Parent",
// Value = true
// },
// new StringTypeCustomField()
// {
// DefinitionId = "Preferred Delivery Method",
// Value = "PRINT"
// }
//},
SalesTermId = new IdType() {idDomain = idDomainEnum.QBO, Value = "8" },
};
//Create Customer
Customer output = dataServices.Add(writeCust);
感谢您提供的任何建议!