【发布时间】:2015-02-22 13:11:46
【问题描述】:
我有一个业务逻辑层和 2 个使用它的应用程序,一个 MVC UI 和一个 Web API 项目。
我的类的属性之一是 CreatedBy 和 UpdatedBy,它们应该保存用户 ID。
public Nullable<System.DateTime> CreatedTS { get; set; }
public string CreatedBy { get; set; }
public Nullable<System.DateTime> UpdatedTS { get; set; }
public string UpdatedBy { get; set; }
鉴于 BLL 有多个使用者,捕获 userId 的最佳方法是什么?
A) - 在 BLL 中使用 Environment.UserName? 设置它?
B) - 要求客户端设置并使用模型数据注释使此为必填项
C) - 要求客户端将此传递给 BLL 中的任何 Create 或 Update 方法。
【问题讨论】:
标签: c# asp.net architecture