This page will guide you through the FoodCandy development process. At first it may look complicated, but it's actually extremely easy to get going and it's event easier to write useful code since a large portion of the infrastructure has been completely figured out for you.
-
Download and install a Subversion client from http://subversion.tigris.org/.
-
Create a new directory, eg. C:\Source.
-
Anonymous read-only access is enabled. Please e-mail dblock at dblock dot org for write access.
-
Check out the source code with svn checkout svn://svn.vestris.com/foodcandy
Follow the normal Installation HowTo. Visual Studio will create the websites for you, so you can skip that step. Once you have your SnCore website running you're ready to go.
On Windows Vista, some security restrictions must be lifted.
- Edit Physical Path Credentials in Advanced Settings and set a specific account to run the virtual directory under.
- Set r/w permissions for the NETWORK SERVICE account on the SnCore.Web/Bin, SnCore.MobileWeb, SnCore.Web/IsapiRewrite and SnCore.MobileWeb/IsapiRewrite directories.
- In registry, create HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\SnCoreWeb and SnCoreMobileWeb.
-
Add a new SQL table and generate NHibernate class and mapping for it. This is all you have to do to be able to create, retrieve update and delete rows in the database. The generated code is entirely in the automatically generated SnCore.Data project. You never have to deal with actual SQL code. For example, add a Thing table, which generates a Thing C# class. Read Data (Puzzle and NHibernate) for implenentation details. Write unit tests for the data and managed layer in the SnCore.Data.Tests project.
-
Create a managed layer for your new class in SnCore.Services. You must create a so called transit class, in this case TransitThing and a managed class ManagedTransitThing. This layer is usuall a straightforward stub with several interesting methods.
-
The managed object is aware of the NHibernate session (the data connection). It can hence implement any side effects needed for CreateOrUpdate and Delete. These are typically updating the Modified column of the class, but may be more complex when an object has relationships.
-
The transit object can be constructed from the managed object with a, for the purpose of our example, GetTransitThing method. The transit object is used to return a flat structure through web services. It seems redundant, but it is the easiest way to strip any sensitive data and to combine multiple objects in one to expose to ASP.NET data binding and to separate what goes between layers.
You should write unit tests for the data and managed layer in the SnCore.Services.Tests project.
-
Create a new web service or methods within an existing web service. These are typically, for a class Thing, GetThingById, CreateOrUpdateThing, DeleteThingById, GetThings, etc. Permissions are checked within the web services using the user ticket.
-
Create ASP.NET pages, such as ThingsManage.aspx, ThingEdit.aspx, etc.
|