Bitzsoft.Integrations.Crm.Salesforce
1.0.1
dotnet add package Bitzsoft.Integrations.Crm.Salesforce --version 1.0.1
NuGet\Install-Package Bitzsoft.Integrations.Crm.Salesforce -Version 1.0.1
<PackageReference Include="Bitzsoft.Integrations.Crm.Salesforce" Version="1.0.1" />
<PackageVersion Include="Bitzsoft.Integrations.Crm.Salesforce" Version="1.0.1" />
<PackageReference Include="Bitzsoft.Integrations.Crm.Salesforce" />
paket add Bitzsoft.Integrations.Crm.Salesforce --version 1.0.1
#r "nuget: Bitzsoft.Integrations.Crm.Salesforce, 1.0.1"
#:package Bitzsoft.Integrations.Crm.Salesforce@1.0.1
#addin nuget:?package=Bitzsoft.Integrations.Crm.Salesforce&version=1.0.1
#tool nuget:?package=Bitzsoft.Integrations.Crm.Salesforce&version=1.0.1
Bitzsoft.Integrations.Crm.Salesforce
Salesforce Sales Cloud 客户关系管理适配器,包装 Salesforce 单体连接器
(Bitzsoft.Integrations.Salesforce)暴露的
ISalesforceClient,把它适配到统一的 ICrmService 抽象,
使 Salesforce 能通过 IIntegrationProviderResolver<ICrmService> 以 salesforce provider ID 解析。
设计定位
这是一个适配器(Adapter),不是新的连接器:
- Salesforce 单体连接器已是成熟实现,提供多租户 JWT 鉴权、SOQL 查询、Account/Contact 读取、Account External ID 幂等写入与可恢复同步。
- 本适配器只负责把单体的读取能力翻译成
ICrmService的联系人查询/列表语义, 不重复实现鉴权、transport、token 刷新或同步。 - DI 注册时 不会重新注册
ISalesforceClient;它由单体自身的AddBitzsoftSalesforce扩展提供。
功能矩阵
ICrmService 方法 |
支持情况 | 映射到 |
|---|---|---|
GetContactAsync |
支持 | ISalesforceClient.QueryContactsAsync / QueryMoreContactsAsync,逐页扫描按 Id 定位 |
ListContactsAsync |
支持 | QueryContactsAsync / QueryMoreContactsAsync,客户端关键词过滤 + CRM 分页 |
CreateContactAsync |
不支持 | Salesforce 单体未暴露 Contact 写入 API → 抛 CrmException |
UpdateContactAsync |
不支持 | 同上 → 抛 CrmException |
DeleteContactAsync |
不支持 | 同上 → 抛 CrmException |
CreateOpportunityAsync |
不支持 | Salesforce 单体未暴露 Opportunity 对象 → 抛 CrmException |
ListOpportunitiesAsync |
不支持 | 同上 → 抛 CrmException |
UpdateOpportunityStageAsync |
不支持 | 同上 → 抛 CrmException |
能力边界由 Salesforce 单体的
SalesforceProviderDescriptor.Limitations决定:单体刻意只暴露 Business Account / Contact 的受控读取与 Account External ID upsert,不暴露任意 SOQL、Contact 写入、Opportunity、Lead 或 Person Account 语义。本适配器如实暴露这些边界,而非静默退化。ProviderName返回"Salesforce"。
安装
dotnet add package Bitzsoft.Integrations.Crm.Salesforce
配置
{
"Crm": {
"Salesforce": {
"DefaultTenantId": "tenant-001",
"DefaultCredentialName": "salesforce-jwt",
"DefaultRegion": null,
"QueryBatchSize": 500
}
}
}
| 选项 | 说明 |
|---|---|
DefaultTenantId |
当未建立 IIntegrationContextAccessor 作用域时使用的默认租户标识 |
DefaultCredentialName |
指向 Salesforce 单体凭据解析器中的凭据条目名 |
DefaultRegion / DefaultEnvironment / DefaultProfileId |
可选的请求上下文默认值 |
QueryBatchSize |
SOQL 查询批量大小(200–2000,缺省 500) |
注册服务
// 1. 先注册 Salesforce 单体(提供 ISalesforceClient、transport、JWT 鉴权)
services.AddBitzsoftSalesforce(endpointProfile);
// 2. 再注册 CRM 适配器(把 ISalesforceClient 适配为 ICrmService)
services.AddSalesforceCrm(configuration);
// 或单独注册
services.AddSalesforceCrm(options =>
{
options.DefaultTenantId = "tenant-001";
options.DefaultCredentialName = "salesforce-jwt";
});
注册后,salesforce 即可作为 provider ID 通过 IIntegrationProviderResolver<ICrmService> 解析:
var crm = resolver.GetRequired("salesforce"); // SalesforceCrmAdapter
使用示例
public class ContactDirectory
{
private readonly ICrmService _crm;
public ContactDirectory(IIntegrationProviderResolver<ICrmService> resolver)
=> _crm = resolver.GetRequired("salesforce");
public Task<List<CrmContact>> SearchAsync(string keyword)
=> _crm.ListContactsAsync(new ListContactsRequest { Search = keyword, PageSize = 50 });
}
依赖
| 包 | 说明 |
|---|---|
| Bitzsoft.Integrations.Crm | 客户关系管理服务抽象层(ICrmService、DTO) |
| Bitzsoft.Integrations.Salesforce | Salesforce 单体连接器(ISalesforceClient) |
| Bitzsoft.Integrations.Core | 公共基座(Provider 能力目录、上下文) |
| Bitzsoft.Integrations.Compatibility | 多 TFM 兼容工具 |
| Bitzsoft.Integrations.RequestLogging | 出站请求审计日志(透传) |
相关包
| 供应商 | 包名 |
|---|---|
| 统一抽象 | 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 |
| 基础工具库 | Bitzsoft.Integrations.Core |
| Product | Versions 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. |
-
net10.0
- Bitzsoft.Integrations.Compatibility (>= 1.0.1)
- Bitzsoft.Integrations.Core (>= 1.0.1)
- Bitzsoft.Integrations.Crm (>= 1.0.1)
- Bitzsoft.Integrations.RequestLogging (>= 1.0.1)
- Bitzsoft.Integrations.Salesforce (>= 1.0.1)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.10)
-
net5.0
- Bitzsoft.Integrations.Compatibility (>= 1.0.1)
- Bitzsoft.Integrations.Core (>= 1.0.1)
- Bitzsoft.Integrations.Crm (>= 1.0.1)
- Bitzsoft.Integrations.RequestLogging (>= 1.0.1)
- Bitzsoft.Integrations.Salesforce (>= 1.0.1)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 5.0.0)
-
net8.0
- Bitzsoft.Integrations.Compatibility (>= 1.0.1)
- Bitzsoft.Integrations.Core (>= 1.0.1)
- Bitzsoft.Integrations.Crm (>= 1.0.1)
- Bitzsoft.Integrations.RequestLogging (>= 1.0.1)
- Bitzsoft.Integrations.Salesforce (>= 1.0.1)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.10)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.