Load foreign key properties(Navigation Properities) in Silvelright WCF Ria services.

Load foreign key properties(Navigation Properities) in Silvelright WCF Ria services.,第1张

概述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] [nv

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.

 

 

总结

以上是内存溢出为你收集整理的Load foreign key properties(Navigation Properities) in Silvelright WCF Ria services.全部内容,希望文章能够帮你解决Load foreign key properties(Navigation Properities) in Silvelright WCF Ria services.所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1076391.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存