ModelExplorer Class¶
Associates a model object with it’s corresponding Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata
.
- Namespace
Microsoft.AspNetCore.Mvc.ViewFeatures
- Assemblies
- Microsoft.AspNetCore.Mvc.ViewFeatures
Syntax¶
[DebuggerDisplay("DeclaredType={Metadata.ModelType.Name} PropertyName={Metadata.PropertyName}")]
public class ModelExplorer
-
class
Microsoft.AspNetCore.Mvc.ViewFeatures.
ModelExplorer
Constructors¶
-
ModelExplorer
(Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider, Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata, System.Object)¶ Creates a new
Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer
.Arguments: - metadataProvider (Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider) – The
Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider
. - metadata (Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata) – The
Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata
. - model (System.Object) – The model object. May be <code>null</code>.
public ModelExplorer(IModelMetadataProvider metadataProvider, ModelMetadata metadata, object model)
- metadataProvider (Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider) – The
-
ModelExplorer
(Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider, Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer, Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata, System.Func<System.Object, System.Object>) Creates a new
Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer
.Arguments: - metadataProvider (Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider) – The
Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider
. - container (Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer) – The container
Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer
. - metadata (Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata) – The
Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata
. - modelAccessor (System.Func<System.Object>) – A model accessor function..
public ModelExplorer(IModelMetadataProvider metadataProvider, ModelExplorer container, ModelMetadata metadata, Func<object, object> modelAccessor)
- metadataProvider (Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider) – The
-
ModelExplorer
(Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider, Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer, Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata, System.Object) Creates a new
Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer
.Arguments: - metadataProvider (Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider) – The
Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider
. - container (Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer) – The container
Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer
. - metadata (Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata) – The
Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata
. - model (System.Object) – The model object. May be <code>null</code>.
public ModelExplorer(IModelMetadataProvider metadataProvider, ModelExplorer container, ModelMetadata metadata, object model)
- metadataProvider (Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider) – The
-
Properties¶
-
Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer.
Container
¶ Gets the container
Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer
.Return type: Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer public ModelExplorer Container { get; }
-
Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer.
Metadata
¶ Gets the
Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata
.Return type: Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata public ModelMetadata Metadata { get; }
-
Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer.
Model
¶ Gets the model object.
Return type: System.Object public object Model { get; }
-
Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer.
ModelType
¶ Return type: System.Type public Type ModelType { get; }
-
Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer.
Properties
¶ Gets the properties.
Return type: System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer> public IEnumerable<ModelExplorer> Properties { get; }
-
Methods¶
-
GetExplorerForExpression
(Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata, System.Func<System.Object, System.Object>)¶ Gets a
Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer
for the provided model value and modelSystem.Type
.Arguments: - metadata (Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata) – The
Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata
associated with the model. - modelAccessor (System.Func<System.Object>) – A model accessor function.
Return type: Returns: public ModelExplorer GetExplorerForExpression(ModelMetadata metadata, Func<object, object> modelAccessor)
- metadata (Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata) – The
-
GetExplorerForExpression
(Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata, System.Object) Gets a
Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer
for the provided model value and modelSystem.Type
.Arguments: - metadata (Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata) – The
Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata
associated with the model. - model (System.Object) – The model value.
Return type: Returns: public ModelExplorer GetExplorerForExpression(ModelMetadata metadata, object model)
- metadata (Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata) – The
-
GetExplorerForExpression
(System.Type, System.Func<System.Object, System.Object>) Gets a
Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer
for the provided model value and modelSystem.Type
.Arguments: - modelType (System.Type) – The model
System.Type
. - modelAccessor (System.Func<System.Object>) – A model accessor function.
Return type: Returns: public ModelExplorer GetExplorerForExpression(Type modelType, Func<object, object> modelAccessor)
- modelType (System.Type) – The model
-
GetExplorerForExpression
(System.Type, System.Object) Gets a
Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer
for the provided model value and modelSystem.Type
.Arguments: - modelType (System.Type) – The model
System.Type
. - model (System.Object) – The model value.
Return type: Returns: public ModelExplorer GetExplorerForExpression(Type modelType, object model)
- modelType (System.Type) – The model
-
GetExplorerForModel
(System.Object)¶ Gets a
Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer
for the given <em>model</em> value.Arguments: model (System.Object) – The model value. Return type: Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer Returns: A Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer
.public ModelExplorer GetExplorerForModel(object model)
-
GetExplorerForProperty
(System.String)¶ Gets a
Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer
for the property with given <em>name</em>, or <code>null</code> if the property cannot be found.Arguments: name (System.String) – The property name. Return type: Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer Returns: A Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer
, or <code>null</code>.public ModelExplorer GetExplorerForProperty(string name)
-
GetExplorerForProperty
(System.String, System.Func<System.Object, System.Object>) Gets a
Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer
for the property with given <em>name</em>, or <code>null</code> if the property cannot be found.Arguments: - name (System.String) – The property name.
- modelAccessor (System.Func<System.Object>) – An accessor for the model value.
Return type: Returns: A
Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer
, or <code>null</code>.public ModelExplorer GetExplorerForProperty(string name, Func<object, object> modelAccessor)
-
GetExplorerForProperty
(System.String, System.Object) Gets a
Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer
for the property with given <em>name</em>, or <code>null</code> if the property cannot be found.Arguments: - name (System.String) – The property name.
- model (System.Object) – The model value.
Return type: Returns: A
Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer
, or <code>null</code>.public ModelExplorer GetExplorerForProperty(string name, object model)
-