. Required dynamic library support
Antl3.runtime. dll
Castle. Core. dll
Castle. DynamicProxy2.dll
Iesi. Collections. dll
Log4net. dll
Nhib.pdf. ByteCode. Castle. dll
Nhib.pdf. ByteCode. LinFu. dll
Nhib.pdf. dll
2. Create a database
If exists (SELECT * FROM dbo. sysobjects where id = object_id (N 'dbo. [CustomerOrders] ') and OBJECTPROPERTY (id, N 'isforeignkey') = 1)
Alter table dbo. [Order] drop constraint [CustomerOrders]
GO
If exists (SELECT * FROM dbo. sysobjects where id = object_id (N 'dbo. [OrderProducts] ') and OBJECTPROPERTY (id, n'isforeignkey') = 1)
Alter table dbo. [OrderProduct] drop constraint [OrderProducts]
GO
If exists (SELECT * FROM dbo. sysobjects where id = object_id (N 'dbo. [ProductOrders] ') and OBJECTPROPERTY (id, n'isforeignkey') = 1)
Alter table dbo. [OrderProduct] drop constraint [ProductOrders]
GO
If exists (SELECT * FROM dbo. sysobjects where id = object_id (N 'dbo. [Customer] ') and OBJECTPROPERTY (id, N 'isusertable') = 1)
Drop table dbo. [Customer]
GO
If exists (SELECT * FROM dbo. sysobjects where id = object_id (N 'dbo. [Order] ') and OBJECTPROPERTY (id, N 'isusertable') = 1)
Drop table dbo. [Order]
GO
If exists (SELECT * FROM dbo. sysobjects where id = object_id (N 'dbo. [OrderProduct] ') and OBJECTPROPERTY (id, N 'isusertable') = 1)
Drop table dbo. [OrderProduct]
GO
If exists (SELECT * FROM dbo. sysobjects where id = object_id (N 'dbo. [Product] ') and OBJECTPROPERTY (id, N 'isusertable') = 1)
Drop table dbo. [Product]
GO
Create table dbo. [Customer] (
[CustomerId] int IDENTITY (1, 1) not null,
[Firstname] varchar (50) NULL,
[Lastname] varchar (50) NULL
)
GO
Alter table dbo. [Customer] WITH NOCHECK ADD
CONSTRAINT [PK_Customer] PRIMARY KEY CLUSTERED
(
[CustomerId]
) ON [PRIMARY]
GO
Create table dbo. [Order] (
[OrderId] int IDENTITY (1, 1) not null,
[OrderDate] datetime DEFAULT (getdate () not null,
[Customer] int NOT NULL
)
GO
Alter table dbo. [Order] WITH NOCHECK ADD
CONSTRAINT [PK_Order] PRIMARY KEY CLUSTERED
(
[OrderId]
) ON [PRIMARY]
GO
Create table dbo. [OrderProduct] (
[Product] int not null,
[Order] int NOT NULL
)
GO
Alter table dbo. [OrderProduct] WITH NOCHECK ADD
CONSTRAINT [PK_OrderProduct] PRIMARY KEY CLUSTERED
(
[Product],
[Order]
) ON [PRIMARY]
GO
Create table dbo. [Product] (
[ProductId] int IDENTITY (1, 1) not null,
[Name] varchar (50) not null,
[Cost] decimal (18,2) NOT NULL
)
GO
Alter table dbo. [Product] WITH NOCHECK ADD
CONSTRAINT [PK_Product] PRIMARY KEY CLUSTERED
(
[ProductId]
) ON [PRIMARY]
GO
Alter table dbo. [Order] ADD
CONSTRAINT [CustomerOrders] FOREIGN KEY
(
[Customer]
) REFERENCES dbo. [Customer] (
[CustomerId]
)
GO
Alter table dbo. [OrderProduct] ADD
CONSTRAINT [OrderProducts] FOREIGN KEY
(
[Order]
) REFERENCES dbo. [Order] (
[OrderId]
)
GO
Alter table dbo. [OrderProduct] ADD
CONSTRAINT [ProductOrders] FOREIGN KEY
(
[Product]
) REFERENCES dbo. [Product] (
[ProductId]
)
GO
3. Use ORMCodeGenerator2.0 to generate hbml files and source code files
4. Modify the file if any configuration is incorrect.
5. Simple example project