【发布时间】:2026-02-04 12:05:03
【问题描述】:
我正在使用 EF4.1 DbContext 代码生成,它创建这样的 POCO 实体:
public partial class Employee
{
public Employee()
{
this.Roles = new HashSet<Role>();
}
public System.Guid EmployeeGUID { get; set; }
public string EmployeeID { get; set; }
public string PIN { get; set; }
public string FullName { get; set; }
public string FirstName { get; set; }
public string MiddleName { get; set; }
public string LastName { get; set; }
public string JobTitle { get; set; }
public string DepartmentDescription { get; set; }
public Nullable<System.DateTime> LatestHireDate { get; set; }
public string CompanyEmailAddress { get; set; }
public Nullable<System.Guid> SupervisorGUID { get; set; }
public string SupervisorFullName { get; set; }
public string SupervisorCompanyEmailAddress { get; set; }
public string JobCode { get; set; }
public virtual ICollection<Role> Roles { get; set; }
}
这是如何实现的?
【问题讨论】:
-
您是否真的需要 WF 4 的整个实体,完全清楚上下文永远不会可序列化,因此实体将断开连接?我在这里质疑设计。
-
@Craig - 查看我更新的问题。
-
从问题中删除一句话并不能说明为什么这种设计是个好主意。
-
你问的是如何序列化
Employee?为什么需要序列化?我认为这不是一个好主意... -
您没有义务解释任何事情。但是您是在寻求帮助,所以如果您选择提出一个完整的问题,这将对您个人有益。
标签: .net entity-framework workflow-foundation entity-framework-4.1