简体   繁体   中英

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.
The problem with that is, that I can't inherit from UserBase , since the entity already inherits from 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> .

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!

Here is what I've done to make it compile:

  • Generate the Entity Model entities
  • Make the User class implement IUser
  • Mark the implemented Name property that returns the username with Key and DataMember attributes
  • Attribute DataMember on the Roles property
  • 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

Thanks, Ajay.

Turns out that Nikhil Kothari , has already done this work for us, it's included in the RiaEssentials project.

Read this blog for detail.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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