DynamicDataSourceResolver.RegisterDataProvider Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Infrastructure. Registers a compile-time accessor that returns the raw data object for the
DynamicDataAttribute source named sourceName on
declaringType. The delegate receives the attribute's data-source arguments (empty
for property/field sources) and returns the property/field value or the method's return value.
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static void RegisterDataProvider(Type declaringType, string sourceName, Microsoft.VisualStudio.TestTools.UnitTesting.DynamicDataSourceType sourceType, Func<object?[],object?> dataProvider);
[<System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)>]
static member RegisterDataProvider : Type * string * Microsoft.VisualStudio.TestTools.UnitTesting.DynamicDataSourceType * Func<obj[], obj> -> unit
Public Shared Sub RegisterDataProvider (declaringType As Type, sourceName As String, sourceType As DynamicDataSourceType, dataProvider As Func(Of Object(), Object))
Parameters
- declaringType
- Type
The type declaring the data-source member.
- sourceName
- String
The property, method, or field name that supplies the data.
- sourceType
- DynamicDataSourceType
The DynamicDataSourceType requested by the attribute the accessor was generated for. It is part of the registration key so an accessor generated for one attribute cannot satisfy a different attribute that names the same member with a different (incompatible) source kind.
A delegate that produces the raw data object from the data-source arguments. The last registration
for a given (declaringType, sourceName,
sourceType) tuple wins.
- Attributes
Remarks
Do not call from hand-written code; invoked only from the generator's module initializer.