NEW!
CSHTML5 has now become OpenSilver!
We are happy to announce that CSHTML5 has been significantly improved and rebranded
to 'OpenSilver', which stands for 'Open-source reimplementation of Silverlight'. It is fully backward compatible and it can be downloaded from
OpenSilver.net. Upgrading from
CSHTML5 to OpenSilver is very easy.
Read the FAQ
For security reasons, accessing a database is always done on the server-side, not the client-side. In fact, the "Connection String", which includes the URL and password of the database, should not be visible to the end-user.
The client-side (ie. the CSHTML5-based front-end) communicates with the server (for example an ASP.NET / WCF Service application) via one of the following:
You can download a sample client/server application from the following URL:
http://cshtml5.com/downloads/TestCshtml5WCF.zip
The sample demonstrates how to pass entities between the client and the server. IMPORTANT: the sample requires version 1.0 Beta 12.4 or newer. You can download the very latest build from the Pre-Releases section of the forums.
Although there is no database in the sample (instead, there is static dictionary on the server-side), database access can be easily added by modifying the file "Service1.svc.cs" located in the "WcfService1" project.
Let's assume that you have an SqlServer database which contains a table named "ToDoItemsTable" that has the following columns:
To retrieve the list of ToDo items from the database instead of the static dictionary, open the file "Service1.svc.cs" and replace the following code:
with this one:
Please click here for contact information.