Before the code,i assume that you have created the relation ship between table in ADO.net Entities.
Here is mine,
CREATE TABLE [dbo].[tblRole](
[RoleID] [int] IDENTITY(1,1) NOT NULL,
[RoleName] [nvarchar](50) NOT NULL,
[IsActive] [bit] NOT NULL)
CREATE TABLE [dbo].[tblUser](
[UserID] [int] IDENTITY(1,
[UserName] [nvarchar](50) NOT NULL,
[Password] [nvarchar](50) NOT NULL,
[RoleID] [int] NOT NULL,
[CreatedTime] [datetime] NOT NULL,
[IsActive] [bit] NOT NULL)
RoleID will be the foreign Key field.
In the entities,you need Create a navigation property against this field.
In domain service,
In silverlight part,you can call the service like this,
The code above is the sample everywhere people are using,i don't kNow whether there will be a chance that when the service loaded,but the complete event hasn't been attached to the object. For the safe operation,i think the following way is a better choice for doing this. Use CALLBACK function!!!!!
At last but not least,You must add [Include] attribute to the Navigation Property,or else,the data will not be transfered to SL client.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。