/// <summary> /// Create a new instance of the <see cref="ModelMetadataWrapper"/>. /// </summary> /// <param name="modelMetadata">The <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata"/>.</param> /// <param name="modelMetadataWrapperProvider">The <see cref="IModelMetadataWrapperProvider"/>.</param> public ModelMetadataWrapper(ModelMetadata modelMetadata, IModelMetadataWrapperProvider modelMetadataWrapperProvider) { this.ModelMetadata = modelMetadata; this.ModelTypeId = ModelType.GetTypeId(); modelMetadataWrapperProvider.RegisterModelType(this.ModelType); modelMetadataWrapperProvider.RegisterModelMetadataWrapper(this); if (modelMetadata.ElementMetadata != null) { this.ElementMetadataWrapper = modelMetadataWrapperProvider.GetOrCreate(modelMetadata.ElementMetadata.ModelType); } }
public ModelMetadataPropertyWrapper(ModelMetadata modelMetadata, IModelMetadataWrapperProvider modelMetadataWrapperProvider) { this.ModelMetadata = modelMetadata; this.ModelTypeId = ModelType.GetTypeId(); modelMetadataWrapperProvider.RegisterModelType(this.ModelType); }