Tuesday, April 5, 2011

Model unit test finished

All Model unit test finished...

Public database setup

Database was setup, the connection string is:
Data Source=knotpedia.db.6221122.hostedresource.com; Initial Catalog=knotpedia; User ID=knotpedia; Password=Hexsoft2003;
If you want to setup the database in your own computer, you could download and setup Microsoft SQL Server 2005+ and management studio and execute following statement:
USE [master]
GO
/****** Object:  Database [Knot]    Script Date: 04/05/2011 20:21:11 ******/
CREATE DATABASE [Knot] ON  PRIMARY
( NAME = N'Knot', FILENAME = N'D:\Project\Knot\Database\Knot.mdf' , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
 LOG ON
( NAME = N'Knot_log', FILENAME = N'D:\Project\Knot\Database\Knot_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 1024KB )
GO
ALTER DATABASE [Knot] SET COMPATIBILITY_LEVEL = 90
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [Knot].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [Knot] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [Knot] SET ANSI_NULLS OFF
GO
ALTER DATABASE [Knot] SET ANSI_PADDING OFF
GO
ALTER DATABASE [Knot] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [Knot] SET ARITHABORT OFF
GO
ALTER DATABASE [Knot] SET AUTO_CLOSE ON
GO
ALTER DATABASE [Knot] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [Knot] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [Knot] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [Knot] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [Knot] SET CURSOR_DEFAULT  GLOBAL
GO
ALTER DATABASE [Knot] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [Knot] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [Knot] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [Knot] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [Knot] SET  DISABLE_BROKER
GO
ALTER DATABASE [Knot] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [Knot] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [Knot] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [Knot] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [Knot] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [Knot] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [Knot] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [Knot] SET  READ_WRITE
GO
ALTER DATABASE [Knot] SET RECOVERY SIMPLE
GO
ALTER DATABASE [Knot] SET  MULTI_USER
GO
ALTER DATABASE [Knot] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [Knot] SET DB_CHAINING OFF
GO
USE [Knot]
GO
/****** Object:  Table [dbo].[Knot]    Script Date: 04/05/2011 20:21:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Knot](
    [Id] [uniqueidentifier] NOT NULL,
    [Name] [nvarchar](50) NOT NULL,
    [Description] [nvarchar](4000) NOT NULL,
 CONSTRAINT [PK_Knot] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Fixture]    Script Date: 04/05/2011 20:21:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Fixture](
    [Id] [uniqueidentifier] NOT NULL,
    [Material] [int] NOT NULL,
    [Knot] [uniqueidentifier] NOT NULL,
 CONSTRAINT [PK_Fixture] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Line]    Script Date: 04/05/2011 20:21:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Line](
    [Id] [uniqueidentifier] NOT NULL,
    [Material] [int] NOT NULL,
    [Knot] [uniqueidentifier] NOT NULL,
 CONSTRAINT [PK_Line] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  StoredProcedure [dbo].[KnotUpdate]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[KnotUpdate]
    @Id uniqueidentifier,
    @Name nvarchar(50),
    @Description nvarchar(4000)
AS
UPDATE
    [Knot]
SET
    [Knot].[Name] = @Name,
    [Knot].[Description] = @Description
WHERE
    [Knot].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[KnotRemove]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[KnotRemove]
    @Id uniqueidentifier
AS
DELETE
    [Knot]
WHERE
    [Knot].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[KnotGetAll]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[KnotGetAll]
AS
SELECT
    [Knot].[Id],
    [Knot].[Name],
    [Knot].[Description]
FROM
    [Knot]
GO
/****** Object:  StoredProcedure [dbo].[KnotGet]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[KnotGet]
    @Id uniqueidentifier
AS
SELECT
    [Knot].[Id],
    [Knot].[Name],
    [Knot].[Description]
FROM
    [Knot]
WHERE
    [Knot].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[KnotAdd]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[KnotAdd]
    @Id uniqueidentifier,
    @Name nvarchar(50),
    @Description nvarchar(4000)
AS
INSERT
    [Knot]
VALUES (
    @Id,
    @Name,
    @Description
)
GO
/****** Object:  StoredProcedure [dbo].[FixtureUpdate]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[FixtureUpdate]
    @Id uniqueidentifier,
    @Material int,
    @Knot uniqueidentifier
AS
UPDATE
    [Fixture]
SET
    [Fixture].[Material] = @Material,
    [Fixture].[Knot] = @Knot
WHERE
    [Fixture].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[FixtureRemoveByKnot]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[FixtureRemoveByKnot]
    @Knot uniqueidentifier
AS
DELETE
    [Fixture]
WHERE
    [Fixture].[Knot] = @Knot
GO
/****** Object:  StoredProcedure [dbo].[FixtureRemove]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[FixtureRemove]
    @Id uniqueidentifier
AS
DELETE
    [Fixture]
WHERE
    [Fixture].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[FixtureGetByKnot]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[FixtureGetByKnot]
    @Knot uniqueidentifier
AS
SELECT
    [Fixture].[Id],
    [Fixture].[Material]
FROM
    [Fixture]
WHERE
    [Fixture].[Knot] = @Knot
GO
/****** Object:  StoredProcedure [dbo].[FixtureGetAll]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[FixtureGetAll]
AS
SELECT
    [Fixture].[Id],
    [Fixture].[Material],
    [FixtureKnot].[Id],
    [FixtureKnot].[Name],
    [FixtureKnot].[Description]
FROM
    [Fixture]
    JOIN [Knot] AS [FixtureKnot] ON [Fixture].[Knot] = [FixtureKnot].[Id]
GO
/****** Object:  StoredProcedure [dbo].[FixtureGet]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[FixtureGet]
    @Id uniqueidentifier
AS
SELECT
    [Fixture].[Id],
    [Fixture].[Material],
    [FixtureKnot].[Id],
    [FixtureKnot].[Name],
    [FixtureKnot].[Description]
FROM
    [Fixture]
    JOIN [Knot] AS [FixtureKnot] ON [Fixture].[Knot] = [FixtureKnot].[Id]
WHERE
    [Fixture].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[FixtureAdd]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[FixtureAdd]
    @Id uniqueidentifier,
    @Material int,
    @Knot uniqueidentifier
AS
INSERT
    [Fixture]
VALUES (
    @Id,
    @Material,
    @Knot
)
GO
/****** Object:  Table [dbo].[Step]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Step](
    [Id] [uniqueidentifier] NOT NULL,
    [Description] [nvarchar](4000) NOT NULL,
    [Line] [uniqueidentifier] NOT NULL,
 CONSTRAINT [PK_Step] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  StoredProcedure [dbo].[LineUpdate]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[LineUpdate]
    @Id uniqueidentifier,
    @Material int,
    @Knot uniqueidentifier
AS
UPDATE
    [Line]
SET
    [Line].[Material] = @Material,
    [Line].[Knot] = @Knot
WHERE
    [Line].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[LineRemoveByKnot]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[LineRemoveByKnot]
    @Knot uniqueidentifier
AS
DELETE
    [Line]
WHERE
    [Line].[Knot] = @Knot
GO
/****** Object:  StoredProcedure [dbo].[LineRemove]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[LineRemove]
    @Id uniqueidentifier
AS
DELETE
    [Line]
WHERE
    [Line].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[LineGetByKnot]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[LineGetByKnot]
    @Knot uniqueidentifier
AS
SELECT
    [Line].[Id],
    [Line].[Material]
FROM
    [Line]
WHERE
    [Line].[Knot] = @Knot
GO
/****** Object:  StoredProcedure [dbo].[LineGetAll]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[LineGetAll]
AS
SELECT
    [Line].[Id],
    [Line].[Material],
    [LineKnot].[Id],
    [LineKnot].[Name],
    [LineKnot].[Description]
FROM
    [Line]
    JOIN [Knot] AS [LineKnot] ON [Line].[Knot] = [LineKnot].[Id]
GO
/****** Object:  StoredProcedure [dbo].[LineGet]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[LineGet]
    @Id uniqueidentifier
AS
SELECT
    [Line].[Id],
    [Line].[Material],
    [LineKnot].[Id],
    [LineKnot].[Name],
    [LineKnot].[Description]
FROM
    [Line]
    JOIN [Knot] AS [LineKnot] ON [Line].[Knot] = [LineKnot].[Id]
WHERE
    [Line].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[LineAdd]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[LineAdd]
    @Id uniqueidentifier,
    @Material int,
    @Knot uniqueidentifier
AS
INSERT
    [Line]
VALUES (
    @Id,
    @Material,
    @Knot
)
GO
/****** Object:  StoredProcedure [dbo].[StepUpdate]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[StepUpdate]
    @Id uniqueidentifier,
    @Description nvarchar(4000),
    @Line uniqueidentifier
AS
UPDATE
    [Step]
SET
    [Step].[Description] = @Description,
    [Step].[Line] = @Line
WHERE
    [Step].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[StepRemoveByLine]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[StepRemoveByLine]
    @Line uniqueidentifier
AS
DELETE
    [Step]
WHERE
    [Step].[Line] = @Line
GO
/****** Object:  StoredProcedure [dbo].[StepRemove]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[StepRemove]
    @Id uniqueidentifier
AS
DELETE
    [Step]
WHERE
    [Step].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[StepGetByLine]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[StepGetByLine]
    @Line uniqueidentifier
AS
SELECT
    [Step].[Id],
    [Step].[Description]
FROM
    [Step]
WHERE
    [Step].[Line] = @Line
GO
/****** Object:  StoredProcedure [dbo].[StepGetAll]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[StepGetAll]
AS
SELECT
    [Step].[Id],
    [Step].[Description],
    [StepLine].[Id],
    [StepLine].[Material],
    [StepLineKnot].[Id],
    [StepLineKnot].[Name],
    [StepLineKnot].[Description]
FROM
    [Step]
    JOIN [Line] AS [StepLine] ON [Step].[Line] = [StepLine].[Id]
    JOIN [Knot] AS [StepLineKnot] ON [StepLine].[Knot] = [StepLineKnot].[Id]
GO
/****** Object:  StoredProcedure [dbo].[StepGet]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[StepGet]
    @Id uniqueidentifier
AS
SELECT
    [Step].[Id],
    [Step].[Description],
    [StepLine].[Id],
    [StepLine].[Material],
    [StepLineKnot].[Id],
    [StepLineKnot].[Name],
    [StepLineKnot].[Description]
FROM
    [Step]
    JOIN [Line] AS [StepLine] ON [Step].[Line] = [StepLine].[Id]
    JOIN [Knot] AS [StepLineKnot] ON [StepLine].[Knot] = [StepLineKnot].[Id]
WHERE
    [Step].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[StepAdd]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[StepAdd]
    @Id uniqueidentifier,
    @Description nvarchar(4000),
    @Line uniqueidentifier
AS
INSERT
    [Step]
VALUES (
    @Id,
    @Description,
    @Line
)
GO
/****** Object:  Table [dbo].[Point]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Point](
    [Id] [uniqueidentifier] NOT NULL,
    [X] [real] NOT NULL,
    [Y] [real] NOT NULL,
    [Z] [real] NOT NULL,
    [Step] [uniqueidentifier] NOT NULL,
 CONSTRAINT [PK_Point] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  StoredProcedure [dbo].[PointUpdate]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[PointUpdate]
    @Id uniqueidentifier,
    @X real,
    @Y real,
    @Z real,
    @Step uniqueidentifier
AS
UPDATE
    [Point]
SET
    [Point].[X] = @X,
    [Point].[Y] = @Y,
    [Point].[Z] = @Z,
    [Point].[Step] = @Step
WHERE
    [Point].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[PointRemoveByStep]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[PointRemoveByStep]
    @Step uniqueidentifier
AS
DELETE
    [Point]
WHERE
    [Point].[Step] = @Step
GO
/****** Object:  StoredProcedure [dbo].[PointRemove]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[PointRemove]
    @Id uniqueidentifier
AS
DELETE
    [Point]
WHERE
    [Point].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[PointGetByStep]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[PointGetByStep]
    @Step uniqueidentifier
AS
SELECT
    [Point].[Id],
    [Point].[X],
    [Point].[Y],
    [Point].[Z]
FROM
    [Point]
WHERE
    [Point].[Step] = @Step
GO
/****** Object:  StoredProcedure [dbo].[PointGetAll]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[PointGetAll]
AS
SELECT
    [Point].[Id],
    [Point].[X],
    [Point].[Y],
    [Point].[Z],
    [PointStep].[Id],
    [PointStep].[Description],
    [PointStepLine].[Id],
    [PointStepLine].[Material],
    [PointStepLineKnot].[Id],
    [PointStepLineKnot].[Name],
    [PointStepLineKnot].[Description]
FROM
    [Point]
    JOIN [Step] AS [PointStep] ON [Point].[Step] = [PointStep].[Id]
    JOIN [Line] AS [PointStepLine] ON [PointStep].[Line] = [PointStepLine].[Id]
    JOIN [Knot] AS [PointStepLineKnot] ON [PointStepLine].[Knot] = [PointStepLineKnot].[Id]
GO
/****** Object:  StoredProcedure [dbo].[PointGet]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[PointGet]
    @Id uniqueidentifier
AS
SELECT
    [Point].[Id],
    [Point].[X],
    [Point].[Y],
    [Point].[Z],
    [PointStep].[Id],
    [PointStep].[Description],
    [PointStepLine].[Id],
    [PointStepLine].[Material],
    [PointStepLineKnot].[Id],
    [PointStepLineKnot].[Name],
    [PointStepLineKnot].[Description]
FROM
    [Point]
    JOIN [Step] AS [PointStep] ON [Point].[Step] = [PointStep].[Id]
    JOIN [Line] AS [PointStepLine] ON [PointStep].[Line] = [PointStepLine].[Id]
    JOIN [Knot] AS [PointStepLineKnot] ON [PointStepLine].[Knot] = [PointStepLineKnot].[Id]
WHERE
    [Point].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[PointAdd]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[PointAdd]
    @Id uniqueidentifier,
    @X real,
    @Y real,
    @Z real,
    @Step uniqueidentifier
AS
INSERT
    [Point]
VALUES (
    @Id,
    @X,
    @Y,
    @Z,
    @Step
)
GO
/****** Object:  ForeignKey [FK_Fixture_Knot]    Script Date: 04/05/2011 20:21:12 ******/
ALTER TABLE [dbo].[Fixture]  WITH CHECK ADD  CONSTRAINT [FK_Fixture_Knot] FOREIGN KEY([Knot])
REFERENCES [dbo].[Knot] ([Id])
GO
ALTER TABLE [dbo].[Fixture] CHECK CONSTRAINT [FK_Fixture_Knot]
GO
/****** Object:  ForeignKey [FK_Line_Knot]    Script Date: 04/05/2011 20:21:12 ******/
ALTER TABLE [dbo].[Line]  WITH CHECK ADD  CONSTRAINT [FK_Line_Knot] FOREIGN KEY([Knot])
REFERENCES [dbo].[Knot] ([Id])
GO
ALTER TABLE [dbo].[Line] CHECK CONSTRAINT [FK_Line_Knot]
GO
/****** Object:  ForeignKey [FK_Step_Line]    Script Date: 04/05/2011 20:21:13 ******/
ALTER TABLE [dbo].[Step]  WITH CHECK ADD  CONSTRAINT [FK_Step_Line] FOREIGN KEY([Line])
REFERENCES [dbo].[Line] ([Id])
GO
ALTER TABLE [dbo].[Step] CHECK CONSTRAINT [FK_Step_Line]
GO
/****** Object:  ForeignKey [FK_Point_Step]    Script Date: 04/05/2011 20:21:13 ******/
ALTER TABLE [dbo].[Point]  WITH CHECK ADD  CONSTRAINT [FK_Point_Step] FOREIGN KEY([Step])
REFERENCES [dbo].[Step] ([Id])
GO
ALTER TABLE [dbo].[Point] CHECK CONSTRAINT [FK_Point_Step]
GO

Interface Manual

The Model has 7 important signatures: 4 member functions and 3 static functions of KnotModel class.
public KnotModel(): Initializes the knot model.
public void Add(): Add the knot instance into database.
public void Update(): Update the knot instance into database.
public void Save(string filename): Saves the knot into XML file.
public static List<KnotModel> GetAll(): Gets the all knot list from database.
public static KnotModel GetById(Guid id): Gets the knot by specified ID from database.
public static KnotModel Load(string filename): Loads knot form XML file.
Most people confuse different between Entity and Model, anybody knows different between memory and storage? that it! they design in different purpose. Entity use to persistent with database, however, Model use to represent business unit. One is storage oriented, another is business oriented.
One knot contains a lot of objects and lines(?), one line contains a lot of step and one step contain a lot of point. That logic is make sense, but Entity is not, isn't it.

Entity package

This is the final design of Entity, I and Jun decided to remove some useless function such as user as well as comment. Consequently, there are only 5 classes left, which are persistent 5 table in database.
Knot represent the knot entries in database, Fixture represent the objects such as tree, hook or loop for specified knot. Line represent the strings for specified knot, one knot has one, may be two(or more?) strings. Step represent the status or snapshot for particular string, the core functionality is show the steps of knot. Point store the sequence of point for particular step of line.

Architecture

Our system use EMVC architecture. Different between form MVC, I add a entity package which use to president with database table and data access. It is the common way to expend database stuff into MVC architecture.
Unfortunately, the code in final version do not really separate the Controller with View, which lose the testability of user interface(in MVC's purpose, Controller is testable), but anyway, Model is separated, so Model is testable and the unit test is finish.