创建一个带有易于安装 sql 数据库的 dotnetnuke 包
我对 dotnetnuke 和 asp.net 都是新手。我需要创建一个易于安装在不同 DNN 站点上的模块包。问题是需要手动添加 SQL 表和其他数据库对象。我希望在部署包时自动添加它们。正如我所说,我对这一切都很陌生,一步一步的解释会非常有帮助。
谢谢,
耶莱娜
I am new to dotnetnuke and asp.net altogether. I need to create a module package that is easy to install on a different DNN site. The problem is that SQL tables and other database objects need to be added manually. I would like them to be added automatically when the package is deployed. As I said I am new to all this and a step by step explanation would be very helpful.
Thanks,
Jelena
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是由 SqlDataProvider 文件处理的。
请注意,当您在 VS2010(或 VS2008)中创建 DotNetNuke 编译模块项目时,您最终会得到三个这样的文件,其中两个是这里关注的(我认为)
,有指向这些 SqqDataProvider 文件的条目:
另请注意,在清单中文件中,版本号与安装程序 SQL 文件上的前缀相对应:
最后,您将 DNN 模块打包到 .zip 文件中。我无法理解确切的结构,但 DNNCreative 和下面引用的书籍提供了大量信息。
获得可部署的 .zip 文件后,您可以像从 SnowCovered 购买的任何其他模块一样安装它。
我的建议是执行以下操作:
我使用了这两个资源,发现它们非常有用
This is handled by SqlDataProvider files.
Note, that when you create a DotNetNuke Compiled Module project in VS2010 (or VS2008), you end up with three such files, two of which are of concern here (I think)
Note in your DNN Manifest file, there are entries pointing to these SqqDataProvider files:
Also note, in the manifest file, that the version number corresponds to the prefix on the installer SQL file:
Finally, you will package your DNN Module into a .zip file. The exact structure evades me, but DNNCreative and the book referenced below have plenty of info.
Once you have the deployable .zip file, you install it just like any other module you might buy off SnowCovered.
My Suggestion is to do the following
I used both resources and found them very useful
好吧,我已经解决了这个问题,并想与那些可能仍在挣扎的人分享。创建包后,您需要将其解压缩并编辑一些文件。查看包中的 .dnn 文件。正如 Hamlin 指出的那样,您需要添加将执行 SQL 脚本并创建表、存储过程和其他数据库对象的脚本(而不是文件)。这是我添加到 dnn 文件中的代码部分。它被添加到组件标签中。
您需要在其中输入路径、文件类型、文件名和版本。然后,您需要创建清单中指定的数据提供程序文件。我使用 {databaseOwner} 和 {objectQualifier} 来确保新的数据库对象符合它们将安装的服务器。这些是区分大小写的,所以要小心,否则你会得到错误。我的 dataprovider 文件如下所示:
05.02.05.sqldataprovider
uninstall.sqldataprovider
确保 sqlconnections 适合新站点,并根据需要在包含连接的文件中进行更改(在我的例子中,我将它们放在 vb ascx 中) .vb 和 ascx 文件)。我使用此代码从 web.config 文件中提取信息并使连接适合任何站点。
vb 文件:
ascx 文件:
然后将所有文件(包括新的 dataprovider 文件)打包到 zip 文件中,然后就可以开始了。
O.K. I have gotten through this and would like to share with those who may be struggling still. Once you create a package you need to unzip it and edit some files. Take a look at the .dnn file in your package. There, as Hamlin pointed out, you need to add the SCRIPTS (not files) that will execute SQL scripts and create tables, stored procedures and other database objects. Here is the portion of the code I added to the dnn file. It is added to the components tag.
There you need to put in the paths, file types, file names and versions. Then you need to create the dataprovider files you indicated in the manifest. I used the {databaseOwner} and {objectQualifier} to make sure the new database objects comply with the server they will be installed on. Those are case sensitive so be careful, otherwise you will be getting errors. Here is what my dataprovider files look like:
05.02.05.sqldataprovider
uninstall.sqldataprovider
Make sure that the sqlconnections are appropriate for the new site and make changes if necessary in those files that contain the connections (in my case I had them in vb ascx.vb and ascx fle). I used this code to pull the information from the web.config file and make the connection appropriate for any site.
vb file:
ascx file:
Then package all the files including the new dataprovider files into a zip file and you should be good to go.