Jam*_*mes 5 c# asp.net asp.net-core-mvc asp.net-core
我正在尝试创建一个具有图像上载字段和名称字段的表单,并使用视图模型对其进行验证(请参见下文)。问题是,当我将数据库迁移到该类帐户或在Visual Studio中点击播放(启动站点)时,出现以下错误:
InvalidOperationException: The property 'ImageUpload' on entity type 'BallWallWebApp.ViewModels.Slides.CreateSlideViewModel' has not been added to the model or ignored.
Microsoft.Data.Entity.Metadata.Conventions.Internal.PropertyMappingValidationConvention.Apply(InternalModelBuilder modelBuilder)
Run Code Online (Sandbox Code Playgroud)
码:
using Microsoft.AspNet.Http;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace BallWallWebApp.ViewModels.Slides
{
public class CreateSlideViewModel
{
[Required]
public int WallId { get; set; }
[Required]
[Display(Name = "Slide Name")]
[DataType(DataType.Text)]
public string Name { get; set; }
[Required]
[Display(Name = "Slide image file")]
[DataType(DataType.Upload)]
public IFormFile ImageUpload { get; set; }
}
}
Run Code Online (Sandbox Code Playgroud)
我想念什么?
| 归档时间: |
|
| 查看次数: |
2271 次 |
| 最近记录: |