在我的Silverlight解决方案的服务器端,我有2个项目.
>提供Silverlight页面的网站.
>实体框架数据访问层.
我有一个具有FirstName和LastName属性的实体.我想添加一个可以从Silverlight客户端获得的FullName属性.
namespace Server.DAL.Model { public partial class Contact { public string FullName { get { return string.Format("{0} {1}",this.FirstName,this.LastName); } } } }
从服务器端进行测试时,此新属性存在且工作正常.该属性不存在于Silverlight客户端.我尝试使用Include属性添加元数据类,但由于string是基本类型,因此在编译时出现以下错误:
The property ‘FullName’ in entity type ‘Contact’ cannot be marked with
the IncludeAttribute because ‘String’ is not a valid entity type.
Entity types cannot be a primitive type or a simple type like string
or Guid.
如何将此属性提供给Silverlight客户端?