Spring.net中内置了hibernate,和分布式事务,可方便的实现ORM(对象关系映射)和事务管理
1.创建数据库
创建名为ERP的数据库,并创建表:Sale_Master[销售主表]、Sale_Detailed[销售明细表]
CREATE TABLE [dbo].[Sale_Master](
[ID] [int] IDENTITY(1,1) NOT NULL,
[CName] [nvarchar](50) NULL,
[CAddress] [nvarchar](50) NULL,
[CTel] [nvarchar](50) NULL,
[Store] [nvarchar](50) NULL,
CONSTRAINT [PK_Sale_Master] 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
CREATE TABLE [dbo].[Sale_Detailed](
[ID] [int] IDENTITY(1,1) NOT NULL,
[SaleID] [int] NULL,
[GoodsName] [nvarchar](5) NULL,
[Quantity] [numeric](18, 2) NULL,
[Price] [numeric](18, 2) NULL,
CONSTRAINT [PK_Sale_Detailed] 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
2.创建项目
如下图所示: