示例#1
0
 /// <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);
     }
 }
示例#2
0
 public ModelMetadataPropertyWrapper(ModelMetadata modelMetadata, IModelMetadataWrapperProvider modelMetadataWrapperProvider)
 {
     this.ModelMetadata = modelMetadata;
     this.ModelTypeId   = ModelType.GetTypeId();
     modelMetadataWrapperProvider.RegisterModelType(this.ModelType);
 }