Server deployment procedure
1. Create a database named "SocialPhoto" in a SQL Experss 2008 server.
2. Create db schema:
a. Run SocialPhotoModel.edmx.sql in DataModel project to create schema for SocialPhoto database
b. Add Location field (Geography type) into Photos table.
c. Run this script to create a trigger to sysnchronize Location field with Logitude and Latitude:
CREATE TRIGGER ModifyLocation
ON Photos
FOR INSERT, UPDATE AS
IF (UPDATE(Longitude) OR UPDATE(Latitude))
BEGIN
DECLARE @insertedId int = null,
@insertedLongitude float = NULL,
@insertedLatitude float= NULL
SELECT @insertedId = id, @insertedLongitude = Longitude, @insertedLatitude =Latitude
FROM INSERTED

IF (@insertedLongitude IS NOT NULL AND @insertedLatitude IS NOT NULL)
BEGIN
UPDATE Photos SET Location = geography::Point(@insertedLatitude, @insertedLongitude, 4326)
FROM INSERTED
WHERE inserted.id=Photos.id
END
END
GO
3. Init data: Run InitCategories and InitUsers test case inTestModel project
From now you can run service in VS2010 webserver
4. Build and then publish webservice project (SocialPhotos) into a real IIS server.

Last edited Oct 17, 2011 at 8:16 AM by nguyenhoangha, version 4

Comments

No comments yet.