You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm essentially creating a class derived from ForceClient as a base class, "hiding" methods in base that I'm re-implementing using the new keyword and adding overloads to my own custom IBulkForceClient interface.
Example:
/// <summary>
/// Original JobInfo class extended to support creation of bulk upserts
///
/// Related:
/// - https://salesforce.stackexchange.com/a/14745
/// </summary>
[XmlRoot(Namespace = "http://www.force.com/2009/06/asyncapi/dataload",
ElementName = "jobInfo",
IsNullable = false)]
private class UpsertJobInfo
{
[XmlElement(ElementName = "operation")]
public string Operation { get; set; }
[XmlElement(ElementName = "object")]
public string Object { get; set; }
[XmlElement(ElementName = "externalIdFieldName")]
public string ExternalField { get; set; }
[XmlElement(ElementName = "contentType")]
public string ContentType { get; set; }
}
public async Task<JobInfoResult> CreateUpsertJobAsync(string objectName, string externalField, BulkConstants.OperationType operationType)
{
if (string.IsNullOrEmpty(objectName)) throw new ArgumentNullException("objectName");
var jobInfo = new UpsertJobInfo
{
ContentType = "XML",
Object = objectName,
ExternalField = externalField,
Operation = operationType.Value()
};
return await _xmlHttpClient.HttpPostAsync<JobInfoResult>(jobInfo, "/services/async/{0}/job");
}
For now at least...I'm able to create batch upsert jobs, specifying which field will be my externalIdFieldName.
The primary "enabler" for being able to create this was to expose _xmlHttpClient and _jsonHttpClient as protected in ForceClient.cshere so this new BulkForceClient class could pass it its own instance of UpsertJobInfo containing the new externalIdFieldName field.
Are we sure BulkConstants is in 1.4.0-beta? I've got that installed in my project but can't find/use BulkConstants, CreateJobAsync etc. However if I clone the latest master branch from github and reference it that way in my project i DO see it. Unfortunately for some reason when I reference the full code/branch this way my web app hangs on any Salesforce connection then so I can't use this method for now. Which is why I'm trying to find out how/if we can get BulkConstants via nuget right now or not.
Activity
avesse commentedon Mar 7, 2017
(Also couldn't find it with a search in the repo, so not sure what code the readme is referring to...?)
mp3tobi commentedon Mar 20, 2017
It's at the moment only a beta version: https://www.nuget.org/packages/DeveloperForce.Force/1.4.0-beta
But I don't know how to install this beta via nuget. :(
rdev5 commentedon Apr 14, 2017
I'm in the process of writing my own BulkForceClient as well.
Seems to be unimplemented in ForceToolkitForNet at this time as their JobInfo class only contains a fraction of what the actual documentation specifies: https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/asynch_api_reference_jobinfo.htm
I'm essentially creating a class derived from ForceClient as a base class, "hiding" methods in base that I'm re-implementing using the
newkeyword and adding overloads to my own custom IBulkForceClient interface.Example:
Will keep you posted on how it goes :)
rdev5 commentedon Apr 14, 2017
For now at least...I'm able to create batch upsert jobs, specifying which field will be my
externalIdFieldName.The primary "enabler" for being able to create this was to expose
_xmlHttpClientand_jsonHttpClientasprotectedinForceClient.cshere so this newBulkForceClientclass could pass it its own instance ofUpsertJobInfocontaining the newexternalIdFieldNamefield.PR submitted: #248
cemerson commentedon May 2, 2018
Are we sure BulkConstants is in 1.4.0-beta? I've got that installed in my project but can't find/use BulkConstants, CreateJobAsync etc. However if I clone the latest master branch from github and reference it that way in my project i DO see it. Unfortunately for some reason when I reference the full code/branch this way my web app hangs on any Salesforce connection then so I can't use this method for now. Which is why I'm trying to find out how/if we can get BulkConstants via nuget right now or not.
wadewegner commentedon Aug 17, 2018
If this is still an issue (see latest updates to code) please re-open with more specifics.