如何使用MySQL数据库与果园CMS 1.3.10? [英] How to use MySQL database with Orchard CMS 1.3.10?

查看:172
本文介绍了如何使用MySQL数据库与果园CMS 1.3.10?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图改变Orchard.Setup模块,所以我可以为datase使用MySQL安装果园CMS 1.3.10。

I am trying to change the Orchard.Setup module so i can install Orchard CMS 1.3.10 with MySQL as datase.

我来这么久,我在GUI中进行设置让MySQL和我preSS设置按钮,我从果园收到此错误信息:

I come so long that i getting MySQL in the GUI for setup and when i press setup button i getting this error message from orchard:

The value 'MySql' is not valid for DatabaseOptions.

但我找不到我怎么加入MySQL作为DatabaseOptions,做别人得到它的使用MySQL的?

But i can not find how i adding MySql as DatabaseOptions, do anyone else get it to work with MySQL?

MySQL的旧模块不兼容wtih果园CMS的最新版本,这就是为什么它戒指由我自己做的,如果我得到它的工作我要发布它的开源供他人使用。

The old module for MySQL is not compatible wtih the latest version of Orchard CMS thats why it ring to make it by my own, if i get it to work i going to release it open source for others to use.

推荐答案

你在谈论的错误是因为DatabaseOptions属性是一个布尔值。你需要更改属性接受字符串值。还有在安装控制器,你需要改变物业的使用方式有几个地方...

The error you're talking about is because the DatabaseOptions property is a boolean. You'll need to change that property to accept string values. There are a few places in the Setup Controller that you'll need to change how that property is used...

不过,最重要的部分是实现一个DataServicesProvider。我说我的核心,但我认为你可以只是把它的设置模块为特征。矿山看起来像这样...

However, the most important part is to implement a DataServicesProvider. I added mine to core, but I think you could just put it in the Setup Module as a feature. Mine looks like this...

namespace Orchard.Data.Providers {
    public class MySqlDataServiceProvider : AbstractDataServicesProvider
    {
        private readonly string _connectionString;

        public MySqlDataServiceProvider(string dataFolder, string connectionString)
        {
            _connectionString = connectionString;
        }

        public static string ProviderName
        {
            get { return "MySql"; }
        }

        public override IPersistenceConfigurer GetPersistenceConfigurer(bool createDatabase)
        {
            var persistence = MySQLConfiguration.Standard;

            if (string.IsNullOrEmpty(_connectionString))
            {
                throw new ArgumentException("The connection string is empty");
            }

            persistence = persistence.ConnectionString(_connectionString);
            return persistence;
        }
    }
}

哦,别忘了你需要引用MySql.Data。它可以作为一个的NuGet包。

Oh, and don't forget you'll need to reference MySql.Data. It's available as a NuGet package.

这篇关于如何使用MySQL数据库与果园CMS 1.3.10?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆