ServiceManager ServiceManager ServiceManager ServiceManager Class

定义

实现 IServiceProvider,并提供对编辑上下文所提供服务的访问。Implements IServiceProvider and provides access to services offered by the editing context.

public ref class ServiceManager abstract : IServiceProvider, System::Collections::Generic::IEnumerable<Type ^>
public abstract class ServiceManager : IServiceProvider, System.Collections.Generic.IEnumerable<Type>
type ServiceManager = class
    interface IServiceProvider
    interface seq<Type>
    interface IEnumerable
Public MustInherit Class ServiceManager
Implements IEnumerable(Of Type), IServiceProvider
继承
ServiceManagerServiceManagerServiceManagerServiceManager
实现

注解

Services 表示主机提供给设计器使用的功能,或表示设计器用于使功能对编辑器内的所有设计器可用的功能。Services represent functionality that is either provided by the host for the designer to use or that is used by the designer to make functionality available to all designers within the editor. 它是由 EditingContext 属性从 Services 中获取的。It is obtained from the EditingContext by the Services property.

构造函数

ServiceManager() ServiceManager() ServiceManager() ServiceManager()

初始化 ServiceManager 类的新实例。Initializes a new instance of the ServiceManager class.

方法

Contains(Type) Contains(Type) Contains(Type) Contains(Type)

返回一个布尔值,该值指示服务器管理器是否包含给定类型的服务。Returns a Boolean value that indicates whether the service manager contains a service of the given type.

Contains<TServiceType>() Contains<TServiceType>() Contains<TServiceType>() Contains<TServiceType>()

返回一个布尔值,该值指示服务器管理器是否包含给定类型的服务。Returns a Boolean value that indicates whether the service manager contains a service of the given type.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

检索一个枚举器,该枚举器可用于枚举此服务管理器发布的所有服务。Retrieves an enumerator that can be used to enumerate all of the services that this service manager publishes.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetRequiredService<TServiceType>() GetRequiredService<TServiceType>() GetRequiredService<TServiceType>() GetRequiredService<TServiceType>()

检索所请求的服务。Retrieves the requested service.

GetService(Type) GetService(Type) GetService(Type) GetService(Type)

检索所请求的服务。Retrieves the requested service. 如果找不到服务,则此方法返回 nullThis method returns null if the service could not be located.

GetService<TServiceType>() GetService<TServiceType>() GetService<TServiceType>() GetService<TServiceType>()

检索所请求的服务。Retrieves the requested service. 如果找不到服务,则此方法返回 nullThis method returns null if the service could not be located.

GetTarget(Delegate) GetTarget(Delegate) GetTarget(Delegate) GetTarget(Delegate)

一个可返回委托的目标对象的帮助器方法。A helper method that returns the target object for a delegate. 如果创建了委托作为泛型委托的代理,则此方法将正确地返回原始对象,而不是代理。If the delegate was created to proxy a generic delegate, this will correctly return the original object, not the proxy.

GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
Publish(Type, Object) Publish(Type, Object) Publish(Type, Object) Publish(Type, Object)

发布给定的服务。Publishes the given service. 服务发布之后,服务实例将保留在服务管理器中,直至释放编辑上下文为止。After it is published, the service instance remains in the service manager until the editing context is disposed of.

Publish(Type, PublishServiceCallback) Publish(Type, PublishServiceCallback) Publish(Type, PublishServiceCallback) Publish(Type, PublishServiceCallback)

发布指定的服务类型,但不声明实例。Publishes the specified service type, but does not declare an instance. 在请求服务时,将调用 Publish 服务回调来创建实例。When the service is requested, the Publish service callback will be invoked to create the instance. 只会调用该回调一次。The callback is invoked only once. 之后,会将它返回的实例放入缓存。After that, the instance it returned is cached.

Publish<TServiceType>(PublishServiceCallback<TServiceType>) Publish<TServiceType>(PublishServiceCallback<TServiceType>) Publish<TServiceType>(PublishServiceCallback<TServiceType>) Publish<TServiceType>(PublishServiceCallback<TServiceType>)

发布给定的服务类型,但尚未声明实例。Publishes the given service type, but does not declare an instance yet. 当该服务被要求时,将调用 PublishServiceCallback 以创建该服务的实例。When the service is requested, the PublishServiceCallback will be invoked to create the instance. 只会调用该回调一次。The callback is invoked only once. 之后,会将它返回的实例放入缓存。After that, the instance it returned is cached.

Publish<TServiceType>(TServiceType) Publish<TServiceType>(TServiceType) Publish<TServiceType>(TServiceType) Publish<TServiceType>(TServiceType)

发布给定的服务。Publishes the given service. 服务发布之后,服务实例将保留在服务管理器中,直至释放编辑上下文为止。After it is published, the service instance remains in the service manager until the editing context is disposed of.

RemoveCallback(Delegate, Delegate) RemoveCallback(Delegate, Delegate) RemoveCallback(Delegate, Delegate) RemoveCallback(Delegate, Delegate)

一个帮助器方法,该方法执行 Delegate.Remove 操作,并对作为泛型回调代理的委托进行解包。A helper method that performs a Delegate.Remove operation, and unwraps delegates that are proxies to generic callbacks. 您应在 Unsubscribe 实现中使用此方法。You should use this method in your Unsubscribe implementations.

Subscribe(Type, SubscribeServiceCallback) Subscribe(Type, SubscribeServiceCallback) Subscribe(Type, SubscribeServiceCallback) Subscribe(Type, SubscribeServiceCallback)

在某人发布了请求的服务时调用提供的回调。Invokes the provided callback when someone has published the requested service. 如果服务已可用,则此方法将立即调用回调。If the service was already available, this method invokes the callback immediately.

Subscribe<TServiceType>(SubscribeServiceCallback<TServiceType>) Subscribe<TServiceType>(SubscribeServiceCallback<TServiceType>) Subscribe<TServiceType>(SubscribeServiceCallback<TServiceType>) Subscribe<TServiceType>(SubscribeServiceCallback<TServiceType>)

在某人发布了请求的服务时调用提供的回调。Invokes the provided callback when someone has published the requested service. 如果服务已可用,则此方法将立即调用回调。If the service was already available, this method invokes the callback immediately.

ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)
Unsubscribe(Type, SubscribeServiceCallback) Unsubscribe(Type, SubscribeServiceCallback) Unsubscribe(Type, SubscribeServiceCallback) Unsubscribe(Type, SubscribeServiceCallback)

移除服务类型的订阅。Removes a subscription for a service type.

Unsubscribe<TServiceType>(SubscribeServiceCallback<TServiceType>) Unsubscribe<TServiceType>(SubscribeServiceCallback<TServiceType>) Unsubscribe<TServiceType>(SubscribeServiceCallback<TServiceType>) Unsubscribe<TServiceType>(SubscribeServiceCallback<TServiceType>)

移除服务类型的订阅。Removes a subscription for a service type.

显式界面实现

IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

检索一个枚举器,该枚举器可用于枚举此服务管理器发布的所有服务。Retrieves an enumerator that can be used to enumerate all of the services that this service manager publishes.

扩展方法

CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>)

在给定其泛型参数 TDataTable 的输入 DataRow 对象的情况下,返回包含 IEnumerable<T> 对象副本的 DataRowReturns a DataTable that contains copies of the DataRow objects, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption)

在给定其泛型参数 TDataRow 的输入 DataTable 对象的情况下,将 IEnumerable<T> 对象复制到指定的 DataRowCopies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler)

在给定其泛型参数 TDataRow 的输入 DataTable 对象的情况下,将 IEnumerable<T> 对象复制到指定的 DataRowCopies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>)

返回元素集合,其中包含源集合中每个节点的上级。Returns a collection of elements that contains the ancestors of every node in the source collection.

Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName)

返回经过筛选的元素集合,其中包含源集合中每个节点的上级。Returns a filtered collection of elements that contains the ancestors of every node in the source collection. 集合中仅包括具有匹配 XName 的元素。Only elements that have a matching XName are included in the collection.

DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>)

返回源集合中每个文档和元素的子代节点的集合。Returns a collection of the descendant nodes of every document and element in the source collection.

Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>)

返回元素集合,其中包含源集合中每个元素和文档的子代元素。Returns a collection of elements that contains the descendant elements of every element and document in the source collection.

Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName)

返回经过筛选的元素集合,其中包含源集合中每个元素和文档的子代元素。Returns a filtered collection of elements that contains the descendant elements of every element and document in the source collection. 集合中仅包括具有匹配 XName 的元素。Only elements that have a matching XName are included in the collection.

Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>)

返回源集合中每个元素和文档的子元素的集合。Returns a collection of the child elements of every element and document in the source collection.

Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName)

返回源集合中经过筛选的每个元素和文档的子元素集合。Returns a filtered collection of the child elements of every element and document in the source collection. 集合中仅包括具有匹配 XName 的元素。Only elements that have a matching XName are included in the collection.

InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>)

返回节点集合(其中包含源集合中的所有节点),并按文档顺序排列。Returns a collection of nodes that contains all nodes in the source collection, sorted in document order.

Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>)

返回源集合中每个文档和元素的子节点集合。Returns a collection of the child nodes of every document and element in the source collection.

Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>)

将源集合中的每个节点从其父节点中移除。Removes every node in the source collection from its parent node.

适用于