简体   繁体   English

使用Entity-Framework和Silverlight WCF RIA-Services开发自定义授权服务?

[英]Developing custom authorization service with Entity-Framework and Silverlight WCF RIA-Services?

I am desperately trying to develop with RIA services, but I want the User and Role classes to be entities generated by the EDM designer. 我极力尝试使用RIA服务进行开发,但是我希望User和Role类成为由EDM设计人员生成的实体。
The problem with that is, that I can't inherit from UserBase , since the entity already inherits from EntityObject . 问题在于,我不能从UserBase继承,因为实体已经从EntityObject继承了。
I tried to follow what I've read in few discussions over the net, and I implemented the partial class of the User with the IUser interface, having the AuthenticationService inherit from LinqToEntitiesDomainService<MyEntities> and implement IAuthentication<User> . 我尝试遵循在网上的一些讨论中所读到的内容,并使用IUser接口实现User的部分类,使AuthenticationService继承自LinqToEntitiesDomainService<MyEntities>并实现IAuthentication<User>

But since I feel that it's a dead end since I keep on getting errors everywhere with no result, I thought I might post my question to those who have been thru it and are willing to share the knowledge they've been fighting for, and make my life easier. 但是由于自从我不断到处出错而无果而终后,我觉得这是死路一条,所以我想我可以将问题发给那些曾经经历过并愿意分享自己为之奋斗的知识的人,我的生活更轻松。

I beg you, please only share ideas that you have experience with , I've spent a lot of time finding the solution. 求求您, 请仅分享您有经验的想法 ,我花了很多时间寻找解决方案。

UPDATE: 更新:
I managed to make it compile and run, but now I have a very weird situation: After several seconds that the application runs, it vanishes (I use Out-Of-Browser), the window frame remains, but no content! 我设法使其进行编译并运行,但是现在我遇到了一个非常奇怪的情况:应用程序运行几秒钟后,它消失了(我使用了Out-Of-Browser),窗口框架仍然存在,但是没有内容!

Here is what I've done to make it compile: 这是我所做的使其编译的工作:

  • Generate the Entity Model entities 生成实体模型实体
  • Make the User class implement IUser 使User类实现IUser
  • Mark the implemented Name property that returns the username with Key and DataMember attributes 标记实现的Name属性,该属性返回具有KeyDataMember属性的用户名
  • Attribute DataMember on the Roles property Roles属性上的属性DataMember
  • Then I run the project, it does compile but the content disappears after several seconds, without letting me know the source of the internal exception! 然后我运行该项目,它确实可以编译,但是内容在几秒钟后消失了,而没有让我知道内部异常的来源!

I could just tell that the vanishment occurs after the following is printed in the output window: 我只能说消失是在输出窗口中打印了以下内容之后发生的:

'sllauncher.exe' (Silverlight): Loaded 'ProxyBuilder'

Then, when it disappears, it writes: 然后,当它消失时,它写道:

'sllauncher.exe' (Silverlight): Loaded 'C:\Program Files (x86)\Microsoft Silverlight\4.0.50917.0\en-US\System.Runtime.Serialization.debug.resources.dll'
'sllauncher.exe' (Silverlight): Loaded 'C:\Program Files (x86)\Microsoft Silverlight\4.0.50917.0\en-US\mscorlib.debug.resources.dll'

Resources I've been thru: 我去过的资源:

you would need to look into implementing the custom membership and role providers and then you can connect to your database to query for roles and authentication related information. 您将需要研究实现自定义成员资格和角色提供程序,然后可以连接到数据库以查询与角色和身份验证相关的信息。 Let me know if this helps. 让我知道是否有帮助。 Look here http://msdn.microsoft.com/en-us/library/f1kyba5e.aspx for implementing memberhsip providers 查看此处http://msdn.microsoft.com/en-us/library/f1kyba5e.aspx,以实现memberhsip提供程序

Thanks, Ajay. 谢谢,阿杰

Turns out that Nikhil Kothari , has already done this work for us, it's included in the RiaEssentials project. 原来Nikhil Kothari已经为我们完成了这项工作,它已包含在RiaEssentials项目中。

Read this blog for detail. 阅读博客以获取详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM