我们在上一篇中讨论了如何利用ModelMetadata实现国际化资源文件访问,但也留下了一些问题,即:如何利用ModelMetadata实现相同类型的属性信息的个性化资源显示。本人没有找到合适的方案,期待着高人的指点。

  本章,介绍第三种资源访问方案,用于解决上述问题(该方案并非从设计角度解决问题)。

  首先,描述下我们的问题。

  第一步,在UserProfile类型中添加两个Address类型的属性:

 1         #region 用户住址信息
 2         
 3         public int? UserAddressId { get; set; }
 4 
 5         [ForeignKey("UserAddressId")]
 6         public Address UserAddress { get; set; }
 7 
 8         #endregion
 9 
10 
11         #region 用户公司地址信息
12 
13         public int? CompanyAddressId { get; set; }
14 
15         [ForeignKey("CompanyAddressId")]
16         public Address CompanyAddress { get; set; }
17         
18         #endregion
View Code

相关文章:

  • 2022-12-23
  • 2021-12-31
  • 2021-12-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-19
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-18
  • 2022-12-23
  • 2021-06-09
相关资源
相似解决方案