且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用Databasefactory.Createdatabase函数时出错

更新时间:2023-10-15 23:24:34

您的项目中的dll版本与EF dll不匹配,或者您需要更改.NET的版本打靶。至少,这是我用谷歌发现的,我对你的具体问题没有任何实际经验。
There's a mismatch in dll versions in your project for the EF dll, or you need to change the version of .NET you're targetting. At least, that's what I found out using google, I don't have any actual experience with your specific issue.


这就是我如何调用DataBaseFactory



数据库db = DatabaseFactory.CreateDatabase();



This is how I call DataBaseFactory

Database db = DatabaseFactory.CreateDatabase();

public static Database CreateDatabase();
   //
   // Summary:
   //     Method for invoking a specified Database service object. Reads service settings
   //     from the ConnectionSettings.config file.
   //
   // Parameters:
   //   name:
   //     configuration key for database service
   //
   // Returns:
   //     Database
   //
   // Exceptions:
   //   System.Configuration.ConfigurationException:
   //     instanceName is not defined in configuration.
   //     - or -
   //     An error exists in the configuration.
   //     - or -
   //     An error occured while reading the configuration.
   //
   //   System.Reflection.TargetInvocationException:
   //     The constructor being called throws an exception.