UWP "Creation of the database folder failed!"

Apr 16, 2016 at 12:30 AM
Edited Apr 16, 2016 at 12:32 AM
Hello,

i am making a UWP-App. On Local Machine I get this error and an emulator it works fine. I am using Win 10 and WP10 Emulator, latest version of DBreeze from NuGet.
public sealed partial class MainPage : Page
    {
        DBreezeEngine engine;
        public MainPage()
        {
            this.InitializeComponent();
            engine = new DBreezeEngine(new DBreezeConfiguration { DBreezeDataFolderName = @".\DATA" }); <--- Error here
        }

        private void button_Click(object sender, RoutedEventArgs e)
        {
            Form form = new TechnicalInspectionTemplate().Form;
            FormServiece fs = new FormServiece(engine);
            fs.saveForm(form);
            Form formO = fs.loadFormById(form.FormId);
        }
    }
Apr 16, 2016 at 8:50 AM
Ok, I have a temporally solution for my problem. In Debug-folder I have two new account (auto-generated by DBreeze?). I gave full access to this users for AppX-folder. And it works!
But this is bad solution. If I make Release the problem is back.
Coordinator
Apr 17, 2016 at 10:21 AM
Hi, would be nice if you could embed DBreeze sources to your project to find out the problem yourself, due to your environment.
Or create a prototype of your solution, so I could emulate such mistake locally.

Do you create Windows Phone application or UWP application?
I think WP is not the same, Microsoft recommends to use PLC .NET subset there.
It's much more cropped version, e.g. there is no System.IO.
DBreeze has ability to work under UWP, but not WP.

p.s.:
DBreeze should not generate any system account.
Apr 17, 2016 at 11:03 AM
Hi, I found fix for my problem. UWP-Apps have restriction for accessing folders.
 this.InitializeComponent();
            DBreezeEngine engine = new DBreezeEngine(new DBreezeConfiguration { DBreezeDataFolderName = ApplicationData.Current.LocalFolder.Path+ "\\DBTestBreeze"});
            using(var ts = engine.GetTransaction())
            {
                int i = 100000;
                int j = 200000;
                int k = 1000;
                while (k != 0)
                {
                    k--;
                    i++;
                    j++;
                    ts.Insert<int, int>("Test", i, j);
                    ts.Commit();
                }
                
            }
            engine.Dispose();
Using ApplicationData.Current.LocalFolder.Path fixed my problem.
And i think extra system account are auto-generetade special for UWP-Apps.
Coordinator
Apr 18, 2016 at 7:34 AM
Very well!!!
I also thought that path "./" is more for POSIX filesystems.

I found in your last code that you use ts.Commit inside of while loop.
I think better to Commit after While.... in the end of transaction.
Speed will grow up.