Silverlight + RIA Services and customing the user/password storage - silverlight

Using the Silverlight Business Application template in VS2010 creates a nice default solution with a Silverlight project and an ASP.NET project. It also automatically provides some nice authentication that seems to store usernames/password/etc for newly registered users into your local SQL Server database.
Is it possible to customize the storage mechanism? I already have a data store elsewhere and want to handle the adding/removing etc of details myself.

Yes, you can. WCF RIA Services is using the default ASP.NET Membership provider. So search on the web on how to modify them (via web.config) to connect to another source and it will be transparent for the SL/WCF RIA Services application.
For instance, I've connected them to the Azure Storage (table) instead of the default ASPNETDB database on this application : http://cloudypizza.cloudapp.net . You can test it by creating your own account on clicking on "login".
I've briefly explained how I've done it here on my blog (in French only sorry)
Regards,
David

Related

Understanding the different ways to connect to CRM 2011

I'm a beginner CRM developer and I'm quite confused about the connection methods to CRM.
What's the difference between creating a SOAP service reference to connect to CRM 2011 from a windows form application VS using connection string VS creating a web service?
Are they the same and I can use them interchangeably ? Or it depends on the task I want to do?
Thanks
Out of the 3 links that you have provided, one contains the best approach.
this - CRM SDK says to use this approach when you want to connect with CRM from some other application like Winform app, WPF app, website. In summary, you provide connection values through configuration and then use dlls provided by CRM to access data.
this - This is a special case in CRM. So here you are accessing some data from CRM, processing it in a service and then using that service to access processed data.
this - This document itself says that you should not use this approach. Problem with this approach is about hard coded service references.
You can find plenty of examples to start up with from CRM SDK.

deploying services to use SQL server in silverlight

I've made a service for my silverlight 4 database (SQL) affairs (VS2010, C# ASP.NET web app), now I'm writing my SQL functions in this service, how can I use this functions? I've read some articles about deploying services but I think my case should not be much complicated, I have a big ASP.net web app with several web pages (I have a server running on winserver2008), it works great, also I have a SL app, what kind of files should I upload for using service? do I need an asmx? how can I create it? should I change anything in web.config?
what is the easiest way to use my service for communicating between SQL and SL? thanks
WCF RIA Services is the way to go. You do not want to bother with old-school ASMX web-services.
You will use an EF model and a DomainContext on the server to handle all database access via CRUD methods (Create, Read, Update & Delete).
On the client you will use the generated Domain Service client to access data.
Notes from my previous RIA post:
My suggestion is to always create RIA Service libraries instead of adding directly to a Silverlight application. Then you can link the Client-side library to any number of Silverlight applications, then link the .Web part of the RIA library to your website to provide the WCF service. Again the key is to migrate the config settings.
It will probably make a lot more sense if you create a new RIA services library project, add your EDM etc, then link the halves to a separate Silverlight app and your new ASP.net website.
Step-by-step:
Create RIA Services Library project by selecting Add New Project. Select Silverlight on the left. Select WCF RIA Services Class Library on the right. I will assume it is called the default name RIAServicesLibrary1 for this example. It will create a Silverlight client library called RIAServicesLibrary1 and a standard .Net library called RIAServicesLibrary1.Web for use by the Web server.
Add your EDMX to the RiaServices.web project. Select Add new item. Select Data on the left. Select ADO.Net Entity Data Model on the right. I will assume it is called the default Model1.edmx for this example. Connect it to your database tables etc.
Build your project so that the next step will find your data model.
Create a Domain Service referencing your EDMX models in your RiaServices.web project. Select Add new item. Select Web on the left. Select Domain Service Class on the right. I will assume it is called DomainService1.cs for this example. Choose your data items from the Add New Domain Service Class popup window by ticking the checkboxes. A set of RIA services objects and methods will be created for each item you select.
Add a reference to the client Ria services library project (RIAServicesLibrary1) to your Silverlight application.
Add a reference to the web RIA services library project (RIAServicesLibrary1.Web) to your hosting web application (e.g. you ASP.Net website).
Copy/merge the various sections in the RIAServicesLibrary1.Web/app.config file into your <webapplication>/web.config file. This will include any connection strings and the module sections.
Build the project again so that the Data Source window will see your new Domain Context data sources.
Use the RIAServicesLibrary1 client object (called DomainService1 in this example) directly from your Silverlight code like this:
DomainService1 client = new DomainService1();
or use the Data Sources window to drag/drop a new grid etc onto a page.
If the Data Sources window is not visible select the "Data" menu then the "Show Data Sources" option.
For more information try this Microsoft link: Using WCF RIA Services

SharePoint 2010 Silverlight application server object model?

I am currently getting myself up to speed with SharePoint 2010 and I am working my way through the different way SharePoint can expose silverlight applications.
As I understand it, the client object model is more restricted, and is for other applications to interact with SharePoint via WCF for example. An example would be a custom build system that retrieves reference data from SharePoint lists.
The server object model provides more functionality in SharePoint. One example is code written for a web part.
I have been told to deploy a silverlight application, you create the xap, make it accessible by SharePoint web front end, create a silverlight web part and point to it.
So, my question is, assuming what I have previously mentioned is more-or-less the case, can SharePoint access the server object model or is it the same as an external system for example, and uses the client object model?
I am learning all of this so happy to receive feedback on anything I may have not understood correctly.
You would access the client object model from Silverlight. Silverlight is a client. It runs in the user's browser, so it is not on the server, and therefore cannot access the server's features except via service calls. The client object model will provide you direct integration with various lists and functions, and makes it very easy to integrate.
Check out this video for more:
http://channel9.msdn.com/learn/courses/SharePoint2010Developer/ClientObjectModel/SilverlightClientObjectModel/

Silverlight and .NET RIA Services - Managing Users

I am building a Silverlight 3 application that uses .NET RIA Services. This application is hosted in an ASP.NET application that uses the default aspnet_Membership tables. My Silverlight application requires users to login. If they are a member of a certain role, I want to allow them to manage the application's users.
Currently, I can authenticate a user and see what roles they belong to. However, I cannot figure out how to do other tasks handled by the ASP.NET MembershipProvider. Things like creating users, resetting their password, etc.
How do I do these types of things through a Silverlight application that uses .NET RIA Services?
Thank you!
Correct me if I am wrong, but as I checked MembershipProvider, there are already methods for Creating Users, Resetting Password, Changing Passwords or Deleting Users
Or probably you wanted to ask something else or probably the question is incomplete?

How does a Silverlight client access Azure stored data?

I am thinking of developing a Silverlight application and want to make use of Windows Azure for the data storage (as well as scalability etc). But I am not sure how to get data to and from Azure using Silverlight. What technologies should I be investigating? What is the recommended approach for this scenario?
Should I be looking at using the Entity Framework from Silverlight? But then how would the EF get data from Azure and even more importantly get changes saved back again? Or do I need to go for something more custom?
Check out .NET RIA Services:
Build a Simple Application with .Net RIA Services (Silverlight 3)
Creating applications with .NET RIA Service Part 1 - Introduction
Basically, you're going to use Azure Table Storage to store the data and Blob storage if you have really large (> 64K) data elements. Table Storage and Blob Storage have REST interfaces, and you should look at the StorageClient sample in the Azure SDK as a way to CRUD the data. You can use these interfaces (Table and Blob) exclusively if you don't plan on exposing a public API.
However, lets say you want to be the next Twitter, and you want to expose a REST interface to the public... Even though Azure Table Storage has it's own REST interface, you create a small WCF service in a web role that exposes some specific WCF methods in a more compelling way. You can also publish your data in JSON, which could be more useful to non-Windows data consumers.
Here's a page that I found really helpful:
Azure Application Part 3: Expose (REST) Web Service And Consume in Silverlight.
And if you'd like to see my example, http://www.netalerts.mobi/traffic exposes data that's stored in Azure Table Storage. http://www.netalerts.mobi/traffic/api.aspx describes the REST apis that are public. In my implementation I call Table Storage via REST, manipulate the data, and then serve it up again in the public api.

Resources