Skip to content

BulkForceClient on nuget #246

Closed
Closed

Description

@avesse

We've got the latest version of the nuget package installed (1.3.2) but can't find the BulkForceClient in there. Is the nuget package out of date?

Activity

  1. avesse commented on Mar 7, 2017

    @avesse
    ContributorAuthor

    (Also couldn't find it with a search in the repo, so not sure what code the readme is referring to...?)

  2. mp3tobi commented on Mar 20, 2017

    @mp3tobi

    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. :(

  3. rdev5 commented on Apr 14, 2017

    @rdev5

    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 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");
    }
    

    Will keep you posted on how it goes :)

  4. rdev5 commented on Apr 14, 2017

    @rdev5

    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.cs here so this new BulkForceClient class could pass it its own instance of UpsertJobInfo containing the new externalIdFieldName field.

    PR submitted: #248

  5. cemerson commented on May 2, 2018

    @cemerson

    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.

  6. wadewegner commented on Aug 17, 2018

    @wadewegner
    Owner

    If this is still an issue (see latest updates to code) please re-open with more specifics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions