再项目中出现这样的错误:

A model description could not be created. Duplicate model name 'ExamInfoParams' was found for types 'A.WebAPI.Params.QualityControl.ExamInfoParams' and 'A.WebAPI.Params.Exam.ExamInfoParams'. Use the [ModelName] attribute to change the model name for at least one of the types so that it has a unique name.

出现这个问题的原因 在于两个文件名相同,虽然命名空间不一样但是还是被程序不能区分,这时候需要使用特殊的标记去区分两个类,例如:

[ModelName("eWorld.WebAPI.Params.QualityControl.s")]
/// <summary>
/// 检XXXX
/// </summary>
public class Params : Bs
{
/// <summary>
/// 检查唯一号
/// </summary>
public Guid UID { get; set; }
}

[ModelName("eWorld.WebAPI.Params.Exam.Params")]
/// <summary>
/// 检WWW
/// </summary>
public class EParams : s
{
/// <summary>
/// 数据来源
/// </summary>
public string DataSource { get; set; }

}

,加入标记,问题解决

 

相关文章:

  • 2022-12-23
  • 2022-02-13
  • 2021-09-17
  • 2021-12-17
  • 2022-12-23
  • 2021-06-20
  • 2022-02-09
  • 2022-12-23
猜你喜欢
  • 2021-10-02
  • 2022-12-23
  • 2021-05-23
  • 2021-04-21
  • 2022-12-23
  • 2022-12-23
  • 2022-01-13
相关资源
相似解决方案