你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
FabricRuntime.RegisterServiceType(String, Type) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将指定的 serviceTypeName
与实现它的实际托管类型相关联。
public void RegisterServiceType (string serviceTypeName, Type serviceTypeImplementation);
member this.RegisterServiceType : string * Type -> unit
Public Sub RegisterServiceType (serviceTypeName As String, serviceTypeImplementation As Type)
参数
- serviceTypeName
- String
服务类型的类型名称 (为字符串) 。 这应与清单和/或 CreateService 命令中指定的服务组类型的类型匹配。
- serviceTypeImplementation
- Type
实现指定 serviceTypeName
的限定服务类型。
注解
请注意,此服务类型注册机制不需要在注册时提供自定义 IStatelessServiceFactory 或 IStatefulServiceFactory 。 Service Fabric 将在运行时生成一个并自动利用它。 如果需要工厂的自定义实现,可以实现 IStatelessServiceFactory 或 IStatefulServiceFactory ,然后通过相应的工厂注册方法提供这些 (RegisterStatelessServiceFactoryAsync(String, IStatelessServiceFactory, TimeSpan, CancellationToken) 或 RegisterStatefulServiceFactoryAsync(String, IStatefulServiceFactory, TimeSpan, CancellationToken))
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈