static NativeMethods()
        {
            var loaded = NativeLibraryLoader.TryLoad("sqlite3");

#if DNX451 || DNXCORE50
            // TODO: Remove when DNX supports native artifacts
            if (!loaded)
            {
                var library = CallContextServiceLocator
                              .Locator
                              .ServiceProvider
                              .GetRequiredService <ILibraryManager>()
                              .GetLibrary(typeof(NativeMethods).GetTypeInfo().Assembly.GetName().Name);

                var installPath = library.Path;
                if (library.Type == "Project")
                {
                    installPath = Path.GetDirectoryName(installPath);
                }

                loaded = NativeLibraryLoader.TryLoad("sqlite3", Path.Combine(installPath, "runtimes/win/native"));
            }
#endif

            Debug.Assert(loaded, "loaded is false.");
        }
        static NativeMethods()
        {
            // NOTE: This is used by AnyCPU applications to load the native library based on the process's
            //       architecture. It does nothing on DNX and Mono which handle native library loading themselves.
            var loaded = NativeLibraryLoader.TryLoad("sqlite3");

            Debug.Assert(loaded, "loaded is false.");
        }
Пример #3
0
        private static ISqlite3 Load(string dllName)
        {
            switch (dllName)
            {
            case "sqlite3":
#if NET451
                // NOTE: This is used by AnyCPU applications to load the native library based on the process's
                //       architecture. It does nothing on DNX and Mono which handle native library loading themselves.
                var loaded = NativeLibraryLoader.TryLoad("sqlite3");
                Debug.Assert(loaded, "loaded is false.");
#endif
                return(new Sqlite3_sqlite3());

            case "winsqlite3":
                return(new Sqlite3_winsqlite3());

            default:
                Debug.Fail("Unexpected dllName: " + dllName);
                goto case "sqlite3";
            }
        }