Bitzsoft.Integrations.Crm 1.0.1

dotnet add package Bitzsoft.Integrations.Crm --version 1.0.1
                    
NuGet\Install-Package Bitzsoft.Integrations.Crm -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bitzsoft.Integrations.Crm" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bitzsoft.Integrations.Crm" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Bitzsoft.Integrations.Crm" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Bitzsoft.Integrations.Crm --version 1.0.1
                    
#r "nuget: Bitzsoft.Integrations.Crm, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Bitzsoft.Integrations.Crm@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Bitzsoft.Integrations.Crm&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Bitzsoft.Integrations.Crm&version=1.0.1
                    
Install as a Cake Tool

Bitzsoft.Integrations.Crm

CRM(客户关系管理)抽象层 — 统一接口定义与基础模型。

屏蔽 HubSpot、Dynamics 365、Salesforce、Zoho、销售易(Xiaoshouyi)等供应商差异,提供一致的联系人(Contact)与商机(Opportunity)管理 API。

功能特性

  • 统一供应商接口 ICrmService:9 个异步方法覆盖联系人与商机全生命周期
  • 统一结果模型CrmResult 携带成功标志与错误信息,CrmContact / CrmOpportunity 统一返回结构
  • 统一异常 CrmException:封装供应商标识、错误码与请求 ID
  • 分页与过滤ListContactsRequest / ListOpportunitiesRequest 提供分页与阶段过滤参数

安装

dotnet add package Bitzsoft.Integrations.Crm
<PackageReference Include="Bitzsoft.Integrations.Crm" Version="1.0.0" />

接口

ICrmService

统一的 CRM 供应商接口。

方法 返回类型 说明
ProviderName string 供应商标识(如 HubSpotDynamics365
CreateContactAsync Task<CrmContact> 创建联系人,返回创建的联系人信息
GetContactAsync Task<CrmContact> 按 ID 查询单个联系人
UpdateContactAsync Task<CrmResult> 更新联系人信息
DeleteContactAsync Task<CrmResult> 按 ID 删除联系人
ListContactsAsync Task<List<CrmContact>> 分页 / 搜索查询联系人列表
CreateOpportunityAsync Task<CrmOpportunity> 创建商机,返回创建的商机信息
ListOpportunitiesAsync Task<List<CrmOpportunity>> 分页 / 按阶段查询商机列表
UpdateOpportunityStageAsync Task<CrmResult> 更新商机阶段

核心模型

关键字段 说明
CreateContactRequest FirstNameLastNameEmailPhoneCompanyTitle 创建联系人请求
UpdateContactRequest ContactIdFirstNameLastNameEmailPhoneCompanyTitle 更新联系人请求(留空表示不修改)
ListContactsRequest SearchPageIndexPageSize 联系人列表查询参数
CrmContact ContactIdFirstNameLastNameEmailPhoneCompanyTitleCreatedAtLastUpdatedAt 联系人信息
CreateOpportunityRequest NameAmountCurrencyStageContactIdExpectedCloseDate 创建商机请求
ListOpportunitiesRequest StagePageIndexPageSize 商机列表查询参数
CrmOpportunity OpportunityIdNameAmountCurrencyStageContactIdExpectedCloseDateCreatedAt 商机信息
CrmResult SuccessErrorMessage 操作结果
CrmException 统一异常(继承 IntegrationException

枚举

枚举 说明
OpportunityStage 商机阶段:Prospecting / Qualification / Proposal / Negotiation / ClosedWon / ClosedLost

使用示例

抽象层本身只定义接口与模型,具体实现由各供应商包提供。以下示例假设已注册某个供应商实现:

public class ContactService(ICrmService crm)
{
    public async Task<string> CreateAsync(string email, string firstName, string lastName)
    {
        var contact = await crm.CreateContactAsync(new CreateContactRequest
        {
            Email = email,
            FirstName = firstName,
            LastName = lastName
        });
        return contact.ContactId;
    }

    public Task<List<CrmContact>> SearchAsync(string keyword)
        => crm.ListContactsAsync(new ListContactsRequest { Search = keyword, PageIndex = 1, PageSize = 20 });
}

多供应商解析

同一应用注册多个供应商时,通过 IIntegrationProviderResolver<ICrmService> 按供应商标识解析:

var resolver = serviceProvider.GetRequiredService<IIntegrationProviderResolver<ICrmService>>();
var hubspot = resolver.GetRequired("HubSpot");
var contact = await hubspot.GetContactAsync(contactId);

依赖

相关包

供应商 包名
统一抽象 Bitzsoft.Integrations.Crm
HubSpot Bitzsoft.Integrations.Crm.HubSpot
Dynamics 365 Bitzsoft.Integrations.Crm.Dynamics365
Salesforce Bitzsoft.Integrations.Crm.Salesforce
Zoho Bitzsoft.Integrations.Crm.Zoho
销售易 Bitzsoft.Integrations.Crm.Xiaoshouyi
聚合包 Bitzsoft.Integrations.Crm.All
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on Bitzsoft.Integrations.Crm:

Package Downloads
Bitzsoft.Integrations.Crm.HubSpot

HubSpot CRM 客户关系管理实现 — Private App Access Token Bearer 鉴权 + HttpClient,实现 ICrmService 统一接口,支持联系人 CRUD/列表、商机创建/列表/阶段更新

Bitzsoft.Integrations.Crm.Dynamics365

Microsoft Dynamics 365 客户关系管理实现 — Azure AD Client Credentials Bearer 鉴权 + HttpClient,实现 ICrmService 统一接口,支持联系人 CRUD/列表、商机创建/列表/阶段更新(Dataverse Web API OData REST)

Bitzsoft.Integrations.Crm.Salesforce

Salesforce Sales Cloud 客户关系管理适配器 — 包装 ISalesforceClient 单体连接器实现 ICrmService 统一接口,支持联系人查询/列表(SOQL),并明确标注联系人写入与商机操作的能力边界

Bitzsoft.Integrations.Crm.Zoho

Zoho CRM 客户关系管理实现 — OAuth2 Bearer Token 鉴权 + HttpClient,实现 ICrmService 统一接口,支持联系人 CRUD/列表、商机创建/列表/阶段更新

Bitzsoft.Integrations.Crm.All

客户关系管理服务聚合包 — 包含全部供应商实现(HubSpot / Dynamics 365 / Zoho / Xiaoshouyi)

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 0 8/3/2026
1.0.0 35 8/2/2026