1
我有一個RIA服務,我發現我的常規屬性正在爲RIA服務生成(例如:字符串,整型等)。列表<User>不生成Ria服務的屬性
我有一個自定義類型的用戶,這將在下面介紹。我的列表屬性不是作爲Ria服務的一部分生成的。有任何想法嗎?下面
實施例示出了隨後的用戶類
public List<User> Users
{
get
{
if(this.users == null)
{
this.users = new List<User>();
}
return this.users;
}
set
{
this.users = new List<User>(value);
}
}
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ServiceModel.DomainServices.Server;
namespace MyNamespace
{
public class User
{
[Key]
public int? Id { get; set; }
public string Login { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string DisplayName { get; set; }
public string Email { get; set; }
public string Title
{
get;
set;
}
public string Department
{
get;
set;
}
public string Password { get; set; }
public string Source { get; set; }
public bool? IsEnabled { get; set; }
public bool IsInstanceAdmin { get; set; }
public byte[] Image { get; set; }
//public bool IsDeleted { get; set; }
private IList<UserGroupMembership> _userGroups;
/// <summary>
/// Gets or sets the user groups.
/// </summary>
/// <value>The user groups.</value>
[Include]
[Association("UserGroups", "Id", "UserId")]
public IList<UserGroupMembership> UserGroups
{
get
{
if (_userGroups == null)
{
_userGroups = new List<UserGroupMembership>();
}
return _userGroups;
}
set
{
_userGroups = value;
}
}
private IList<RoleAssignment> _roleIdentity;
/// <summary>
/// Gets or sets the role identities.
/// </summary>
/// <value>The role identities.</value>
[Include]
[Association("RoleIdentities", "Id", "UserId")]
public IList<RoleAssignment> RoleAssignments
{
get
{
if (_roleIdentity == null)
{
_roleIdentity = new List<RoleAssignment>();
}
return _roleIdentity;
}
set
{
_roleIdentity = value;
}
}
}
}