On .NET Core, you determine the platform like this (full namespaces since this is a new spot):
System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows); System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Linux); System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX); As far as a configuration to map to libraries with different names per platform, I don’t believe there is a solution yet, but hope someone can prove me wrong. It would be messy to have multiple “extern” methods decorated with the different platform-specific names and call the appropriate method based on the “IsOSPlatform” checks above, but I guess that would work. > On Dec 4, 2016, at 10:47 PM, Daniel Morgan <[email protected]> wrote: > > How do I determine what operating system/platform > .net core is running on? > > On Mono, you could handle different library names and file extensions via a > config file for the library. .net framework does not have this. Not sure > about .net core. > > Example, i have a library foo.dll on Windows, libfooclient.so on Linux and > libfoo.dynlib on macOS. > > I ported mono's old Odbc to .net core. Porting the .Net Reference > implementation would be better, but this was an effort so we could connect to > data sources with no .net core data access provider like IBM DB2 now. > > https://github.com/LinqDan/Mono.Data.OdbcCore > <https://github.com/LinqDan/Mono.Data.OdbcCore> > > Same thing with the oracle client i ported, i need to modify it to work on > Linux too. > > Any suggestions? > > Thanks, > Daniel > > danmorg on GimpNet IRC > > Begin forwarded message: > >> From: Daniel Morgan <[email protected] <mailto:[email protected]>> >> Date: November 11, 2016 at 9:44:42 AM EST >> To: [email protected] <mailto:[email protected]> >> Subject: Oracle .net core provider >> >> I took Mono Project's System.Data.OracleClient implementation and modified >> it for .net core. It works on .net core via visual studio 2015 on a Windows >> 10 64-bit machine with a local Oracle 12c database. Feel free to fork it. >> >> This was done in one evening to get it to build and run. It will need to be >> reviewed and cleaned up. >> >> Some notes: >> - string.Copy does not exist in .net core so i just called ToString or set a >> reference. So, i need to re-visit that code in oci define handles and >> parameters. >> - no DataTable so a lot of code for getting schema and db data adapter was >> commented. >> - string.Compare(string, string, bool, globalization) did not exist but >> Compare(string, string, bool does. >> - remove all design-time component attributes >> - added various usings for the different namespaces for some stuff >> - added reference to System.Data.Common >> - I may have added SqlClient as well for SqlTypes.INullable. Added other >> references to satisfy errors. >> >> >> https://github.com/LinqDan/oracleclientcore >> <https://github.com/LinqDan/oracleclientcore> >> >> https://blogs.msdn.microsoft.com/dotnet/2016/11/09/net-core-data-access/ >> <https://blogs.msdn.microsoft.com/dotnet/2016/11/09/net-core-data-access/> >> >> What would it take to build a EF Core provider for Oracle? >> >> Been awhile since i played with Mono. > _______________________________________________ > Mono-devel-list mailing list > [email protected] > http://lists.dot.net/mailman/listinfo/mono-devel-list
_______________________________________________ Mono-devel-list mailing list [email protected] http://lists.dot.net/mailman/listinfo/mono-devel-list
