make portable for win81 & wp81
at now, the portable lib is useless, since the io api isn't portable for .net4 & winrt & sl. i made the patch to let the portable lib work for winrt8.1 & wp8.1.
Thank you, sunnycase.
The problem you have addressed doesn't really exist. PCL Version of Lex.DB is not intended to run on actual device, it exists purely for linking purposes of other PCL libraries. Since the final application is always platform specific, it has to be distributed with platform specific version of Lex.DB. This approach is called Bait and Switch.
More to read about it here: http://log.paulbetts.org/the-bait-and-switch-pcl-trick/
you are right. but there is another problem, the winrt81 & wpa81 can share a set of common apis. if you separate them to 2 different libs, a pcl lib targeting winrt81 & wpa81 cannot use lex.db. i think it would be better to merge the 2 projects into one pcl lib. thank you.
sunnycase, could you please send me an example project that does not work? even empty one is sufficient. I just cannot reproduce the problem you are talking about. NuGet always chooses the correct package for PCL library and correct package for Windows Phone and/or Windows Store application.
Here is the repo: (https://github.com/sunnycase/LexDb.Test). When it start, it will throw NullReferenceException.
I see. You just need to install Lex.Db NuGet package on your Windows Phone & Windows Store applications. In this case, NuGet will pick up the correct platform-specific version of the lib.
Also, I believe passing Windows.Storage.ApplicationData.Current.RoamingFolder in DbInstance constructor will not work on a device. CreateFile2 API function has some limitations described by the link below: https://msdn.microsoft.com/en-us/library/windows/desktop/hh449422%28v=vs.85%29.aspx
When called from a Windows Store app, CreateFile2 is simplified. You can open only files or directories inside the ApplicationData.LocalFolder or Package.InstalledLocation directories.
it works, but making the thing a little complex. if there is a pcl lib targeting winrt81 & wpa81, everything get easy. and ApplicationData.Current.RoamingFolder works well using my patched lex.db.