This project is designed to provide local SQL Server database access for Silverlight 4.o applications. In other words, you will be able to talk directly from Silverlight application to an SQL Server database instead of having to go the
usual service route.
The library is written in .NET 4.0, but must be deployed on a client as a COM component. So, you have to run RegAsm on the compiled .NET DLL (COMSQLClient.DLL) on a client machine. This will register the assembly for COM access. The COM Library is uing the
latest .NET framework - SqlCleint namespace to tbe specific. As a result, the client machine is required to have .NET framework installed, but nothing else is required. The library is built to target .NET Framework version 4, although I could easily add support
for version 2.0 - 3.5 as well quite easily.
This library is using new feature in Silverlight 4.0 that has ability to invoke COM components when installed with eleveted rights.
This library works for local SQL Server and SQL Server Azure since the DLL is just using SqlClient components.
Look into the test project - SilverlightSQLServer\MainPage.xaml/cs for unit test cases and sample usage. They include the following:
- NonQuery with parameters
- NonQuery without parameters
- Query with parameters
- Query without parameters
- Scalar with parameters
- Scalar without parameters
Road map - next release will include methods that will provide asynchronous execution for all the methods.
When you are using ExecuteQueryMethod, you have to provide a type that will match a row of returned data. As a result, when you run ExecuteNonQuery<T>, the return value will be ObservableCollection<T> with makes it super easy to consume the results
of the query. For ExecuteNonQuery you just need a command text and parameters. It returns a number of rows affected which is helpfull for concurrency handling. Both simulate standard SqlClient.SqlCommand behavior.
Please email me your suggestions as well as any feedback. Also let me know if I need to provide more documentation.