Devart.Data.MySql'功能不受支持。'错误

问题描述 投票:-1回答:1

我一直在拼命想找到一种方法来通知客户端数据库中的变化。

我尝试了TableDependency Package,但后来注意到它使用SQL而不是MYSQL。我偶然发现了Devart,他们也有同样的事情。我已经安装了软件包并设置了一些代码来测试它是否在数据库发生变化时实际收到通知。但是当我尝试运行它时返回异常:

Devart.Common.LicenseException:'不支持功能。

这是我用于测试的代码:

namespace WpfApp2
{

    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public string connectionString = @"server=198.23.60.117;user=*******;database=*******;password=*******";
        public MainWindow()
        {

            InitializeComponent();
        }


        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Devart.Data.MySql.MySqlConnection DependencyConn = new Devart.Data.MySql.MySqlConnection(connectionString);
            Devart.Data.MySql.MySqlCommand FriendsDependencyCommand = new Devart.Data.MySql.MySqlCommand("SELECT user_two FROM friends WHERE user_one=@username", DependencyConn);
            MySqlDependency dependency = new MySqlDependency(FriendsDependencyCommand, 100);
            dependency.OnChange += new OnChangeEventHandler(dependency_OnChange);
            DependencyConn.Open();
            MySqlDependency.Start(connectionString);
        }

        void dependency_OnChange(object sender, Devart.Data.MySql.MySqlTableChangeEventArgs e)
        {
            MessageBox.Show("Database Changes Detected.");
        }
    }
    public class Customer
    {
        public string Username { get; set; }
    }

}

我应该使用NuGet包管理器安装所需的Dependency。

Here's the documentation

有线索吗?我真的很感激。

c# mysql wpf devart
1个回答
2
投票

dotConnect for MySQL的当前实现包括两个版本的程序集:

1)随安装一起提供的.NET Framework Devart。*程序集:

    * assemblies are created at C:\Program Files (x86)\Devart\dotConnect/MySQL\ (by default)
    * licensing approach is described at https://www.devart.com/dotconnect/mysql/docs/?Licensing.html

2)通过NuGet提供的.NET标准(.NET Core)Devart。*程序集:

    * you can download packages from https://www.nuget.org/packages/devart.data.mysql
    * licensing approach is described at https://www.devart.com/dotconnect/mysql/docs/?LicensingStandard.html

“Devart.Common.LicenseException:'功能不受支持。'”错误表示运行时无法找到.NET Standard Devart。*程序集的许可证文件(或许可证密钥连接字符串参数)。请参阅https://www.devart.com/dotconnect/mysql/docs/?LicensingStandard.html

© www.soinside.com 2019 - 2024. All rights reserved.