using System;
using System.Collections.Generic;
[Serializable]
public partial class user
{
public int UserId { get; set; }
public string Name { get; set; }
public string Surname { get; set; }
public string UserName { get; set; }
public string Email { get; set; }
public string Password { get; set; }
public System.DateTime Creation { get; set; }
public bool Status { get; set; }
public int UserTypeId { get; set; }
}
正如您在我的代码中看到的那样,我的类被设置为可序列化。但在我更新我的.edmx文件后,此设置被删除。如何在更新edmx文件后保留Serializable?
答案 0 :(得分:7)
正如您所看到的,您的类是部分的,因此您可以在项目中添加另一个类(文件)并在那里使用Serializable属性。
[Serializable]
public partial class user
{
}
将此文件放在具有相同名称空间的另一个类中,另请参阅http://msdn.microsoft.com/en-us/library/wa80x488(v=vs.90).aspx以获取有关部分名称的更多信息。