Hello. I develop C# WPF MVVM Prism modular application in MS VS 2015 Professional in Windows 10 OS. My application has Shell project and many Prism Module projects. Also my application contains CommonClassLibrary class library project where I define ConnectionService class that is applicable Prism service. ConnectionService class implements IConnectionService interface which define in CommonClassLibrary class library too. In the application bootstrapper I do (in particularly) the following C#-code:
class FcBootstrapper : UnityBootstrapper { . . . . . protected override void ConfigureContainer() { Container.RegisterType<IConnectionService, ConnectionService>(new ContainerControlledLifetimeManager()); base.ConfigureContainer(); } . . . . . } ConnectionService has (in particularly) the following methods: public bool CheckIfDatabaseExists() { if (!Directory.Exists(@"C:UsersMy_Data")) Directory.CreateDirectory(@"C:UsersMy_Data"); if (File.Exists(@"C:UsersMy_DataMy_Database.sqlite")) return true; else return false; } public void CreateDatabase() { SQLiteConnection.CreateFile(@"C:UsersKTM_DataKTM_Flowmeter.sqlite"); } public bool CheckIfTableExists(string tableName) { using (SQLiteConnection connection = new SQLiteConnection("Data Source=C:\Users\KTM_Flowmeter.sqlite;Version=3;")) { connection.Open(); var command = connection.CreateCommand(); command.CommandText = @"SELECT COUNT(*) FROM sqlite_master WHERE name=@TableName"; var p_tableName = command.CreateParameter(); p_tableName.DbType = DbType.String; p_tableName.ParameterName = "TableName"; p_tableName.Value = tableName; command.Parameters.Add(p_tableName); var result = command.ExecuteScalar(); return ((long)result) == 1; } } In Shell project I have ViewModels folder containing ShellViewModel class. In ShellViewModel class constructor I try to execute the following C#-code: public ShellViewModel(IConnectionService connectionService) { . . . . . . . if (!this._connectionService.CheckIfDatabaseExists()) this._connectionService.CreateDatabase(); this._connectionService.CheckIfTableExists("AddedDevices"); . . . . . . . } And when CheckIfDatabaseExists() method is called and its 'Directory.CreateDirectory(@"C:UsersMy_Data");' line is executed then I have the following exception: "System.Windows.Markup.XamlParseException" in PresentationFramework.dll "Settings "Prism.Mvvm.ViewModelLocator.AutoWireViewModel" property has called exception...". If I try to execute 'Directory.CreateDirectory(@"C:UsersMy_Data");' line of code directly in ShellViewModel class constructor then the same error has place. If I change CheckIfDatabaseExists method as the following: public bool CheckIfDatabaseExists() { if (File.Exists(@"My_Database.sqlite")) return true; else return false; } and change CreateDatabase method as public void CreateDatabase() { SQLiteConnection.CreateFile("My_Database.sqlite"); } and call if (!this._connectionService.CheckIfDatabaseExists()) this._connectionService.CreateDatabase(); then if My_Database.sqlite database is not existed ofcourse it is created. But when I after it call CheckIfTableExists method then on 'using (SQLiteConnection connection = new SQLiteConnection("Data Source=My_Database.sqlite;Version=3;"))' line of code I also have "System.Windows.Markup.XamlParseException" in PresentationFramework.dll "Settings "Prism.Mvvm.ViewModelLocator.AutoWireViewModel" property has called exception..." error. What is the reason of this error? Please help. -- С уважением, Евгений Бузин Инженер программист ООО КТМ-Сервис Тел.: +7 846 202 00 65 доб. 151 Факс: +7 846 229 55 52 E-Mail: evgeniy.bu...@ktkprom.com www.ktkprom.ru [1] -- Best regard, Software Engineer Evgeniy Buzin JSC KTM-Service Tel.: +7 846 202 00 65 add 151 Fax: +7 846 229 55 52 E-Mail: evgeniy.bu...@ktkprom.com www.ktkprom.ru [1] Links: ------ [1] http://www.ktkprom.ru _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users