Warensoft Unity3D Communication Library Tutorial 3- Create Warensoft Data Service

(Author: Warensoft, Email: warensoft@163.com)

It is a headache problem to access to SQL Server in Unity3D, especially in web player. Due to security reasons, classes in ADO.NET are forbidden. Actually, not only Unity3D web player, but also flash and Silverlight, most of the RIA techs take the same security policy. We bring series of components in Warensoft Unity3D Communication Library which help accessing to SQL Server. Just few steps of configurations, developers would access to SQL Server very easily, including standalone player and web player. The following words will show you how to configure the Warensoft Data Service, and in later chapters I will implement how to access to Warensoft Data Service with Warensoft Unity Communication Library.

Step 1: Download the latest version of Warensoft Unity3D Communication Library from http://wucl.codeplex.com, and Warensoft.DataService.dll is what we need.

Step 2: Create Warensoft DataService, the followings are the steps:

1> Create a new website, then add reference to Warensoft.DataService.dll and Warensoft.Unity.Communication.dll, as shown below:


2> Add a typed dataset to the website, and rename it to DSTest, as shown below:


3> Open the database connection in server explorer, and expend all the tables , shown as below:


4> Select all the tables you need, and drag them to typed dataset designer, shown as below:


5> There will be an auto-added connection string named db_TestConnectionString in web.config after configuring data tables in dataset. shown as below:


6> In order to get the code intelligence, we need to build the website。

7> Open Default.aspx.cs, and modify its code, shown as below:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page

    protected void Page_Load(object sender, EventArgs e)

        //register warensoft dataservice

        //the first parameter indicates the connection string name

        //the second parameter indicates the instance of the typed dataset

        this.RegisterDataService("db_TestConnectionString", new DSTest());



8> Done。

Last edited May 4, 2012 at 5:56 AM by warensoft, version 1


No comments yet.