程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> .NET實例教程 >> 用AppFramework重寫Discuz數據訪問層源代碼

用AppFramework重寫Discuz數據訪問層源代碼

編輯:.NET實例教程

下載地址:http://download.csdn.Net/source/331414 

修改的地方主要有:

1)在解決方案裡增加了“Discuz.Data.AppFramework”項目

2)AppFramework插件生成的代碼放在“Discuz.Data.AppFramework”項目的GenerateCode目錄下

3)對論壇管理的數據訪問類源代碼ForumManage.cs做了重寫

4)修改 Discuz.Web目錄下的DNT.config,設置數據庫訪類型為 AppFramework

安裝方法(請參考官方文檔,下面僅簡述):

1)用VS2005打開解決方案編譯

2)在IIS上創建站點,配置好站點主機頭,例如為discuz.AppFramework.com(記得把這個站點主機頭配置到hosts文件裡,這樣就可以用域名訪問),把主目錄指向Discuz.Web,設置站點的ASP.NET使用.NetFramework2.0;

3)在SqlServer裡創建數據庫,在DNT.config設置好數據庫連接;

4)打開浏覽器,鍵入 http://discuz.AppFramework.com/Install;按向導提示完成安裝

5)然後就可以運行了

附錄:

安裝完數據庫後,要修改下dnt_forums表結構,把char類型修改為varchar(我認為Discuz這個表的設計不合理,修改了下)。否則在板塊管理裡添加或挪動板塊時會因字段值超長而報錯。建表腳本如下:

CREATE TABLE [dbo].[dnt_forums](
 [fid] [int] IDENTITY(1,1) NOT NULL,
 [parentid] [int] NOT NULL CONSTRAINT [DF__dnt_forum__paren__377B294A]  DEFAULT (''0''),
 [layer] [int] NOT NULL CONSTRAINT [DF__dnt_forum__layer__386F4D83]  DEFAULT (''0''),
 [pathlist] [nvarchar](3000) COLLATE Chinese_PRC_CI_AS NOT NULL CONSTRAINT [DF__dnt_forum__pathl__396371BC]  DEFAULT (''''),
 [parentidlist] [varchar](300) COLLATE Chinese_PRC_CI_AS NOT NULL,
 [subforumcount] [int] NOT NULL CONSTRAINT [DF__dnt_forum__subfo__3A5795F5]  DEFAULT (''''),
 [name] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL,
 [status] [int] NOT NULL CONSTRAINT [DF__dnt_forum__statu__3B4BBA2E]  DEFAULT (''0''),
 [colcount] [int] NOT NULL CONSTRAINT [DF_dnt_forums_colcount]  DEFAULT (''1''),
 [displayorder] [int] NOT NULL CONSTRAINT [DF__dnt_forum__displ__3C3FDE67]  DEFAULT (''0''),
 [templateid] [int] NOT NULL CONSTRAINT [DF__dnt_forum__style__3D3402A0]  DEFAULT (''0''),
 [topics] [int] NOT NULL CONSTRAINT [DF__dnt_forum__topic__3E2826D9]  DEFAULT (''0''),
 [curtopics] [int] NOT NULL CONSTRAINT [DF_dnt_forums_curtopics]  DEFAULT ((0)),
 [posts] [int] NOT NULL CONSTRAINT [DF__dnt_forum__posts__3F1C4B12]  DEFAULT (''0''),

$False$


 [todayposts] [int] NOT NULL CONSTRAINT [DF__dnt_forum__today__40106F4B]  DEFAULT (''0''),
 [lasttid] [int] NOT NULL CONSTRAINT [DF__dnt_forum__lastt__41049384]  DEFAULT (''0''),
 [lasttitle] [nvarchar](60) COLLATE Chinese_PRC_CI_AS NOT NULL CONSTRAINT [DF__dnt_forum__lastt__41F8B7BD]  DEFAULT (''''),
 [lastpost] [datetime] NOT NULL CONSTRAINT [DF__dnt_forum__lastp__42ECDBF6]  DEFAULT (''''),
 [lastposterid] [int] NOT NULL CONSTRAINT [DF__dnt_forum__lastp__43E1002F]  DEFAULT (''''),
 [lastposter] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL CONSTRAINT [DF__dnt_forum__lastp__44D52468]  DEFAULT (''''),
 [allowsmilIEs] [int] NOT NULL CONSTRAINT [DF__dnt_forum__allow__45C948A1]  DEFAULT (''0''),
 [allowrss] [int] NOT NULL CONSTRAINT [DF__dnt_forum__allow__46BD6CDA]  DEFAULT (''0''),
 [allowHtml] [int] NOT NULL CONSTRAINT [DF__dnt_forum__allow__47B19113]  DEFAULT (''0''),
 [allowbbcode] [int] NOT NULL CONSTRAINT [DF__dnt_forum__allow__48A5B54C]  DEFAULT (''0''),
 [allowimgcode] [int] NOT NULL CONSTRAINT [DF__dnt_forum__allow__4999D985]  DEFAULT (''0''),
 [allowblog] [int] NOT NULL CONSTRAINT [DF__dnt_forum__allow__4A8DFDBE]  DEFAULT (''0''),
 [allowtrade] [int] NOT NULL CONSTRAINT [DF__dnt_forum__allow__4B8221F7]  DEFAULT (''0''),
 [alloweditrules] [int] NOT NULL CONSTRAINT [DF__dnt_forum__allow__4C764630]  DEFAULT (''0''),
 [allowthumbnail] [int] NOT NULL CONSTRAINT [DF_dnt_forum_allowthumbnail]  DEFAULT (''0''),
 [recyclebin] [int] NOT NULL CONSTRAINT [DF__dnt_forum__recyc__4D6A6A69]  DEFAULT (''0''),
 [modnewposts] [int] NOT NULL CONSTRAINT [DF__dnt_forum__modne__4E5E8EA2]  DEFAULT (''0''),
 [jammer] [int] NOT NULL CONSTRAINT [DF__dnt_forum__jamme__4F52B2DB]  DEFAULT (''0''),
 [disablewatermark] [int] NOT NULL CONSTRAINT [DF__dnt_forum__disab__5046D714]  DEFAULT (''0''),
 [inheritedmod] [int] NOT NULL CONSTRAINT [DF__dnt_forum__inher__513AFB4D]  DEFAULT (''0''),
 [autoclose] [int] NOT NULL CONSTRAINT [DF__dnt_forum__autoc__522F1F86]  DEFAULT (''0''),


 CONSTRAINT [PK_dnt_forums] PRIMARY KEY CLUSTERED
(
 [fid] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved