Complications in integrating Silverlight and existing asp.net application? - c#

I am new to silverlight, WCF RIA services. We have a medium size financial business web application. There is a lot of code. The code is well organized with lots of business objects, web controls, web forms, Data Access layer, Business logic layer.
There is a requirement for some enhancements to the web application and one of the team member wants to use silverlight to improve UI and responsiveness.
We tried to integrate a small silverlight application in the web application, But what I found is we copy the xap file and it always opens the Main form.
how can we open other silverlight controls?
How can we use the business objects and business logic with the silverlight as the silverlight supports on silverlight class library?
How can we use the existing data access library?
How can we connect to the database? I saw WCF RIA services, all the examples I saw with entity framework and we use oracle and the cannot use the beta version of oracle entity framework?
how to pass data to & from silverlight app to asp.net?
There maybe some other issues which I am unaware.
Thanks, Naveen

how can we open other silverlight controls?
You would create a Navigation Framework based Silverlight application. This allows the use of a path following # in the URL to navigate to other pages within the Silverlight application.
How can we use the business objects and business logic with the silverlight as the silverlight supports on silverlight class library?
You won't be able to use them directly. Here you would create a Silverlight WCF service to access your business objects, you keep the business objects on the server.
How can we use the existing data access library?
You don't, you are going via WCF to your business objects which are on the server and from there on to your data.
How can we connect to the database? I saw WCF RIA services, all the examples I saw with entity framework and we use oracle and the cannot use the beta version of oracle entity framework?
As above, the Silverlight app only sees your specialist WCF Service.
how to pass data to & from silverlight app to asp.net?
You can do that via your business objects and/or your new WCF Service.

Related

Can I use WCF RIA Services with existing web APIs?

I'm new to this kind of development, and so far I've only seen tutorials on WCF RIA services which create new ADO.Net data models from a database.
However I am working with a system which provides you with web APIs for interacting with the data (which I am able to contain and use in my own web service, which will in turn interact with my silverlight application).
Is it possible/sensible to use WCF RIA services in this case? Or shall I just use a regular WCF Service which uses these APIs?
Thanks!
I think you should first really understand the power of WCF RIA Services as explained in the msdn documentation http://msdn.microsoft.com/en-us/library/ee707344(v=vs.91).aspx
"A common problem when developing an n-tier RIA solution is coordinating application logic between the middle tier and the presentation tier. To create the best user experience, you want your RIA Services client to be aware of the application logic that resides on the server, but you do not want to develop and maintain the application logic on both the presentation tier and the middle tier."
So, as soon as you are in the domain service, you are in a classic WCF Service, so here you could interact with possibly anything you wish (including external web API).
Though, the avantages to use WCF RIA Services is smaller if the logic of your application is already embed in a Web API.

Use of database for multiple Places in windows application in c#

I have a developed a application that is gonna to be used at multiple places.
So how should i maintain one database for all?
Or is there only one way of using remote database for this software.
If i use remote database, i am facing problem with loading controls in forms.
Please Suggest Solution.
Thanks
Typically you'd design a system leveraging multi-tiered architecture, which often consists of:
Front-end user interface
A database back-end
Middle tier/business layer that let's your web pages access the database and provides additional business logic (perhaps a web service?)
You don't give much to go on as far as details go, but it seems like you have several physical locations that need to access a single database. So you can:
Develop an (web or desktop) application that handles the front-end UI and the middle tier (which will access data and do other stuff)
Develop an application that handles only front-end UI, but calls a web service that accesses a database and does other stuff. In this case, you may have several locations with different front-end applications that consume the same centralized web service.

C# architecture for long-lived data collecting server apps

We are about to start a new project for a server application, for the purpose of collecting data from several data sources and storing it in a database.
For a quick test, we created a WinForms app which uses the core functionality from a custom library, and now have to start migrating it towards the final product.
From what we've done so far, the best way to do this should be to make it a Windows service and then expose basic monitoring and configuration to a thin Win or Web client through remoting/web services.
Is there a more appropriate way to make such an application?
You could consider exposing the service itself using the WCF/ADO.NET Data Services: http://msdn.microsoft.com/en-us/library/cc668792.aspx
Also see this for a quick walkthrough on how to expose a WCF Data Service: http://www.msteched.com/2010/NorthAmerica/DEV324

Saving Data in a SilverLight Webpage

im trying to perform a simple database insert from a submission on a SilverLight Webpage. Normally i would either use ADO or LINQ to SQL to perform this. You can not do this within a SilverLight Project, nor can you reference a project that can (a non SilverLight project). What would be the best way of doing this?
Thanks.
For the most part, Silverlight apps are designed to talk to web-based data services or databases via RIA services.
There are a a few approaches to your problem:
Reference a web service, like an .asmx or any REST servie
Use WCF to communicate to the backend
Use Silverlight RIA Services to talk to the database (it was designed to solve your problem)
Your best bet is to use the .NET RIA Services which will allow you to define server-side domain classes and due to the RIA Services link, will generate client side code in your silverlight project.
Another alternative if you don't want to use web services, is to Xml Serialization and Isolated Storage to store the files. You'd simply load the database into memory on startup, and then persist to the file when the apps closes, or periodically.

KISS: Simple C# application which communicates with a RESTful web service

Following the KISS principle, I suddenly realised the following:
In .NET, you can use the Entity Model Framework to wrap around a database.
This model can be exposed as a web service through WCF.
This web service would have a very standardized definition.
A client application could be created which could consume any such RESTful web service.
I don't want to re-invent the wheel and it wouldn't surprise me if someone has already done this, so my question is simple: Has anyone already created a simple (desktop, not web) client application that can consume a RESTful service that's based on the Entity Framework and which will allow the user to read and write data directly to this service?
Otherwise, I'll just have to "invent" this myself. :-)Problem is, the database layer and RESTful service is already finished. The RESTful service will only stay in the project during it's development phase, since we can use the database-layer assembly directly from the web applications that are build around it. When the web application is deployed, the RESTful services are just kept out of the deployment.
But the database has a lot of data to manage over nearly 50 tables. When developing against a local database, we can have straight access to the database so I wouldn't need this tool for this. When it's deployed, the web application would be the only way to access the data so I could not use this tool. But we're also having a test phase where the database is stored on another system outside the local domain and this database is not available for developers. Only administrators have direct access to this database, making tests a bit more complex.
However, through the RESTful service, I can still access the data directly. Thus, when some test goes wrong, I can repair the data through this connection or just create a copy of the data for tests on my local system. There's plenty of other functionality and it's even possible to just open the URL to a table service straight in Excel or XMLSpy to see the contents. But when I want to write something back, I have to write special code to do just that. A generic tool that would allow me to access the data and modify it would be easier. Since it's a generic setup around the ADO.NET Data services, this should be reasonable easy too.
Thus, I can do it but hoped someone else has already done something similar. But it appears that there's no such tool made yet...
You are referring to ADO.Net Data Services. It basically creates an Entity Database Model and adds a REST frontend to the service using ASMX. There is a How To article availble from MSDN here on consuming the service using .Net. I have also done the same thing using the normally WebClient class in .Net in the past.
You can also look at the WCF REST Starter Kit if you want to roll your own based on Entity Framework. The starter kit also contains a handy new WebClient class that can be used to communicate with REST services.
Clarification
There is no prebuilt application client that I am aware off which will talk to these service, since they are pretty much accessing the data using Web Services. There is the Microsoft Smart Client Factory which is most likely the closest thing I have worked with.
I mentioned the above 2 options since they already have libraries in .Net that work with them directly, either as a referenced Web Service, or for the more adventurious, myself included, using the WebClient library or alternatively the new HTTPClient library in the WCF REST Starter kit.
I have used both, in Windows, Web, Silverlight and WCF. The latter being the easiest since they are focussed at REST.
We are currently investigating Prism which strongly leans to using this method when using WCF for front-end development.
Assumption
With regards to this question, you are making a generic assumption that wrapping ADO Entity Framework with a WCF service it will be generic. ADO.Net Data Services is the closest you will get, however the structure of the database will fundamently change the way you interact with it. Going a level higher in a "generic" way would be dangerous, as these 2 technologies, individually or together, are already as generic as possible.
In addition to Data Services (+1), consider RIA Services. It's like a domain-specific version of data services for Silverlight or WPF clients. Less flexible, but easier, than Data Services.

Categories

Resources