├── Common.props ├── Documentation ├── HowDoI.md ├── SystemStats.md ├── ManagedEsentApis.md ├── MultiValueTutorial.md ├── CppDictionarySample.md ├── CppManagedEsentSample.md ├── IpyManagedEsentSample.md ├── PersistentDictionary.docx ├── VbNetDictionarySample.md ├── VbNetManagedEsentSample.md ├── FSharpManagedEsentSample.md └── ManagedEsentDocumentation.md ├── Pixie ├── lexit.bat ├── app.config ├── TODO.txt ├── PixieTests │ ├── TestUtilities.cs │ ├── TestSqlImpl.cs │ ├── IndexDefinitionTests.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── JetParameterTests.cs ├── SqlConnection.cs ├── Scanner.cs ├── Bookmark.cs ├── Settings.StyleCop ├── IConnectionManager.cs ├── EsentSqlExecutionException.cs ├── EsentReadOnlyException.cs ├── Record.cs ├── SqlScanner.lex ├── EsentColumnNotFoundException.cs ├── EsentSqlParseException.cs ├── Properties │ └── AssemblyInfo.cs └── DisposableObjectId.cs ├── UWPSample ├── Assets │ ├── StoreLogo.png │ ├── LockScreenLogo.scale-200.png │ ├── SplashScreen.scale-200.png │ ├── Square44x44Logo.scale-200.png │ ├── Wide310x150Logo.scale-200.png │ ├── Square150x150Logo.scale-200.png │ └── Square44x44Logo.targetsize-24_altform-unplated.png ├── App.xaml ├── Properties │ ├── AssemblyInfo.cs │ └── Default.rd.xml └── Package.appxmanifest ├── External Components ├── gppg │ ├── binaries │ │ ├── gppg.exe │ │ └── ShiftReduceParser.dll │ └── documentation │ │ ├── gppg.pdf │ │ └── gppg-changelog.pdf ├── gplex │ ├── binaries │ │ ├── gplex.exe │ │ └── ShiftReduceParser.dll │ └── documentation │ │ ├── gplex.pdf │ │ ├── codepage.pdf │ │ ├── gplex-input.pdf │ │ └── gplex-changelog.pdf ├── Rhino.Mocks │ ├── Rhino.Mocks.dll │ ├── acknowledgements.txt │ └── license.txt └── Unity Application Block │ ├── Microsoft.Practices.Unity.dll │ ├── Microsoft.Practices.Unity.pdb │ ├── Microsoft.Practices.ObjectBuilder2.dll │ └── Microsoft.Practices.ObjectBuilder2.pdb ├── EsentInterop ├── Esent │ ├── ManagedEseLogo128x128.png │ ├── ..svnbridge │ │ └── ManagedEseLogo128x128.png │ ├── EsentNativeMethods.cs │ └── CallbackDataConverter.cs ├── ..svnbridge │ └── .svnbridge ├── Esent.vsmdi ├── jet_errorinfo.cs ├── INullableJetStruct.cs ├── Windows10Coltyp.cs ├── jet_objtyp.cs ├── jet_convert.cs ├── Windows7ExceptionAction.cs ├── Windows10Param.cs ├── jet_exceptionaction.cs ├── jet_cp.cs ├── IDeepCloneable.cs ├── jet_objinfo.cs ├── ijet_logtime.cs ├── objectinfogrbit.cs ├── ColumnHelper.cs ├── Windows81DbInfo.cs ├── Windows81Param.cs ├── jet_move.cs ├── jet_filetype.cs ├── LegacyFileNames.cs ├── Server2003Param.cs ├── IContentEquatable.cs ├── VistaColtyp.cs ├── jet_colinfo.cs ├── jet_dbstate.cs ├── jet_pfnrealloc.cs ├── jet_snt.cs ├── jet_sesparam.cs ├── JET_eventlogginglevel.cs ├── jet_snp.cs ├── jet_iopriority.cs ├── VistaColinfo.cs ├── EsentInterop.csproj ├── Windows8IdxInfo.cs ├── Windows10NativeMethods.cs ├── Windows81InstanceParameters.cs ├── Windows10Sesparam.cs ├── jet_callback.cs ├── Windows7Idxinfo.cs ├── jet_pfndurablecommitcallback.cs ├── EsentInvalidColumnException.cs ├── TableidColumnInfoEnumerator.cs ├── OnlineMaintenanceHelpers.cs ├── BoxedValueCache.cs ├── ObjectInfoFlags.cs ├── EsentException.cs └── TableColumnInfoEnumerator.cs ├── EsentInteropSamples ├── DbUtil │ ├── app.config │ ├── ..svnbridge │ │ └── .svnbridge │ ├── tests │ │ └── expected_table.csv │ ├── Settings.StyleCop │ ├── Program.cs │ ├── test_dbutil.bat │ ├── DbUtil.csproj │ └── Properties │ │ └── AssemblyInfo.cs ├── BasicTest │ ├── app.config │ ├── ..svnbridge │ │ └── .svnbridge │ ├── BasicTest.csproj │ └── Properties │ │ └── AssemblyInfo.cs ├── EsentSample │ ├── app.config │ ├── ..svnbridge │ │ └── .svnbridge │ ├── EsentSample.csproj │ ├── Settings.StyleCop │ └── Properties │ │ └── AssemblyInfo.cs ├── StockSample │ ├── app.config │ ├── ..svnbridge │ │ └── .svnbridge │ ├── test_stocksample.bat │ ├── StockSample.csproj │ ├── Settings.StyleCop │ └── Properties │ │ └── AssemblyInfo.cs └── DbUtilTests │ ├── ..svnbridge │ └── .svnbridge │ ├── DbUtilTests.csproj │ └── Properties │ └── AssemblyInfo.cs ├── EsentCollectionsSamples ├── HelloWorld │ ├── app.config │ ├── ..svnbridge │ │ └── .svnbridge │ ├── Settings.StyleCop │ ├── HelloWorld.csproj │ ├── HelloWorld.cs │ └── Properties │ │ └── AssemblyInfo.cs └── RssDictionarySample │ ├── app.config │ ├── ..svnbridge │ └── .svnbridge │ ├── Settings.StyleCop │ ├── RssDictionarySample.csproj │ └── Properties │ └── AssemblyInfo.cs ├── Scripts ├── makelinks.pl ├── nuget │ └── ManagedEsent.nuspec └── signbinaries.bat ├── EsentCollections ├── ..svnbridge │ └── .svnbridge ├── Compare.cs ├── EsentCollections.csproj ├── ReadOnlyTransaction.cs ├── Settings.StyleCop ├── Copy.cs ├── PersistentDictionaryMath.cs └── PersistentDictionaryTracing.cs ├── EsentInteropTests ├── ..svnbridge │ └── .svnbridge ├── Constants.cs ├── Settings.StyleCop ├── Windows8BackupRestoreTests.cs ├── Windows10ToStringTests.cs ├── ApiTestHook.cs ├── EnumColumnValueTests.cs ├── ApiTestHookTests.cs ├── Windows8SerializationTests.cs ├── CompactDatabaseTests.cs └── MyContractResolver.cs ├── EsentCollectionsTests ├── ..svnbridge │ └── .svnbridge ├── Settings.StyleCop ├── ArrayShuffle.cs ├── EsentCollectionsTests.csproj ├── Properties │ └── AssemblyInfo.cs ├── Cleanup.cs └── EqualityAsserts.cs ├── Directory.Packages.props ├── isam ├── Settings.StyleCop ├── BoundCriteria.cs ├── isam.csproj ├── NativeMethods.cs └── UnicodeIndexFlags.cs ├── .gitignore ├── .github └── policies │ └── resourceManagement.yml ├── .tfs-ignore ├── README.md ├── LICENSE.md ├── PixieSamples ├── GettingStarted │ └── Properties │ │ └── AssemblyInfo.cs └── PixieConsole │ ├── app.rc │ └── AssemblyInfo.cpp └── isamunittests ├── Properties └── AssemblyInfo.cs └── isamunittests.csproj /Common.props: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Documentation/HowDoI.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/Documentation/HowDoI.md -------------------------------------------------------------------------------- /Documentation/SystemStats.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/Documentation/SystemStats.md -------------------------------------------------------------------------------- /Pixie/lexit.bat: -------------------------------------------------------------------------------- 1 | gppg\binaries\gppg.exe /no-lines /gplex SqlParser.y 2 | gplex\binaries\gplex.exe SqlScanner.lex 3 | -------------------------------------------------------------------------------- /UWPSample/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/UWPSample/Assets/StoreLogo.png -------------------------------------------------------------------------------- /Documentation/ManagedEsentApis.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/Documentation/ManagedEsentApis.md -------------------------------------------------------------------------------- /Documentation/MultiValueTutorial.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/Documentation/MultiValueTutorial.md -------------------------------------------------------------------------------- /Documentation/CppDictionarySample.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/Documentation/CppDictionarySample.md -------------------------------------------------------------------------------- /Documentation/CppManagedEsentSample.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/Documentation/CppManagedEsentSample.md -------------------------------------------------------------------------------- /Documentation/IpyManagedEsentSample.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/Documentation/IpyManagedEsentSample.md -------------------------------------------------------------------------------- /Documentation/PersistentDictionary.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/Documentation/PersistentDictionary.docx -------------------------------------------------------------------------------- /Documentation/VbNetDictionarySample.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/Documentation/VbNetDictionarySample.md -------------------------------------------------------------------------------- /Documentation/VbNetManagedEsentSample.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/Documentation/VbNetManagedEsentSample.md -------------------------------------------------------------------------------- /Documentation/FSharpManagedEsentSample.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/Documentation/FSharpManagedEsentSample.md -------------------------------------------------------------------------------- /Documentation/ManagedEsentDocumentation.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/Documentation/ManagedEsentDocumentation.md -------------------------------------------------------------------------------- /External Components/gppg/binaries/gppg.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/External Components/gppg/binaries/gppg.exe -------------------------------------------------------------------------------- /EsentInterop/Esent/ManagedEseLogo128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/EsentInterop/Esent/ManagedEseLogo128x128.png -------------------------------------------------------------------------------- /External Components/gplex/binaries/gplex.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/External Components/gplex/binaries/gplex.exe -------------------------------------------------------------------------------- /UWPSample/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/UWPSample/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /UWPSample/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/UWPSample/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /External Components/Rhino.Mocks/Rhino.Mocks.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/External Components/Rhino.Mocks/Rhino.Mocks.dll -------------------------------------------------------------------------------- /External Components/gppg/documentation/gppg.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/External Components/gppg/documentation/gppg.pdf -------------------------------------------------------------------------------- /UWPSample/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/UWPSample/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /UWPSample/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/UWPSample/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /External Components/gplex/documentation/gplex.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/External Components/gplex/documentation/gplex.pdf -------------------------------------------------------------------------------- /Pixie/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /UWPSample/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/UWPSample/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /External Components/gplex/documentation/codepage.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/External Components/gplex/documentation/codepage.pdf -------------------------------------------------------------------------------- /External Components/gplex/documentation/gplex-input.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/External Components/gplex/documentation/gplex-input.pdf -------------------------------------------------------------------------------- /External Components/gppg/binaries/ShiftReduceParser.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/External Components/gppg/binaries/ShiftReduceParser.dll -------------------------------------------------------------------------------- /External Components/gplex/binaries/ShiftReduceParser.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/External Components/gplex/binaries/ShiftReduceParser.dll -------------------------------------------------------------------------------- /External Components/gppg/documentation/gppg-changelog.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/External Components/gppg/documentation/gppg-changelog.pdf -------------------------------------------------------------------------------- /External Components/gplex/documentation/gplex-changelog.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/External Components/gplex/documentation/gplex-changelog.pdf -------------------------------------------------------------------------------- /UWPSample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/UWPSample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /External Components/Unity Application Block/Microsoft.Practices.Unity.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/External Components/Unity Application Block/Microsoft.Practices.Unity.dll -------------------------------------------------------------------------------- /External Components/Unity Application Block/Microsoft.Practices.Unity.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/External Components/Unity Application Block/Microsoft.Practices.Unity.pdb -------------------------------------------------------------------------------- /EsentInteropSamples/DbUtil/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /EsentInteropSamples/BasicTest/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /EsentInteropSamples/EsentSample/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /EsentInteropSamples/StockSample/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /EsentCollectionsSamples/HelloWorld/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /External Components/Unity Application Block/Microsoft.Practices.ObjectBuilder2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/External Components/Unity Application Block/Microsoft.Practices.ObjectBuilder2.dll -------------------------------------------------------------------------------- /External Components/Unity Application Block/Microsoft.Practices.ObjectBuilder2.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ManagedEsent/HEAD/External Components/Unity Application Block/Microsoft.Practices.ObjectBuilder2.pdb -------------------------------------------------------------------------------- /EsentCollectionsSamples/RssDictionarySample/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Scripts/makelinks.pl: -------------------------------------------------------------------------------- 1 | # JetOSSnapshotPrepareInstance 2 | while (<>) { 3 | if (/a href=\"([^\"]+)\" title=\"(\w+)\"/) { 4 | print "[url:$2|$1]\n"; 5 | } 6 | } -------------------------------------------------------------------------------- /UWPSample/App.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Pixie/TODO.txt: -------------------------------------------------------------------------------- 1 | Global schema, invalidate when meta-data updates. 2 | Move ColumnDefinition members to ColumnMetaData. The IsNonNull flag has to be set if there is an index contianing the column with IndexDisallowNull 3 | INSERT OR REPLACE 4 | Record.HasChanges / IsUnsaved 5 | 6 | -------------------------------------------------------------------------------- /External Components/Rhino.Mocks/acknowledgements.txt: -------------------------------------------------------------------------------- 1 | Rhino Mocks is using Castle Dynamic Proxy (http://www.castleproject.org/dynamicproxy/index.html) to handle proxying the types it needs to mock. 2 | The Dynamic Proxy project has been invaluable resource and made creating Rhino Mocks possible. -------------------------------------------------------------------------------- /EsentInteropSamples/DbUtilTests/..svnbridge/.svnbridge: -------------------------------------------------------------------------------- 1 | svn:ignore*.Cache 2 | -------------------------------------------------------------------------------- /EsentInteropSamples/EsentSample/..svnbridge/.svnbridge: -------------------------------------------------------------------------------- 1 | svn:ignore*.Cache 2 | -------------------------------------------------------------------------------- /EsentInteropSamples/StockSample/..svnbridge/.svnbridge: -------------------------------------------------------------------------------- 1 | svn:ignore*.Cache 2 | -------------------------------------------------------------------------------- /EsentInteropSamples/BasicTest/..svnbridge/.svnbridge: -------------------------------------------------------------------------------- 1 | svn:ignoreStyleCop.Cache 2 | -------------------------------------------------------------------------------- /EsentInterop/Esent/..svnbridge/ManagedEseLogo128x128.png: -------------------------------------------------------------------------------- 1 | svn:mime-typeapplication/octet-stream -------------------------------------------------------------------------------- /EsentCollections/..svnbridge/.svnbridge: -------------------------------------------------------------------------------- 1 | svn:ignorebin 2 | obj 3 | svn:ignorebin 4 | obj 5 | *.Cache 6 | -------------------------------------------------------------------------------- /EsentInteropTests/..svnbridge/.svnbridge: -------------------------------------------------------------------------------- 1 | svn:ignorebin 2 | obj 3 | svn:ignorebin 4 | obj 5 | *.Cache 6 | -------------------------------------------------------------------------------- /EsentCollectionsTests/..svnbridge/.svnbridge: -------------------------------------------------------------------------------- 1 | svn:ignorebin 2 | obj 3 | svn:ignorebin 4 | obj 5 | *.Cache 6 | -------------------------------------------------------------------------------- /EsentInteropSamples/DbUtil/..svnbridge/.svnbridge: -------------------------------------------------------------------------------- 1 | svn:ignore*.Cache 2 | svn:ignore*.Cache 3 | bin 4 | obj 5 | -------------------------------------------------------------------------------- /EsentCollectionsSamples/HelloWorld/..svnbridge/.svnbridge: -------------------------------------------------------------------------------- 1 | svn:ignore*.Cache 2 | svn:ignore*.Cache 3 | bin 4 | obj 5 | -------------------------------------------------------------------------------- /EsentCollectionsSamples/RssDictionarySample/..svnbridge/.svnbridge: -------------------------------------------------------------------------------- 1 | svn:ignore*.Cache 2 | svn:ignore*.Cache 3 | bin 4 | obj 5 | -------------------------------------------------------------------------------- /Directory.Packages.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | true 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /isam/Settings.StyleCop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | False 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore SlickEdit files. 2 | *.vpj 3 | *.vpw 4 | *.vpwhist 5 | *.vtg 6 | 7 | # Visual Studio files 8 | *.[Oo]bj 9 | *.user 10 | *.aps 11 | *.pch 12 | *_i.c 13 | *_p.c 14 | *.ncb 15 | *.opendb 16 | *.suo 17 | *.exe.config 18 | *.dbmdl 19 | *.refactorlog 20 | *.userprefs 21 | .vs/ 22 | .vscode/ 23 | CustomBuild.properties 24 | 25 | # Test files 26 | testresults/ 27 | 28 | # Ojbect files 29 | bin/ 30 | obj/ 31 | 32 | # Other files 33 | *.cache 34 | 35 | # Log files 36 | msbuild.log 37 | msbuild.err -------------------------------------------------------------------------------- /EsentInteropSamples/DbUtil/tests/expected_table.csv: -------------------------------------------------------------------------------- 1 | ascii,binary,bit,byte,currency,double,key,long,short,single,unicode 2 | ,,,,,,1,,,, 3 | ",",0102ea4f00,True,30,-9223372036854775808,3.14159265358979,2,1,0,2.718282," ""quoting"" " 4 | ,,,,,0,3,0,,,Record 0 5 | ,,,,,1.1,4,1,,,Record 1 6 | ,,,,,2.2,5,2,,,Record 2 7 | ,,,,,3.3,6,3,,,Record 3 8 | ,,,,,4.4,7,4,,,Record 4 9 | ,,,,,5.5,8,5,,,Record 5 10 | ,,,,,6.6,9,6,,,Record 6 11 | ,,,,,7.7,10,7,,,Record 7 12 | ,,,,,8.8,11,8,,,Record 8 13 | ,,,,,9.9,12,9,,,Record 9 14 | -------------------------------------------------------------------------------- /EsentInterop/..svnbridge/.svnbridge: -------------------------------------------------------------------------------- 1 | svn:ignoreTestResults 2 | _ReSharper.Esent 3 | bin 4 | obj 5 | *.user 6 | *.suo 7 | svn:ignoreTestResults 8 | _ReSharper.Esent 9 | bin 10 | obj 11 | *.user 12 | *.suo 13 | Esent.Interop.xml 14 | -------------------------------------------------------------------------------- /EsentInterop/Esent.vsmdi: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.github/policies/resourceManagement.yml: -------------------------------------------------------------------------------- 1 | id: 2 | name: GitOps.PullRequestIssueManagement 3 | description: GitOps.PullRequestIssueManagement primitive 4 | owner: 5 | resource: repository 6 | disabled: false 7 | where: 8 | configuration: 9 | resourceManagementConfiguration: 10 | scheduledSearches: [] 11 | eventResponderTasks: 12 | - if: 13 | - payloadType: Pull_Request 14 | - isAction: 15 | action: Opened 16 | then: 17 | - addCodeFlowLink 18 | description: 19 | onFailure: 20 | onSuccess: 21 | -------------------------------------------------------------------------------- /Pixie/PixieTests/TestUtilities.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | using System; 8 | 9 | namespace PixieTests 10 | { 11 | internal class TestUtilities 12 | { 13 | public static void FinalizeAndGCCollect() 14 | { 15 | GC.Collect(); 16 | GC.WaitForPendingFinalizers(); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /.tfs-ignore: -------------------------------------------------------------------------------- 1 | 2 | bin 3 | obj 4 | _Resharper* 5 | *.resharper 6 | *.suo 7 | *.user 8 | Esent.Interop.xml 9 | StyleCop.Cache 10 | Debug 11 | Release 12 | TestResults 13 | app.manifest 14 | *.ncb 15 | *.lst 16 | 17 | -------------------------------------------------------------------------------- /EsentInterop/jet_errorinfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop.Windows8 8 | { 9 | /// 10 | /// The valid values of InfoLevel for JetGetErrorInfo. 11 | /// 12 | public enum JET_ErrorInfo 13 | { 14 | /// 15 | /// Retrieve information about the specific error passed in pvContext. 16 | /// 17 | SpecificErr = 1, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /EsentInteropSamples/DbUtil/Settings.StyleCop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | True 8 | 9 | 10 | 11 | 12 | True 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /EsentInterop/INullableJetStruct.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | /// 10 | /// Interface for Jet structures that are nullable (can have null values). 11 | /// 12 | public interface INullableJetStruct 13 | { 14 | /// 15 | /// Gets a value indicating whether the structure has a null value. 16 | /// 17 | bool HasValue { get; } 18 | } 19 | } -------------------------------------------------------------------------------- /EsentInterop/Windows10Coltyp.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop.Windows10 8 | { 9 | /// 10 | /// Column types that have been added to the Windows 10 version of ESENT. 11 | /// 12 | public static class Windows10Coltyp 13 | { 14 | /// 15 | /// Unsigned 64-bit number. 16 | /// 17 | public const JET_coltyp UnsignedLongLong = (JET_coltyp)18; 18 | } 19 | } -------------------------------------------------------------------------------- /EsentInterop/jet_objtyp.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | /// 10 | /// Type of an ESENT object. 11 | /// 12 | public enum JET_objtyp 13 | { 14 | /// 15 | /// Invalid object type. 16 | /// 17 | Nil = 0, 18 | 19 | /// 20 | /// Object is a table. 21 | /// 22 | Table = 1, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Pixie/SqlConnection.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | using System; 8 | 9 | namespace Microsoft.Isam.Esent 10 | { 11 | /// 12 | /// Parse a SQL statement and execute the commands. 13 | /// 14 | public interface SqlConnection : IDisposable 15 | { 16 | /// 17 | /// Parse and execute the SQL command. 18 | /// 19 | /// The command to execute. 20 | void Execute(string command); 21 | } 22 | } -------------------------------------------------------------------------------- /EsentInterop/jet_convert.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | #if !MANAGEDESENT_ON_WSA // Not exposed in MSDK 8 | namespace Microsoft.Isam.Esent.Interop 9 | { 10 | using System; 11 | 12 | /// 13 | /// Conversion options for . This feature 14 | /// was discontinued in Windows Server 2003. 15 | /// 16 | [Obsolete("Not available in Windows Server 2003 and up.")] 17 | public abstract class JET_CONVERT 18 | { 19 | } 20 | } 21 | #endif // !MANAGEDESENT_ON_WSA -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ESENT Managed Interop 2 | ManagedEsent provides managed access to esent.dll, the embeddable database engine native to Windows. 3 | 4 | The **[Microsoft.Isam.Esent.Interop](Documentation/ManagedEsentDocumentation.md)** namespace in EsentInterop.dll provides managed access to the basic ESENT API. Use this for applications that want access to the full ESENT feature set. 5 | 6 | The **[PersistentDictionary](Documentation/PersistentDictionaryDocumentation.md)** class in EsentCollections.dll provides a persistent, generic dictionary for .NET, with LINQ support. A PersistentDictionary is backed by an ESENT database and can be used to replace a standard Dictionary, HashTable, or SortedList. Use it when you want extremely simple, reliable and fast data persistence. 7 | 8 | **esedb** provides both dbm and shelve modules built on top of ESENT IronPython users. -------------------------------------------------------------------------------- /Pixie/Scanner.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Sql.Parsing 8 | { 9 | /// 10 | /// Scanner implementation. 11 | /// 12 | internal partial class Scanner : ScanBase 13 | { 14 | /// 15 | /// Set the string to be tokenized by the scanner. 16 | /// 17 | /// The string to be tokenized. 18 | public void SetSource(string command) 19 | { 20 | this.SetSource(command, 0); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Pixie/Bookmark.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent 8 | { 9 | /// 10 | /// A bookmark represents a cursor location. 11 | /// 12 | internal struct Bookmark 13 | { 14 | /// 15 | /// Gets or sets the ESE bookmark of the record. 16 | /// 17 | internal byte[] BookmarkData { get; set; } 18 | 19 | /// 20 | /// Gets or sets the length of the ESE bookmark. 21 | /// 22 | internal int BookmarkLength { get; set; } 23 | } 24 | } -------------------------------------------------------------------------------- /Pixie/PixieTests/TestSqlImpl.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | using Microsoft.Isam.Esent; 8 | 9 | namespace PixieTests 10 | { 11 | /// 12 | /// Inherit from the ISqlImpl class and provide a way to set the 13 | /// connection. 14 | /// 15 | internal class TestSqlImpl : SqlImplBase 16 | { 17 | public TestSqlImpl() 18 | : base() 19 | { 20 | } 21 | 22 | internal void FTO_SetConnection(Connection connection) 23 | { 24 | this.Connection = connection; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /EsentInterop/Esent/EsentNativeMethods.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | // 6 | // NativeMethods code that is specific to ESENT. 7 | // 8 | //----------------------------------------------------------------------- 9 | 10 | namespace Microsoft.Isam.Esent.Interop.Implementation 11 | { 12 | /// 13 | /// Configuration for functions in esent.dll. 14 | /// 15 | internal static partial class NativeMethods 16 | { 17 | /// 18 | /// The name of the DLL that the methods should be loaded from. 19 | /// 20 | private const string EsentDll = "esent.dll"; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /EsentInterop/Windows7ExceptionAction.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop.Windows7 8 | { 9 | /// 10 | /// Exception action that have been added to the Windows 7 version of ESENT. 11 | /// 12 | public static class Windows7ExceptionAction 13 | { 14 | /// 15 | /// Introduced in Windows 7. Use the Windows RaiseFailFastException API to force a crash. 16 | /// 17 | internal const JET_ExceptionAction FailFast = (JET_ExceptionAction)0x00000004; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Pixie/Settings.StyleCop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | False 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | False 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /EsentInterop/Windows10Param.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop.Windows10 8 | { 9 | /// 10 | /// System parameters that were introduced in Windows 10. 11 | /// 12 | public static class Windows10Param 13 | { 14 | /// 15 | /// This allows the client to specify a registry path preceded by a reg: to optionally configure 16 | /// loading or overriding parameters from the registry. 17 | /// 18 | public const JET_param ConfigStoreSpec = (JET_param)189; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /EsentInterop/jet_exceptionaction.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | /// 10 | /// Constants to be used with JET_paramExceptionAction. 11 | /// 12 | public enum JET_ExceptionAction 13 | { 14 | /// 15 | /// Display message box on exception. 16 | /// 17 | MsgBox = 0x00000001, 18 | 19 | /// 20 | /// Do not handle exceptions. Throw them to the caller. 21 | /// 22 | None = 0x00000002, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /EsentInterop/jet_cp.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | /// 10 | /// Codepage for an ESENT column. 11 | /// 12 | public enum JET_CP 13 | { 14 | /// 15 | /// Code page for non-text columns. 16 | /// 17 | None = 0, 18 | 19 | /// 20 | /// Unicode encoding. 21 | /// 22 | Unicode = 1200, 23 | 24 | /// 25 | /// ASCII encoding. 26 | /// 27 | ASCII = 1252, 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /EsentInterop/IDeepCloneable.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | /// 10 | /// Interface for objects that can be cloned. This creates a deep copy of 11 | /// the object. It is used for cloning meta-data objects. 12 | /// 13 | /// The type of object. 14 | public interface IDeepCloneable 15 | { 16 | /// 17 | /// Returns a deep copy of the object. 18 | /// 19 | /// A deep copy of the object. 20 | T DeepClone(); 21 | } 22 | } -------------------------------------------------------------------------------- /EsentInterop/jet_objinfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | /// 10 | /// Info levels for retrieving object info. 11 | /// 12 | internal enum JET_ObjInfo 13 | { 14 | /// 15 | /// Retrieve a JET_OBJINFOLIST containing information 16 | /// about all object in the table. 17 | /// 18 | ListNoStats = 1, 19 | 20 | /// 21 | /// Retrieve a JET_OBJINFO containing information 22 | /// about all object in the table. 23 | /// 24 | NoStats = 5, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /EsentInteropSamples/StockSample/test_stocksample.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | REM A simple test script for the StockSample executable. This batch 4 | REM file runs the commands and compares the output with the 5 | REM expected output. 6 | 7 | set DBDIR=test 8 | rmdir /s /q bin\debug\%DBDIR%\ 2> nul 9 | mkdir bin\debug\test\ 10 | pushd bin\debug\test 11 | 12 | echo Running StockSample... 13 | ..\StockSample > output.txt 14 | if NOT %ERRORLEVEL%==0 goto :Fail 15 | 16 | echo n | comp /a output.txt ..\..\..\expected_output.txt 1>nul 2>nul 17 | if NOT %ERRORLEVEL%==0 goto :Fail 18 | 19 | popd 20 | rmdir /s /q bin\debug\%DBDIR%\ 21 | 22 | echo. 23 | echo ********************************** 24 | echo Test Passed! 25 | echo ********************************** 26 | 27 | goto :EOF 28 | 29 | :Fail 30 | echo. 31 | echo ********************************** 32 | echo Test failed! 33 | echo ********************************** 34 | 35 | -------------------------------------------------------------------------------- /EsentCollectionsTests/Settings.StyleCop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | True 8 | 9 | 10 | 11 | 12 | True 13 | 14 | 15 | 16 | 17 | False 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /EsentInterop/ijet_logtime.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | using System; 10 | 11 | /// 12 | /// Interface for common methods between JET_LOGTIME and JET_BKLOGTIME. 13 | /// 14 | public interface IJET_LOGTIME : INullableJetStruct 15 | { 16 | /// 17 | /// Generate a DateTime representation of this IJET_LOGTIME. 18 | /// 19 | /// 20 | /// A DateTime representing the IJET_LOGTIME. If the IJET_LOGTIME 21 | /// is null then null is returned. 22 | /// 23 | DateTime? ToDateTime(); 24 | } 25 | } -------------------------------------------------------------------------------- /EsentInterop/objectinfogrbit.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | using System; 10 | 11 | /// 12 | /// Table options, used in . 13 | /// 14 | [Flags] 15 | public enum ObjectInfoGrbit 16 | { 17 | /// 18 | /// The table can have bookmarks. 19 | /// 20 | Bookmark = 0x1, 21 | 22 | /// 23 | /// The table can be rolled back. 24 | /// 25 | Rollback = 0x2, 26 | 27 | /// 28 | /// The table can be updated. 29 | /// 30 | Updatable = 0x4, 31 | } 32 | } -------------------------------------------------------------------------------- /isam/BoundCriteria.cs: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // 5 | // --------------------------------------------------------------------------- 6 | 7 | // --------------------------------------------------------------------- 8 | // 9 | // 10 | // --------------------------------------------------------------------- 11 | 12 | namespace Microsoft.Database.Isam 13 | { 14 | /// 15 | /// Choices for Cursor.FindRecordsBetween 16 | /// 17 | public enum BoundCriteria 18 | { 19 | /// 20 | /// Whether the bounds are included. 21 | /// 22 | Inclusive = 0, 23 | 24 | /// 25 | /// Whether the bounds are excluded. 26 | /// 27 | Exclusive = 1, 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /EsentInterop/ColumnHelper.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | using System; 10 | using System.Collections.Generic; 11 | 12 | /// 13 | /// Help to retrieve retrieve the column value from the current record 14 | /// 15 | internal sealed class ColumnHelper 16 | { 17 | /// 18 | /// Provides a hook to allow retrieve the column value from the current record 19 | /// These circumstances are based on API elements not yet published on MSDN. 20 | /// 21 | /// Retrieve column options> 22 | internal static void IsValidRetrieveColumnGrbit(RetrieveColumnGrbit grbit) 23 | { 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /EsentInteropTests/Constants.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace InteropApiTests 8 | { 9 | /// 10 | /// Constants used by tests. 11 | /// 12 | internal class Constants 13 | { 14 | /// 15 | /// The version number that Esent has on Windows XP. 16 | /// 17 | public const uint XpVersion = 0x50A3D88; 18 | 19 | /// 20 | /// The version number that Esent has on Windows Vista. 21 | /// 22 | public const uint VistaVersion = 0x60177101; 23 | 24 | /// 25 | /// The version number that Esent has on Windows 7. 26 | /// 27 | public const uint Windows7Version = 0x601db101; 28 | } 29 | } -------------------------------------------------------------------------------- /EsentInterop/Windows81DbInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop.Windows81 8 | { 9 | using System; 10 | 11 | /// 12 | /// ColumnDatabase info levels that have been added to the Windows 8.1 version of ESENT. 13 | /// 14 | public static class Windows81DbInfo 15 | { 16 | /// 17 | /// Introduced in Windows 8.1. 18 | /// Returns the filesize of the database that is allocated by the operating system, in pages. 19 | /// This may be smaller than if the file system supports 20 | /// compressed or sparse files (Int32). 21 | /// 22 | public const JET_DbInfo FilesizeOnDisk = (JET_DbInfo)21; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /EsentInterop/Windows81Param.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop.Windows81 8 | { 9 | /// 10 | /// System parameters that were introduced in Windows 8.1. 11 | /// 12 | public static class Windows81Param 13 | { 14 | /// 15 | /// Whether to free space back to the OS after deleting data. This may free space 16 | /// in the middle of files (done in the units of database extents). This uses Sparse Files, 17 | /// which is available on NTFS and ReFS (not FAT). The exact method of releasing space is an 18 | /// implementation detail and is subject to change. 19 | /// 20 | public const JET_param EnableShrinkDatabase = (JET_param)184; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /EsentInterop/jet_move.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | /// 10 | /// Offsets for JetMove. 11 | /// 12 | public enum JET_Move 13 | { 14 | /// 15 | /// Move the cursor to the first index entry. 16 | /// 17 | First = -2147483648, 18 | 19 | /// 20 | /// Move to the previous index entry. 21 | /// 22 | Previous = -1, 23 | 24 | /// 25 | /// Move to the next index entry. 26 | /// 27 | Next = 1, 28 | 29 | /// 30 | /// Move to the last index entry. 31 | /// 32 | Last = 0x7fffffff, 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /EsentInterop/jet_filetype.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | /// 10 | /// Esent file types. 11 | /// 12 | public enum JET_filetype 13 | { 14 | /// 15 | /// Unknown file. 16 | /// 17 | Unknown = 0, 18 | 19 | /// 20 | /// Database file. 21 | /// 22 | Database = 1, 23 | 24 | /// 25 | /// Transaction log. 26 | /// 27 | Log = 3, 28 | 29 | /// 30 | /// Checkpoint file. 31 | /// 32 | Checkpoint = 4, 33 | 34 | /// 35 | /// Temporary database. 36 | /// 37 | TempDatabase = 5, 38 | } 39 | } -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Microsoft Corporation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /EsentInterop/LegacyFileNames.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop.Vista 8 | { 9 | /// 10 | /// Options for LegacyFileNames. 11 | /// 12 | public enum LegacyFileNames 13 | { 14 | /// 15 | /// When this option is present then the database engine will use the following naming conventions for its files: 16 | /// o Transaction Log files will use .LOG for their file extension. 17 | /// o Checkpoint files will use .CHK for their file extension. 18 | /// 19 | ESE98FileNames = 0x00000001, 20 | 21 | /// 22 | /// Preserve the 8.3 naming syntax for as long as possible. (this should not be changed, w/o ensuring there are no log files). 23 | /// 24 | EightDotThreeSoftCompat = 0x00000002, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /EsentCollectionsSamples/HelloWorld/Settings.StyleCop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | True 8 | 9 | 10 | 11 | 12 | True 13 | 14 | 15 | 16 | 17 | True 18 | 19 | 20 | 21 | 22 | True 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /EsentInterop/Server2003Param.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop.Server2003 8 | { 9 | /// 10 | /// System parameters that have been added to the Windows Server 2003 version of ESENT. 11 | /// 12 | public static class Server2003Param 13 | { 14 | /// 15 | /// The full path to each database is persisted in the transaction logs 16 | /// at run time. Ordinarily, these databases must remain at the original 17 | /// location for transaction replay to function correctly. This 18 | /// parameter can be used to force crash recovery or a restore operation 19 | /// to look for the databases referenced in the transaction log in the 20 | /// specified folder. 21 | /// 22 | public const JET_param AlternateDatabaseRecoveryPath = (JET_param)113; 23 | } 24 | } -------------------------------------------------------------------------------- /EsentCollectionsSamples/RssDictionarySample/Settings.StyleCop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | True 8 | 9 | 10 | 11 | 12 | True 13 | 14 | 15 | 16 | 17 | True 18 | 19 | 20 | 21 | 22 | True 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /UWPSample/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("UWPSample")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("UWPSample")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Version information for an assembly consists of the following four values: 18 | // 19 | // Major Version 20 | // Minor Version 21 | // Build Number 22 | // Revision 23 | // 24 | // You can specify all the values or you can default the Build and Revision Numbers 25 | // by using the '*' as shown below: 26 | // [assembly: AssemblyVersion("1.0.*")] 27 | [assembly: AssemblyVersion("1.0.0.0")] 28 | [assembly: AssemblyFileVersion("1.0.0.0")] 29 | [assembly: ComVisible(false)] -------------------------------------------------------------------------------- /EsentInterop/IContentEquatable.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | /// 10 | /// Interface for objects that can have their contents compared against 11 | /// each other. This should be used for equality comparisons on mutable 12 | /// reference objects where overriding Equals() and GetHashCode() isn't a 13 | /// good idea. 14 | /// 15 | /// The type of objects to compare. 16 | public interface IContentEquatable 17 | { 18 | /// 19 | /// Returns a value indicating whether this instance is equal 20 | /// to another instance. 21 | /// 22 | /// An instance to compare with this instance. 23 | /// True if the two instances are equal. 24 | bool ContentEquals(T other); 25 | } 26 | } -------------------------------------------------------------------------------- /Pixie/PixieTests/IndexDefinitionTests.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | using Microsoft.Isam.Esent; 8 | using Microsoft.VisualStudio.TestTools.UnitTesting; 9 | 10 | namespace PixieTests 11 | { 12 | /// 13 | /// Test the IndexDefinition class 14 | /// 15 | [TestClass] 16 | public class IndexDefinitionTests 17 | { 18 | [TestMethod] 19 | [Priority(1)] 20 | public void VerifyConstructorSetsName() 21 | { 22 | var indexdefinition = new IndexDefinition("index"); 23 | Assert.AreEqual("index", indexdefinition.Name); 24 | } 25 | 26 | [TestMethod] 27 | [Priority(1)] 28 | public void VerifyAsPrimarySetsUnique() 29 | { 30 | var indexdefinition = new IndexDefinition("index").AsPrimary(); 31 | Assert.IsTrue(indexdefinition.IsUnique); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /EsentInteropTests/Settings.StyleCop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Api 5 | autoincrement 6 | behaviour 7 | coltyp 8 | columnid 9 | Equatable 10 | esent 11 | multivalues 12 | nullable 13 | tableid 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | False 22 | 23 | 24 | 25 | 26 | True 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /EsentInterop/VistaColtyp.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop.Vista 8 | { 9 | /// 10 | /// Column types that have been added to the Vista version of ESENT. 11 | /// 12 | public static class VistaColtyp 13 | { 14 | /// 15 | /// Unsigned 32-bit number. 16 | /// 17 | public const JET_coltyp UnsignedLong = (JET_coltyp)14; 18 | 19 | /// 20 | /// Signed 64-bit number. 21 | /// 22 | public const JET_coltyp LongLong = (JET_coltyp)15; 23 | 24 | /// 25 | /// 16-byte GUID. 26 | /// 27 | public const JET_coltyp GUID = (JET_coltyp)16; 28 | 29 | /// 30 | /// Unsigned 16-bit number. 31 | /// 32 | public const JET_coltyp UnsignedShort = (JET_coltyp)17; 33 | } 34 | } -------------------------------------------------------------------------------- /EsentInterop/jet_colinfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | /// 10 | /// Info levels for retrieving column info. 11 | /// 12 | internal enum JET_ColInfo 13 | { 14 | /// 15 | /// Default option. Retrieves a JET_COLUMNDEF. 16 | /// 17 | Default = 0, 18 | 19 | /// 20 | /// Retrieves a JET_COLUMNLIST structure, containing all the columns 21 | /// in the table. 22 | /// 23 | List = 1, 24 | 25 | /// 26 | /// Retrieves a JET_COLUMNBASE structure. 27 | /// 28 | Base = 4, 29 | 30 | /// 31 | /// Retrieves a JET_COLUMNDEF, the szColumnName argument is interpreted 32 | /// as a pointer to a columnid. 33 | /// 34 | ByColid = 6, 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /EsentInterop/jet_dbstate.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | /// 10 | /// Database states (used in ). 11 | /// 12 | public enum JET_dbstate 13 | { 14 | /// 15 | /// The database was just created. 16 | /// 17 | JustCreated = 1, 18 | 19 | /// 20 | /// Dirty shutdown (inconsistent) database. 21 | /// 22 | DirtyShutdown = 2, 23 | 24 | /// 25 | /// Clean shutdown (consistent) database. 26 | /// 27 | CleanShutdown = 3, 28 | 29 | /// 30 | /// Database is being converted. 31 | /// 32 | BeingConverted = 4, 33 | 34 | /// 35 | /// Database was force-detached. 36 | /// 37 | ForceDetach = 5, 38 | } 39 | } -------------------------------------------------------------------------------- /Scripts/nuget/ManagedEsent.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ManagedEsent 5 | 2.0.0 6 | mthorp 7 | mthorp 8 | https://github.com/microsoft/ManagedEsent/blob/master/LICENSE.md 9 | https://github.com/microsoft/ManagedEsent/ 10 | 11 | false 12 | 13 | ManagedEsent provides managed access to ESENT, the embeddable database engine native to Windows. ManagedEsent uses the esent.dll that is part of Microsoft Windows so there are no extra unmanaged binaries to download and install. 14 | 15 | Release 2.0.0 from January, 2020. Now with support for .NET Standard, which allows use in Universal Windows Platform (UWP) apps as well as traditional apps. 16 | Copyright 2020 17 | ManagedEsent NoSql ISAM 18 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /isam/isam.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | net8.0;net472 7 | Library 8 | Properties 9 | EsentIsam 10 | Esent.Isam 11 | false 12 | false 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 32 | 33 | -------------------------------------------------------------------------------- /EsentInterop/jet_pfnrealloc.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | using System; 10 | 11 | /// 12 | /// Callback used by JetEnumerateColumns to allocate memory for its output buffers. 13 | /// 14 | /// Context given to JetEnumerateColumns. 15 | /// 16 | /// If non-zero, a pointer to a memory block previously allocated by this callback. 17 | /// 18 | /// 19 | /// The new size of the memory block (in bytes). If this is 0 and a memory block is 20 | /// specified, that memory block will be freed. 21 | /// 22 | /// 23 | /// A pointer to newly allocated memory. If memory could not be allocated then 24 | /// should be returned. 25 | /// 26 | [CLSCompliant(false)] 27 | public delegate IntPtr JET_PFNREALLOC(IntPtr context, IntPtr memory, uint requestedSize); 28 | } 29 | -------------------------------------------------------------------------------- /EsentInteropSamples/DbUtil/Program.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Utilities 8 | { 9 | using System; 10 | 11 | /// 12 | /// Contains the static method that starts the program. 13 | /// 14 | public class Program 15 | { 16 | /// 17 | /// Main method, called when the program starts. 18 | /// 19 | /// Arguments to the program. 20 | /// 0 for success, non-zero for a failure. 21 | public static int Main(string[] args) 22 | { 23 | var dbutil = new Dbutil(); 24 | try 25 | { 26 | dbutil.Execute(args); 27 | } 28 | catch (Exception ex) 29 | { 30 | Console.Error.WriteLine("Caught exception:"); 31 | Console.Error.WriteLine(ex.ToString()); 32 | return 1; 33 | } 34 | 35 | return 0; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /EsentInteropSamples/EsentSample/EsentSample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | Exe 7 | Properties 8 | EsentSample 9 | EsentSample 10 | net472 11 | false 12 | false 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 35 | -------------------------------------------------------------------------------- /EsentInteropSamples/StockSample/StockSample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | Exe 7 | Properties 8 | StockSample 9 | StockSample 10 | net472 11 | false 12 | false 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 35 | -------------------------------------------------------------------------------- /EsentInterop/jet_snt.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | /// 10 | /// Type of progress being reported. 11 | /// 12 | public enum JET_SNT 13 | { 14 | /// 15 | /// Callback for the beginning of an operation. 16 | /// 17 | Begin = 5, 18 | 19 | /// 20 | /// Callback for operation progress. 21 | /// 22 | Progress = 0, 23 | 24 | /// 25 | /// Callback for the completion of an operation. 26 | /// 27 | Complete = 6, 28 | 29 | /// 30 | /// Callback for failure during the operation. 31 | /// 32 | Fail = 3, 33 | 34 | /// 35 | /// RecoveryStep was used for internal reserved functionality 36 | /// prior to Windows 8. Windows 8 and later no longer use RecoveryStep. 37 | /// 38 | RecoveryStep = 8, 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /EsentInteropSamples/DbUtilTests/DbUtilTests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | Library 7 | Properties 8 | DbUtilTests 9 | DbUtilTests 10 | net8.0;net472 11 | false 12 | false 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 35 | -------------------------------------------------------------------------------- /EsentInterop/jet_sesparam.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop.Windows8 8 | { 9 | /// 10 | /// ESENT session parameters. 11 | /// 12 | /// 13 | public enum JET_sesparam 14 | { 15 | /// 16 | /// This parameter is not meant to be used. 17 | /// 18 | Base = 4096, 19 | 20 | /// 21 | /// This parameter sets the grbits for commit. It is functionally the same as the 22 | /// system parameter JET_param.CommitDefault when used with an instance and a sesid. 23 | /// Note: JET_param.CommitDefault is not currently exposed in the ESE interop layer. 24 | /// 25 | CommitDefault = 4097, 26 | 27 | /// 28 | /// This parameter sets a user specific commit context that will be placed in the 29 | /// transaction log on commit to level 0. 30 | /// 31 | CommitGenericContext = 4098, 32 | } 33 | } -------------------------------------------------------------------------------- /EsentInterop/JET_eventlogginglevel.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | /// 10 | /// Options for EventLoggingLevel. 11 | /// 12 | public enum EventLoggingLevels 13 | { 14 | /// 15 | /// Disable all events. 16 | /// 17 | Disable = 0, 18 | 19 | /// 20 | /// Default level. Windows 7 and later. 21 | /// 22 | Min = 1, 23 | 24 | /// 25 | /// Low verbosity and lower. Windows 7 and later. 26 | /// 27 | Low = 25, 28 | 29 | /// 30 | /// Medium verbosity and lower. Windows 7 and later. 31 | /// 32 | Medium = 50, 33 | 34 | /// 35 | /// High verbosity and lower. Windows 7 and later. 36 | /// 37 | High = 75, 38 | 39 | /// 40 | /// All events. 41 | /// 42 | Max = 100, 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /EsentCollectionsSamples/HelloWorld/HelloWorld.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | Exe 7 | Properties 8 | HelloWorld 9 | HelloWorld 10 | net472 11 | false 12 | false 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 36 | -------------------------------------------------------------------------------- /UWPSample/Properties/Default.rd.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /EsentCollections/Compare.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | // 6 | // Provides generic comparison methods. 7 | // 8 | // -------------------------------------------------------------------------------------------------------------------- 9 | 10 | namespace Microsoft.Isam.Esent.Collections.Generic 11 | { 12 | /// 13 | /// Provides generic comparison methods. 14 | /// 15 | internal static class Compare 16 | { 17 | /// 18 | /// Compare two objects to determine if they are equal. 19 | /// 20 | /// The type to compare. 21 | /// The first object. 22 | /// The second object. 23 | /// True if they are equal. 24 | public static bool AreEqual(T value1, T value2) 25 | { 26 | if (((null == value1) && (null == value2)) 27 | || ((null != value1) && value1.Equals(value2))) 28 | { 29 | return true; 30 | } 31 | 32 | return false; 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /EsentCollections/EsentCollections.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | Library 7 | Properties 8 | EsentCollections 9 | Esent.Collections 10 | net8.0;net472 11 | true 12 | true 13 | false 14 | false 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 34 | -------------------------------------------------------------------------------- /EsentCollectionsTests/ArrayShuffle.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | // 6 | // Contains an extension method to randomize an array. 7 | // 8 | // -------------------------------------------------------------------------------------------------------------------- 9 | 10 | namespace EsentCollectionsTests 11 | { 12 | using System; 13 | 14 | /// 15 | /// Contains an extension method to randomize an array. 16 | /// 17 | public static class ArrayShuffle 18 | { 19 | /// 20 | /// Randomly shuffle an array. 21 | /// 22 | /// The type of the array. 23 | /// The array to shuffle. 24 | public static void Shuffle(this T[] data) 25 | { 26 | var rand = new Random(); 27 | for (int i = 0; i < data.Length; ++i) 28 | { 29 | int swapWith = rand.Next(i, data.Length); 30 | T temp = data[i]; 31 | data[i] = data[swapWith]; 32 | data[swapWith] = temp; 33 | } 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /EsentInteropSamples/DbUtil/test_dbutil.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | REM A simple test script for the Dbutil executable. This batch 4 | REM file runs the commands and compares the output with the 5 | REM expected output. 6 | 7 | set DATABASE=testing.db 8 | set DBDIR=test 9 | rmdir /s /q bin\debug\%DBDIR%\ 2> nul 10 | mkdir bin\debug\test\ 11 | pushd bin\debug\test 12 | 13 | echo Passing in bad argumnts... 14 | ..\DbUtil nosuchcommand 2>nul 15 | if %ERRORLEVEL%==0 goto :Fail 16 | 17 | echo Creating sample database... 18 | ..\DbUtil createsample %DATABASE% 19 | if NOT %ERRORLEVEL%==0 goto :Fail 20 | 21 | echo Dumping metadata... 22 | ..\Dbutil dumpmetadata %DATABASE% > metadata.txt 23 | if NOT %ERRORLEVEL%==0 goto :Fail 24 | 25 | echo n | comp /a metadata.txt ..\..\..\tests\expected_metadata.txt 1>nul 2>nul 26 | if NOT %ERRORLEVEL%==0 goto :Fail 27 | 28 | echo Dumping table to csv format... 29 | ..\Dbutil dumptocsv %DATABASE% table > table.csv 30 | echo n | comp /a table.csv ..\..\..\tests\expected_table.csv 1>nul 2>nul 31 | if NOT %ERRORLEVEL%==0 goto :Fail 32 | 33 | popd 34 | rmdir /s /q bin\debug\%DBDIR%\ 35 | 36 | echo. 37 | echo ********************************** 38 | echo Test Passed! 39 | echo ********************************** 40 | 41 | goto :EOF 42 | 43 | :Fail 44 | echo. 45 | echo ********************************** 46 | echo Test failed! 47 | echo ********************************** 48 | 49 | -------------------------------------------------------------------------------- /EsentCollectionsSamples/RssDictionarySample/RssDictionarySample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | Exe 7 | Properties 8 | RssDictionarySample 9 | RssDictionarySample 10 | net472 11 | false 12 | false 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 36 | -------------------------------------------------------------------------------- /EsentInterop/jet_snp.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | /// 10 | /// The type of operation that progress is being reported for. 11 | /// 12 | public enum JET_SNP 13 | { 14 | /// 15 | /// Callback is for a repair option. 16 | /// 17 | Repair = 2, 18 | 19 | /// 20 | /// Callback is for database defragmentation. 21 | /// 22 | Compact = 4, 23 | 24 | /// 25 | /// Callback is for a restore options. 26 | /// 27 | Restore = 8, 28 | 29 | /// 30 | /// Callback is for a backup options. 31 | /// 32 | Backup = 9, 33 | 34 | /// 35 | /// Callback is for database zeroing. 36 | /// 37 | Scrub = 11, 38 | 39 | /// 40 | /// Callback is for the process of upgrading the record format of 41 | /// all database pages. 42 | /// 43 | UpgradeRecordFormat = 12, 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Scripts/signbinaries.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | if %echoon%.==1. echo on 3 | setlocal 4 | set version=%1 5 | if %version%.==. goto :usage 6 | 7 | @echo =-=-=-=-=-=-=-= 8 | @echo Checking for files... 9 | for %%i in ( esent.collections.dll esent.interop.dll esent.isam.dll ) do ( 10 | if not exist %~dp0tosign-%version%\netstandard2.0\%%i ( 11 | echo Error: Prereq file %%i does not exist! 12 | ) 13 | ) 14 | 15 | @set esrpclient="g:\CxCache\EsrpClient.1.1.5\tools\EsrpClient.exe" 16 | @if not exist %esrpclient% ( 17 | @echo Can't find ESRPClient.exe 18 | goto :usage 19 | ) 20 | 21 | @set esrpfiles=E:\managedesent_github2\ESRP 22 | @pushd %esrpfiles% 23 | 24 | @echo Fix source and destination to match version %version% 25 | start "" /B /WAIT notepad.exe input.json 26 | start "" /B /WAIT notepad.exe output.json 27 | 28 | %esrpclient% sign -a authentication.json -p policy.json -i input.json -o output.json -l Verbose -f stdout 29 | if errorlevel 1 goto :eof 30 | 31 | @echo Checking for signed files... 32 | for %%i in ( esent.collections.dll esent.interop.dll esent.isam.dll ) do ( 33 | if not exist %~dp0signed-%version%\netstandard2.0\%%i ( 34 | echo Error: Prereq file %%i does not exist! 35 | ) 36 | ) 37 | 38 | @echo =-=-=-=-=-=-=-= 39 | @echo. 40 | @echo The next step is to run processsignedbinaries.bat %version% 41 | @echo. 42 | @goto :eof 43 | 44 | :usage 45 | @echo Usage: %0 [version-number] 46 | @echo e.g. %0 1.9.5 47 | -------------------------------------------------------------------------------- /isam/NativeMethods.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | // P/Invoke constants for Win32 functions. 6 | //----------------------------------------------------------------------- 7 | 8 | namespace Microsoft.Database.Isam.Win32 9 | { 10 | using System; 11 | using System.Runtime.InteropServices; 12 | 13 | /// 14 | /// P/Invoke methods for Win32 functions. 15 | /// 16 | internal static class NativeMethods 17 | { 18 | #if MANAGEDESENT_ON_CORECLR || MANAGEDESENT_ON_WSA 19 | /// 20 | /// The name of the DLL that holds the Core process/threads API set. 21 | /// 22 | private const string WinCoreProcessThreads = "api-ms-win-core-processthreads-l1-1-1.dll"; 23 | #else 24 | /// 25 | /// The name of the DLL that holds the Core process/threads API set. 26 | /// 27 | private const string WinCoreProcessThreads = "kernel32.dll"; 28 | #endif // MANAGEDESENT_ON_CORECLR || MANAGEDESENT_ON_WSA 29 | 30 | // Win32 APIs that are white-listed for Windows Store Apps can be safely referenced here. 31 | [DllImport(WinCoreProcessThreads)] 32 | public static extern int GetCurrentProcessId(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /EsentInteropTests/Windows8BackupRestoreTests.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace InteropApiTests 8 | { 9 | using System; 10 | using Microsoft.Isam.Esent.Interop; 11 | using Microsoft.VisualStudio.TestTools.UnitTesting; 12 | 13 | /// 14 | /// Tests for JetBackupInstance and JetRestoreInstance. 15 | /// 16 | public partial class BackupRestoreTests 17 | { 18 | #if !MANAGEDESENT_ON_WSA 19 | /// 20 | /// Test exception handling for exceptions thrown from 21 | /// the status callback during JetRestore. 22 | /// 23 | [TestMethod] 24 | [Priority(2)] 25 | [Description("Test exception handling for exceptions thrown from the status callback during JetRestore")] 26 | [ExpectedException(typeof(ArgumentNullException))] 27 | public void TestBackupRestoreCallbackExceptionHandling() 28 | { 29 | var ex = new ArgumentNullException(); 30 | var test = new DatabaseFileTestHelper("database", "backup", true); 31 | test.TestRestoreCallbackExceptionHandling(ex); 32 | } 33 | #endif // !MANAGEDESENT_ON_WSA 34 | } 35 | } -------------------------------------------------------------------------------- /EsentInterop/jet_iopriority.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop.Vista 8 | { 9 | using System; 10 | 11 | /// 12 | /// Values for use with . 13 | /// 14 | [Flags] 15 | public enum JET_IOPriority 16 | { 17 | /// 18 | /// This is the default I/O priority level. 19 | /// 20 | Normal = 0x0, 21 | 22 | /// 23 | /// Subsequent I/Os issued will be issued at Low priority. 24 | /// 25 | Low = 0x1, 26 | 27 | /// 28 | /// Subsequent I/Os issued for checkpoint advancement will be issued at Low priority. 29 | /// 30 | /// 31 | /// Available on Windows 8.1 and later. 32 | /// 33 | LowForCheckpoint = 0x2, 34 | 35 | /// 36 | /// Subsequent I/Os issued for scavenging buffers will be issued at Low priority. 37 | /// 38 | /// 39 | /// Available on Windows 8.1 and later. 40 | /// 41 | LowForScavenge = 0x4, 42 | } 43 | } -------------------------------------------------------------------------------- /EsentInteropSamples/DbUtil/DbUtil.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | Exe 7 | Properties 8 | DbUtil 9 | DbUtil 10 | net8.0;net472 11 | false 12 | false 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 39 | -------------------------------------------------------------------------------- /EsentInterop/VistaColinfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop.Vista 8 | { 9 | /// 10 | /// Column info levels that have been added to the Vista version of ESENT. 11 | /// 12 | public static class VistaColInfo 13 | { 14 | /// 15 | /// Retrieve the JET_COLBASE using the column id. 16 | /// 17 | internal const JET_ColInfo BaseByColid = (JET_ColInfo)8; 18 | 19 | /// 20 | /// For lists, only return non-derived columns (if the table is derived from a template). 21 | /// 22 | internal const JET_ColInfo GrbitNonDerivedColumnsOnly = (JET_ColInfo)int.MinValue; // 0x80000000, 23 | 24 | /// 25 | /// For lists, only return the column name and columnid of each column. 26 | /// 27 | internal const JET_ColInfo GrbitMinimalInfo = (JET_ColInfo)0x40000000; 28 | 29 | /// 30 | /// For lists, sort returned column list by columnid (default is to sort list by column name). 31 | /// 32 | internal const JET_ColInfo GrbitSortByColumnid = (JET_ColInfo)0x20000000; 33 | } 34 | } -------------------------------------------------------------------------------- /EsentInteropSamples/BasicTest/BasicTest.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | Exe 7 | Properties 8 | BasicTest 9 | BasicTest 10 | net8.0;net472 11 | false 12 | false 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 39 | -------------------------------------------------------------------------------- /Pixie/IConnectionManager.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent 8 | { 9 | /// 10 | /// Create connections to databases. 11 | /// 12 | internal interface IConnectionManager 13 | { 14 | /// 15 | /// Create a new database and return a connection to 16 | /// the database. The database will be overwritten if 17 | /// it already exists. 18 | /// 19 | /// The path to the database. 20 | /// Creation mode for the database. 21 | /// A new connection to the database. 22 | Connection CreateDatabase(string database, DatabaseCreationMode mode); 23 | 24 | /// 25 | /// Attach an existing database and return a connection to 26 | /// the database. 27 | /// 28 | /// The path to the database. 29 | /// The mode to open the database in. 30 | /// A new connection to the database. 31 | Connection AttachDatabase(string database, DatabaseOpenMode mode); 32 | } 33 | } -------------------------------------------------------------------------------- /EsentInterop/EsentInterop.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | Library 7 | Properties 8 | Esent.Interop 9 | Esent.Interop 10 | net8.0;net472 11 | false 12 | false 13 | true 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 39 | 40 | -------------------------------------------------------------------------------- /EsentInterop/Windows8IdxInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop.Windows8 8 | { 9 | using Win7 = Microsoft.Isam.Esent.Interop.Windows7; 10 | 11 | /// 12 | /// Index info levels that have been added to the Windows 8 version of ESENT. 13 | /// 14 | /// 15 | /// 16 | public static class Windows8IdxInfo 17 | { 18 | /// 19 | /// Introduced in Windows 8. Returns a JET_INDEXCREATE3 structure. This is similar to 20 | /// structure, but it contains some additional 21 | /// members, and it also uses a locale name in the 22 | /// index definition, not an LCID. 23 | /// The returned object is suitable for use by . 24 | /// 25 | public const JET_IdxInfo InfoCreateIndex3 = (JET_IdxInfo)13; 26 | 27 | /// 28 | /// Introduced in Windows 8. Returns the locale name of the given index. 29 | /// 30 | public const JET_IdxInfo LocaleName = (JET_IdxInfo)14; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /EsentInterop/Windows10NativeMethods.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop.Implementation 8 | { 9 | using System; 10 | using System.Runtime.InteropServices; 11 | using Microsoft.Isam.Esent.Interop.Windows10; 12 | 13 | /// 14 | /// Native interop for Windows10 functions in ese.dll. 15 | /// 16 | internal static partial class NativeMethods 17 | { 18 | #region Sessions 19 | 20 | [DllImport(EsentDll, ExactSpelling = true)] 21 | public static extern int JetSetSessionParameter( 22 | IntPtr sesid, 23 | uint sesparamid, 24 | ref NATIVE_OPERATIONCONTEXT data, 25 | int dataSize); 26 | 27 | [DllImport(EsentDll, ExactSpelling = true)] 28 | public static extern int JetGetSessionParameter( 29 | IntPtr sesid, 30 | uint sesparamid, 31 | out NATIVE_OPERATIONCONTEXT data, 32 | int dataSize, 33 | out int actualDataSize); 34 | 35 | [DllImport(EsentDll, ExactSpelling = true)] 36 | public static unsafe extern int JetGetThreadStats(JET_THREADSTATS2* pvResult, uint cbMax); 37 | 38 | #endregion 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /EsentInteropTests/Windows10ToStringTests.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace InteropApiTests 8 | { 9 | using System; 10 | using System.Globalization; 11 | using Microsoft.Isam.Esent.Interop; 12 | using Microsoft.Isam.Esent.Interop.Windows10; 13 | using Microsoft.Isam.Esent.Interop.Windows8; 14 | using Microsoft.VisualStudio.TestTools.UnitTesting; 15 | 16 | /// 17 | /// Testing the ToString methods of the basic types. 18 | /// 19 | public partial class ToStringTests 20 | { 21 | /// 22 | /// Test JET_OPERATIONCONTEXT.ToString(). 23 | /// 24 | [TestMethod] 25 | [Priority(0)] 26 | [Description("Test JET_OPERATIONCONTEXT.ToString()")] 27 | public void JetOperationContextToString() 28 | { 29 | var operationContext = new JET_OPERATIONCONTEXT() 30 | { 31 | UserID = 2, 32 | OperationID = 3, 33 | OperationType = 4, 34 | ClientType = 5, 35 | Flags = 6, 36 | }; 37 | 38 | Assert.AreEqual("JET_OPERATIONCONTEXT(2:3:4:5:0x06)", operationContext.ToString()); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /EsentInterop/Windows81InstanceParameters.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | using Microsoft.Isam.Esent.Interop.Windows81; 10 | 11 | /// 12 | /// This class provides static properties to set and get 13 | /// per-instance ESENT system parameters. 14 | /// 15 | public partial class InstanceParameters 16 | { 17 | /// 18 | /// Gets or sets whether to free space back to the OS after deleting data. This may free space 19 | /// in the middle of files (done in the units of database extents). This uses Sparse Files, 20 | /// which is available on NTFS and ReFS (not FAT). The exact method of releasing space is an 21 | /// implementation detail and is subject to change. 22 | /// 23 | public ShrinkDatabaseGrbit EnableShrinkDatabase 24 | { 25 | get 26 | { 27 | return (ShrinkDatabaseGrbit)this.GetIntegerParameter(Windows81Param.EnableShrinkDatabase); 28 | } 29 | 30 | set 31 | { 32 | this.SetIntegerParameter(Windows81Param.EnableShrinkDatabase, (int)value); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /EsentInterop/Windows10Sesparam.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop.Windows10 8 | { 9 | using Microsoft.Isam.Esent.Interop.Windows8; 10 | 11 | /// 12 | /// Values of that were introduced in Windows 10. 13 | /// 14 | /// 15 | public static class Windows10Sesparam 16 | { 17 | /// 18 | /// Gets the current number of nested levels of transactions begun. A value of zero indicates that 19 | /// the session is not currently in a transaction. This parameter is read-only. 20 | /// 21 | public const JET_sesparam TransactionLevel = (JET_sesparam)4099; 22 | 23 | /// 24 | /// A client context of type that the engine uses to track and trace operations (such as IOs). 25 | /// 26 | public const JET_sesparam OperationContext = (JET_sesparam)4100; 27 | 28 | /// 29 | /// A 32-bit integer ID that is logged in traces and can be used by clients to correlate ESE actions with their activity. 30 | /// 31 | public const JET_sesparam CorrelationID = (JET_sesparam)4101; 32 | } 33 | } -------------------------------------------------------------------------------- /PixieSamples/GettingStarted/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("PixieSample")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("PixieSample")] 12 | [assembly: AssemblyCopyright("Copyright (c) Microsoft. All Rights Reserved.")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("a234f843-dee1-4d93-9224-3640a91f325e")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /PixieSamples/PixieConsole/app.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | 7 | ///////////////////////////////////////////////////////////////////////////// 8 | #undef APSTUDIO_READONLY_SYMBOLS 9 | 10 | ///////////////////////////////////////////////////////////////////////////// 11 | // English (U.S.) resources 12 | 13 | 14 | ///////////////////////////////////////////////////////////////////////////// 15 | // 16 | // Icon 17 | // 18 | 19 | // Icon placed first or with lowest ID value becomes application icon 20 | 21 | LANGUAGE 9, 1 22 | #pragma code_page(1252) 23 | 1 ICON "app.ico" 24 | 25 | #ifdef APSTUDIO_INVOKED 26 | ///////////////////////////////////////////////////////////////////////////// 27 | // 28 | // TEXTINCLUDE 29 | // 30 | 31 | 1 TEXTINCLUDE 32 | BEGIN 33 | "resource.h\0" 34 | "\0" 35 | END 36 | 37 | 2 TEXTINCLUDE 38 | BEGIN 39 | "#include ""afxres.h""\r\n" 40 | "\0" 41 | END 42 | 43 | 3 TEXTINCLUDE 44 | BEGIN 45 | "\0" 46 | END 47 | 48 | #endif // APSTUDIO_INVOKED 49 | 50 | ///////////////////////////////////////////////////////////////////////////// 51 | 52 | 53 | 54 | #ifndef APSTUDIO_INVOKED 55 | ///////////////////////////////////////////////////////////////////////////// 56 | // 57 | // Generated from the TEXTINCLUDE 3 resource. 58 | // 59 | 60 | 61 | ///////////////////////////////////////////////////////////////////////////// 62 | #endif // not APSTUDIO_INVOKED 63 | 64 | -------------------------------------------------------------------------------- /Pixie/EsentSqlExecutionException.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | using System; 8 | using System.Runtime.Serialization; 9 | 10 | namespace Microsoft.Isam.Esent 11 | { 12 | /// 13 | /// Invalid SQL command. 14 | /// 15 | [Serializable] 16 | public class EsentSqlExecutionException : EsentException 17 | { 18 | /// 19 | /// Initializes a new instance of the EsentSqlExecutionException class. 20 | /// 21 | /// 22 | /// Description of the error. 23 | /// 24 | internal EsentSqlExecutionException(string description) 25 | : base(description) 26 | { 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the EsentSqlExecutionException class. This constructor 31 | /// is used to deserialize a serialized exception. 32 | /// 33 | /// The data needed to deserialize the object. 34 | /// The deserialization context. 35 | protected EsentSqlExecutionException(SerializationInfo info, StreamingContext context) : 36 | base(info, context) 37 | { 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /EsentInteropTests/ApiTestHook.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace InteropApiTests 8 | { 9 | using System; 10 | using Microsoft.Isam.Esent.Interop; 11 | using Microsoft.Isam.Esent.Interop.Implementation; 12 | 13 | /// 14 | /// A disposable class that can set and reset the Api implementation. 15 | /// 16 | internal class ApiTestHook : IDisposable 17 | { 18 | /// 19 | /// The saved api. 20 | /// 21 | private readonly IJetApi savedApi; 22 | 23 | /// 24 | /// Initializes a new instance of the ApiTestHook class. 25 | /// 26 | /// 27 | /// A new IJetApi to be used by the Api. The original 28 | /// value will be restored when this object is disposed. 29 | /// 30 | public ApiTestHook(IJetApi newApi) 31 | { 32 | this.savedApi = Api.Impl; 33 | Api.Impl = newApi; 34 | } 35 | 36 | /// 37 | /// Destroy an ApiTestHook. This restores the saved Api. 38 | /// 39 | public void Dispose() 40 | { 41 | Api.Impl = this.savedApi; 42 | GC.SuppressFinalize(this); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /EsentCollectionsSamples/HelloWorld/HelloWorld.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace PersistentDictionarySample 8 | { 9 | using System; 10 | using Microsoft.Isam.Esent.Collections.Generic; 11 | 12 | /// 13 | /// A simple 'Hello World' program that uses a PersistentDictionary. 14 | /// This remembers the names of its previous users. 15 | /// 16 | public static class HelloWorld 17 | { 18 | /// 19 | /// Ask the user for their first name and see if we remember 20 | /// their last name. 21 | /// 22 | public static void Main() 23 | { 24 | PersistentDictionary dictionary = new PersistentDictionary("Names"); 25 | Console.WriteLine("What is your first name?"); 26 | string firstName = Console.ReadLine(); 27 | if (dictionary.ContainsKey(firstName)) 28 | { 29 | Console.WriteLine("Welcome back {0} {1}", firstName, dictionary[firstName]); 30 | } 31 | else 32 | { 33 | Console.WriteLine("I don't know you, {0}. What is your last name?", firstName); 34 | dictionary[firstName] = Console.ReadLine(); 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /EsentInterop/Esent/CallbackDataConverter.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | using System; 10 | using System.Runtime.InteropServices; 11 | 12 | /// 13 | /// Methods to convert data objects used in callbacks. 14 | /// 15 | internal static class CallbackDataConverter 16 | { 17 | /// 18 | /// Get the managed data object from the unmanaged data. 19 | /// 20 | /// The native data. 21 | /// The SNP (used to determine the type of object). 22 | /// The SNT (used to determine the type of object). 23 | /// The managed data object. 24 | public static object GetManagedData(IntPtr nativeData, JET_SNP snp, JET_SNT snt) 25 | { 26 | if (IntPtr.Zero != nativeData && JET_SNT.Progress == snt) 27 | { 28 | NATIVE_SNPROG native = (NATIVE_SNPROG)Marshal.PtrToStructure(nativeData, typeof(NATIVE_SNPROG)); 29 | JET_SNPROG managed = new JET_SNPROG(); 30 | managed.SetFromNative(native); 31 | return managed; 32 | } 33 | 34 | return null; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /EsentInterop/jet_callback.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | using System; 10 | 11 | /// 12 | /// A multi-purpose callback function used by the database engine to inform 13 | /// the application of an event involving online defragmentation and cursor 14 | /// state notifications. 15 | /// 16 | /// The session for which the callback is being made. 17 | /// The database for which the callback is being made. 18 | /// The cursor for which the callback is being made. 19 | /// The operation for which the callback is being made. 20 | /// First callback-specific argument. 21 | /// Second callback-specific argument. 22 | /// Callback context. 23 | /// This parameter is not used. 24 | /// An ESENT error code. 25 | public delegate JET_err JET_CALLBACK( 26 | JET_SESID sesid, 27 | JET_DBID dbid, 28 | JET_TABLEID tableid, 29 | JET_cbtyp cbtyp, 30 | object arg1, 31 | object arg2, 32 | IntPtr context, 33 | IntPtr unused); 34 | } 35 | -------------------------------------------------------------------------------- /EsentInterop/Windows7Idxinfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop.Windows7 8 | { 9 | using Win8 = Microsoft.Isam.Esent.Interop.Windows8; 10 | 11 | /// 12 | /// Index info levels that have been added to the Windows 7 version of ESENT. 13 | /// 14 | /// 15 | /// 16 | public static class Windows7IdxInfo 17 | { 18 | /// 19 | /// Introduced in Windows 7. Returns a structure suitable 20 | /// for use by . 21 | /// 22 | /// Not currently implemented in this layer. 23 | internal const JET_IdxInfo CreateIndex = (JET_IdxInfo)11; 24 | 25 | /// 26 | /// Introduced in Windows 7. Returns a JET_INDEXCREATE2 structure (similar to structure, 27 | /// but it contains a member called pSpacehints). 28 | /// This structure is suitable 29 | /// for use by . 30 | /// 31 | /// Not currently implemented in this layer. 32 | internal const JET_IdxInfo CreateIndex2 = (JET_IdxInfo)12; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /External Components/Rhino.Mocks/license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2005 - 2008 Ayende Rahien (ayende@ayende.com) 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | * Neither the name of Ayende Rahien nor the names of its 13 | contributors may be used to endorse or promote products derived from this 14 | software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /EsentInteropTests/EnumColumnValueTests.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace InteropApiTests 8 | { 9 | using System; 10 | using Microsoft.Isam.Esent.Interop; 11 | using Microsoft.VisualStudio.TestTools.UnitTesting; 12 | 13 | /// 14 | /// Tests for JET_ENUMCOLUMNVALUE conversion. 15 | /// 16 | [TestClass] 17 | public class EnumColumnValueTests 18 | { 19 | /// 20 | /// Test conversion from native to managed. 21 | /// 22 | [TestMethod] 23 | [Priority(0)] 24 | [Description("Test conversion from NATIVE_ENUMCOLUMNVALUE to JET_ENUMCOLUMNVALUE")] 25 | public void TestConversion() 26 | { 27 | var native = new NATIVE_ENUMCOLUMNVALUE 28 | { 29 | cbData = 1, 30 | err = (int)JET_wrn.ColumnTruncated, 31 | itagSequence = 2, 32 | pvData = new IntPtr(3), 33 | }; 34 | 35 | var managed = new JET_ENUMCOLUMNVALUE(); 36 | managed.SetFromNativeEnumColumnValue(native); 37 | 38 | Assert.AreEqual(1, managed.cbData); 39 | Assert.AreEqual(JET_wrn.ColumnTruncated, managed.err); 40 | Assert.AreEqual(2, managed.itagSequence); 41 | Assert.AreEqual(new IntPtr(3), managed.pvData); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Pixie/EsentReadOnlyException.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | using System; 8 | using System.Runtime.Serialization; 9 | 10 | namespace Microsoft.Isam.Esent 11 | { 12 | /// 13 | /// The write operation tried on a read-only connection. 14 | /// 15 | [Serializable] 16 | public class EsentReadOnlyException : EsentException 17 | { 18 | /// 19 | /// Initializes a new instance of the EsentReadOnlyException class. 20 | /// 21 | /// 22 | /// The name of the object that the modification was attempted on. 23 | /// 24 | internal EsentReadOnlyException(string name) 25 | : base(String.Format("Write operation attempted on read-only object '{0}'", name)) 26 | { 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the EsentReadOnlyException class. This constructor 31 | /// is used to deserialize a serialized exception. 32 | /// 33 | /// The data needed to deserialize the object. 34 | /// The deserialization context. 35 | protected EsentReadOnlyException(SerializationInfo info, StreamingContext context) : 36 | base(info, context) 37 | { 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Pixie/Record.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | using System; 8 | 9 | namespace Microsoft.Isam.Esent 10 | { 11 | /// 12 | /// A table record. 13 | /// 14 | public interface Record : IDisposable 15 | { 16 | /// 17 | /// Gets or sets the columns in the record. 18 | /// 19 | /// Name of the column. 20 | /// The column as an object. 21 | object this[string column] 22 | { 23 | get; 24 | set; 25 | } 26 | 27 | /// 28 | /// Save changes in the current update. 29 | /// 30 | void Save(); 31 | 32 | /// 33 | /// Delete the current record. This disposes the current object. 34 | /// 35 | void Delete(); 36 | 37 | /// 38 | /// Cancel changes in the current update. 39 | /// 40 | void Cancel(); 41 | 42 | /// 43 | /// Set a column in the record. 44 | /// 45 | /// The column to set. 46 | /// The value to set. 47 | /// The record the column was set on. 48 | Record SetColumn(string column, object value); 49 | } 50 | } -------------------------------------------------------------------------------- /EsentInterop/jet_pfndurablecommitcallback.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | // 6 | // Callback for JET_param JET_paramEmitLogDataCallback. 7 | // 8 | // -------------------------------------------------------------------------------------------------------------------- 9 | 10 | namespace Microsoft.Isam.Esent.Interop.Windows8 11 | { 12 | using System; 13 | 14 | /// 15 | /// Callback for JET_paramDurableCommitCallback. 16 | /// 17 | /// Instance to use. 18 | /// Commit-id that has just been flushed. 19 | /// Reserved currently. 20 | /// An error code. 21 | public delegate JET_err JET_PFNDURABLECOMMITCALLBACK( 22 | JET_INSTANCE instance, 23 | JET_COMMIT_ID pCommitIdSeen, 24 | DurableCommitCallbackGrbit grbit); 25 | 26 | /// 27 | /// Callback for JET_paramDurableCommitCallback. 28 | /// 29 | /// Instance to use. 30 | /// Commit-id that has just been flushed. 31 | /// Reserved currently. 32 | /// An error code. 33 | internal delegate JET_err NATIVE_JET_PFNDURABLECOMMITCALLBACK( 34 | IntPtr instance, 35 | ref NATIVE_COMMIT_ID pCommitIdSeen, 36 | uint grbit); 37 | } 38 | -------------------------------------------------------------------------------- /EsentInteropSamples/BasicTest/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | using System.Reflection; 8 | using System.Runtime.InteropServices; 9 | 10 | // General Information about an assembly is controlled through the following 11 | // set of attributes. Change these attribute values to modify the information 12 | // associated with an assembly. 13 | [assembly: AssemblyTitle("BasicTest")] 14 | [assembly: AssemblyDescription("")] 15 | [assembly: AssemblyConfiguration("")] 16 | [assembly: AssemblyCompany("Microsoft")] 17 | [assembly: AssemblyProduct("BasicTest")] 18 | [assembly: AssemblyCopyright("Copyright (c) Microsoft. All Rights Reserved.")] 19 | [assembly: AssemblyTrademark("")] 20 | [assembly: AssemblyCulture("")] 21 | 22 | // Setting ComVisible to false makes the types in this assembly not visible 23 | // to COM components. If you need to access a type in this assembly from 24 | // COM, set the ComVisible attribute to true on that type. 25 | [assembly: ComVisible(false)] 26 | 27 | // Version information for an assembly consists of the following four values: 28 | // 29 | // Major Version 30 | // Minor Version 31 | // Build Number 32 | // Revision 33 | // 34 | // You can specify all the values or you can default the Build and Revision Numbers 35 | // by using the '*' as shown below: 36 | // [assembly: AssemblyVersion("1.0.*")] 37 | [assembly: AssemblyVersion("1.0.0.0")] 38 | [assembly: AssemblyFileVersion("1.0.0.0")] 39 | -------------------------------------------------------------------------------- /EsentInteropSamples/EsentSample/Settings.StyleCop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | True 8 | 9 | 10 | 11 | 12 | True 13 | 14 | 15 | 16 | 17 | True 18 | 19 | 20 | 21 | 22 | True 23 | 24 | 25 | 26 | 27 | True 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | True 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /EsentInteropSamples/StockSample/Settings.StyleCop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | True 8 | 9 | 10 | 11 | 12 | True 13 | 14 | 15 | 16 | 17 | True 18 | 19 | 20 | 21 | 22 | True 23 | 24 | 25 | 26 | 27 | True 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | True 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /EsentCollectionsTests/EsentCollectionsTests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | Library 7 | Properties 8 | EsentCollectionsTests 9 | EsentCollectionsTests 10 | net8.0;net472 11 | false 12 | false 13 | false 14 | false 15 | 13.0 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 41 | -------------------------------------------------------------------------------- /PixieSamples/PixieConsole/AssemblyInfo.cpp: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | using namespace System; 8 | using namespace System::Reflection; 9 | using namespace System::Runtime::CompilerServices; 10 | using namespace System::Runtime::InteropServices; 11 | using namespace System::Security::Permissions; 12 | 13 | // 14 | // General Information about an assembly is controlled through the following 15 | // set of attributes. Change these attribute values to modify the information 16 | // associated with an assembly. 17 | // 18 | [assembly:AssemblyTitleAttribute("PixieConsole")]; 19 | [assembly:AssemblyDescriptionAttribute("")]; 20 | [assembly:AssemblyConfigurationAttribute("")]; 21 | [assembly:AssemblyCompanyAttribute("")]; 22 | [assembly:AssemblyProductAttribute("PixieConsole")]; 23 | [assembly:AssemblyCopyrightAttribute("Copyright (c) 2009")]; 24 | [assembly:AssemblyTrademarkAttribute("")]; 25 | [assembly:AssemblyCultureAttribute("")]; 26 | 27 | // 28 | // Version information for an assembly consists of the following four values: 29 | // 30 | // Major Version 31 | // Minor Version 32 | // Build Number 33 | // Revision 34 | // 35 | // You can specify all the value or you can default the Revision and Build Numbers 36 | // by using the '*' as shown below: 37 | 38 | [assembly:AssemblyVersionAttribute("1.0.*")]; 39 | 40 | [assembly:ComVisible(false)]; 41 | 42 | [assembly:CLSCompliantAttribute(true)]; 43 | 44 | [assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)]; 45 | -------------------------------------------------------------------------------- /UWPSample/Package.appxmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 13 | 14 | 15 | 16 | 17 | UWPSample 18 | mthorp 19 | Assets\StoreLogo.png 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Pixie/PixieTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | using System.Reflection; 8 | using System.Runtime.InteropServices; 9 | 10 | // General Information about an assembly is controlled through the following 11 | // set of attributes. Change these attribute values to modify the information 12 | // associated with an assembly. 13 | [assembly: AssemblyTitle("PixieTests")] 14 | [assembly: AssemblyDescription("")] 15 | [assembly: AssemblyConfiguration("")] 16 | [assembly: AssemblyCompany("")] 17 | [assembly: AssemblyProduct("PixieTests")] 18 | [assembly: AssemblyCopyright("Copyright (c) Microsoft. All Rights Reserved.")] 19 | [assembly: AssemblyTrademark("")] 20 | [assembly: AssemblyCulture("")] 21 | 22 | // Setting ComVisible to false makes the types in this assembly not visible 23 | // to COM componenets. If you need to access a type in this assembly from 24 | // COM, set the ComVisible attribute to true on that type. 25 | [assembly: ComVisible(false)] 26 | 27 | // The following GUID is for the ID of the typelib if this project is exposed to COM 28 | [assembly: Guid("ffb67693-b418-4518-b417-7a709a715855")] 29 | 30 | // Version information for an assembly consists of the following four values: 31 | // 32 | // Major Version 33 | // Minor Version 34 | // Build Number 35 | // Revision 36 | // 37 | // You can specify all the values or you can default the Revision and Build Numbers 38 | // by using the '*' as shown below: 39 | [assembly: AssemblyVersion("1.0.0.0")] 40 | [assembly: AssemblyFileVersion("1.0.0.0")] 41 | -------------------------------------------------------------------------------- /Pixie/PixieTests/JetParameterTests.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | using Microsoft.Isam.Esent; 8 | using Microsoft.Isam.Esent.Interop; 9 | using Microsoft.VisualStudio.TestTools.UnitTesting; 10 | 11 | namespace PixieTests 12 | { 13 | /// 14 | /// Test the JetParameter class. 15 | /// 16 | [TestClass] 17 | public class JetParameterTests 18 | { 19 | private Instance instance; 20 | 21 | [TestInitialize] 22 | public void Setup() 23 | { 24 | this.instance = new Instance("JetParameterTests"); 25 | } 26 | 27 | [TestCleanup] 28 | public void Teardown() 29 | { 30 | Api.JetTerm(this.instance); 31 | } 32 | 33 | [TestMethod] 34 | [Priority(1)] 35 | public void SetJetParameterAsString() 36 | { 37 | var jetparam = new JetParameter(JET_param.BaseName, "abc"); 38 | jetparam.SetParameter(this.instance); 39 | 40 | var parameters = new InstanceParameters(this.instance); 41 | Assert.AreEqual("abc", parameters.BaseName); 42 | } 43 | 44 | [TestMethod] 45 | [Priority(1)] 46 | public void SetJetParameterAsInteger() 47 | { 48 | var jetparam = new JetParameter(JET_param.MaxVerPages, 3000); 49 | jetparam.SetParameter(this.instance); 50 | 51 | var parameters = new InstanceParameters(this.instance); 52 | Assert.AreEqual(3000, parameters.MaxVerPages); 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /EsentInteropTests/ApiTestHookTests.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace InteropApiTests 8 | { 9 | using Microsoft.Isam.Esent.Interop; 10 | using Microsoft.Isam.Esent.Interop.Implementation; 11 | using Microsoft.VisualStudio.TestTools.UnitTesting; 12 | 13 | /// 14 | /// Tests for ApiTestHook 15 | /// 16 | [TestClass] 17 | public class ApiTestHookTests 18 | { 19 | /// 20 | /// The ApiTestHook constructor should set the implementation. 21 | /// 22 | [TestMethod] 23 | [Priority(0)] 24 | [Description("Test that the ApiTestHook constructor sets the implementation.")] 25 | public void VerifyApiTestHookSetsApi() 26 | { 27 | var newImpl = new JetApi(); 28 | using (new ApiTestHook(newImpl)) 29 | { 30 | Assert.AreSame(Api.Impl, newImpl); 31 | } 32 | } 33 | 34 | /// 35 | /// Disposing of the ApiTestHook should reset the implementation. 36 | /// 37 | [TestMethod] 38 | [Priority(0)] 39 | [Description("Test that disposing of an ApiTestHook resets the implementation.")] 40 | public void VerifyDisposingApiTestHookResetsApi() 41 | { 42 | var oldImpl = Api.Impl; 43 | var newImpl = new JetApi(); 44 | using (new ApiTestHook(newImpl)) 45 | { 46 | } 47 | 48 | Assert.AreSame(Api.Impl, oldImpl); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /EsentInterop/EsentInvalidColumnException.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | using System; 10 | using System.Runtime.Serialization; 11 | 12 | /// 13 | /// Exception thrown when a column conversion fails. 14 | /// 15 | [Serializable] 16 | public class EsentInvalidColumnException : EsentException 17 | { 18 | /// 19 | /// Initializes a new instance of the EsentInvalidColumnException class. 20 | /// 21 | public EsentInvalidColumnException() 22 | { 23 | } 24 | 25 | #if MANAGEDESENT_ON_CORECLR 26 | #else 27 | /// 28 | /// Initializes a new instance of the EsentInvalidColumnException class. This constructor 29 | /// is used to deserialize a serialized exception. 30 | /// 31 | /// The data needed to deserialize the object. 32 | /// The deserialization context. 33 | protected EsentInvalidColumnException(SerializationInfo info, StreamingContext context) : 34 | base(info, context) 35 | { 36 | } 37 | #endif 38 | 39 | /// 40 | /// Gets a text message describing the exception. 41 | /// 42 | public override string Message 43 | { 44 | get 45 | { 46 | return "Column is not valid for this operation"; 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /EsentInterop/TableidColumnInfoEnumerator.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | /// 10 | /// Enumerate columns in a table specified by a tableid. 11 | /// 12 | internal sealed class TableidColumnInfoEnumerator : ColumnInfoEnumerator 13 | { 14 | /// 15 | /// The table to get the column information from. 16 | /// 17 | private readonly JET_TABLEID tableid; 18 | 19 | /// 20 | /// Initializes a new instance of the class. 21 | /// 22 | /// 23 | /// The session to use. 24 | /// 25 | /// 26 | /// The table to get column information from. 27 | /// 28 | public TableidColumnInfoEnumerator(JET_SESID sesid, JET_TABLEID tableid) 29 | : base(sesid) 30 | { 31 | this.tableid = tableid; 32 | } 33 | 34 | /// 35 | /// Open the table to be enumerated. This should set . 36 | /// 37 | protected override void OpenTable() 38 | { 39 | JET_COLUMNLIST columnlist; 40 | Api.JetGetTableColumnInfo(this.Sesid, this.tableid, string.Empty, out columnlist); 41 | this.Columnlist = columnlist; 42 | this.TableidToEnumerate = this.Columnlist.tableid; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /isam/UnicodeIndexFlags.cs: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // 5 | // --------------------------------------------------------------------------- 6 | 7 | // --------------------------------------------------------------------- 8 | // 9 | // 10 | // --------------------------------------------------------------------- 11 | 12 | namespace Microsoft.Database.Isam 13 | { 14 | using System; 15 | 16 | /// 17 | /// Flags for unicode index creation 18 | /// 19 | [Flags] 20 | internal enum UnicodeIndexFlags 21 | { 22 | /// 23 | /// No options. 24 | /// 25 | None = 0, 26 | 27 | /// 28 | /// Ignore case. 29 | /// 30 | CaseInsensitive = 0x00000001, // NORM_IGNORECASE 31 | 32 | /// 33 | /// Ignore nonspacing chars. 34 | /// 35 | AccentInsensitive = 0x00000002, // NORM_IGNORENONSPACE 36 | 37 | /// 38 | /// Ignore symbols. 39 | /// 40 | IgnoreSymbols = 0x00000004, // NORM_IGNORESYMBOLS 41 | 42 | /// 43 | /// Ignore kanatype. 44 | /// 45 | KanaInsensitive = 0x00010000, // NORM_IGNOREKANATYPE 46 | 47 | /// 48 | /// Ignore width. 49 | /// 50 | WidthInsensitive = 0x00020000, // NORM_IGNOREWIDTH 51 | 52 | /// 53 | /// Treat punctuation the same as symbols. 54 | /// 55 | StringSort = 0x00001000, // SORT_STRINGSORT 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Pixie/SqlScanner.lex: -------------------------------------------------------------------------------- 1 | %namespace Microsoft.Isam.Esent.Sql.Parsing 2 | 3 | %{ 4 | public override void yyerror(string format, params object[] args) 5 | { 6 | throw new EsentSqlParseException(String.Format(format, args)); 7 | } 8 | %} 9 | 10 | %% 11 | 12 | ATTACH { return (int)Tokens.ATTACH; } 13 | BEGIN { return (int)Tokens.BEGIN; } 14 | BINARY { return (int)Tokens.BINARY; } 15 | BOOL(EAN)? { return (int)Tokens.BOOL; } 16 | BYTE { return (int)Tokens.BYTE; } 17 | COMMIT { return (int)Tokens.COMMIT; } 18 | CREATE { return (int)Tokens.CREATE; } 19 | DATABASE { return (int)Tokens.DATABASE; } 20 | DATETIME { return (int)Tokens.DATETIME; } 21 | DETACH { return (int)Tokens.DETACH; } 22 | END { return (int)Tokens.END; } 23 | GUID { return (int)Tokens.GUID; } 24 | INDEX { return (int)Tokens.INDEX; } 25 | INSERT { return (int)Tokens.INSERT; } 26 | INT(EGER)? { return (int)Tokens.INT; } 27 | INTO { return (int)Tokens.INTO; } 28 | LONG { return (int)Tokens.LONG; } 29 | RELEASE { return (int)Tokens.RELEASE; } 30 | ROLLBACK { return (int)Tokens.ROLLBACK; } 31 | SAVEPOINT { return (int)Tokens.SAVEPOINT; } 32 | SHORT { return (int)Tokens.SHORT; } 33 | TABLE { return (int)Tokens.TABLE; } 34 | TEXT { return (int)Tokens.TEXT; } 35 | TO { return (int)Tokens.TO; } 36 | TRANSACTION { return (int)Tokens.TRANSACTION; } 37 | VALUES { return (int)Tokens.VALUES; } 38 | 39 | [A-Za-z][A-Za-z0-9_]* { yylval.name = yytext; return (int)Tokens.NAME; } 40 | 41 | [\-+*/:(),.;] { return yytext[0]; } 42 | 43 | [0-9]+ { yylval.intValue = Int64.Parse(yytext); return (int)Tokens.INTEGER; } 44 | 45 | [0-9]+"."[0-9]* | 46 | "."[0-9]+ { yylval.realValue = Double.Parse(yytext); return (int)Tokens.REAL_NUMBER; } 47 | 48 | "--".* ; /* SQL Comment */ 49 | 50 | '[^']*' { yylval.stringValue = yytext.Substring(1,yytext.Length-2); return (int)Tokens.STRING; } 51 | 52 | -------------------------------------------------------------------------------- /EsentCollections/ReadOnlyTransaction.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | // 6 | // The disposable ReadOnlyTransaction wrapper. 7 | // 8 | // -------------------------------------------------------------------------------------------------------------------- 9 | 10 | namespace Microsoft.Isam.Esent.Collections.Generic 11 | { 12 | using System; 13 | using Microsoft.Isam.Esent.Interop; 14 | 15 | /// 16 | /// Disposable wrapper for a read-only transaction. The Dispose method 17 | /// will commit the transaction. Unlike the Transaction class this is 18 | /// a struct, so it isn't as flexible, but it can be faster. 19 | /// 20 | internal struct ReadOnlyTransaction : IDisposable 21 | { 22 | /// 23 | /// The session that has the transaction. 24 | /// 25 | private readonly JET_SESID sesid; 26 | 27 | /// 28 | /// Initializes a new instance of the struct. 29 | /// 30 | /// 31 | /// The sesid. 32 | /// 33 | public ReadOnlyTransaction(JET_SESID sesid) 34 | { 35 | this.sesid = sesid; 36 | Api.JetBeginTransaction2(this.sesid, BeginTransactionGrbit.ReadOnly); 37 | } 38 | 39 | /// 40 | /// Rollback the transaction if not already committed. 41 | /// 42 | public void Dispose() 43 | { 44 | Api.JetCommitTransaction(this.sesid, CommitTransactionGrbit.LazyFlush); 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /EsentCollectionsSamples/HelloWorld/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | using System.Reflection; 8 | using System.Runtime.InteropServices; 9 | 10 | // General Information about an assembly is controlled through the following 11 | // set of attributes. Change these attribute values to modify the information 12 | // associated with an assembly. 13 | [assembly: AssemblyTitle("HelloWorld")] 14 | [assembly: AssemblyDescription("")] 15 | [assembly: AssemblyConfiguration("")] 16 | [assembly: AssemblyCompany("Microsoft")] 17 | [assembly: AssemblyProduct("HelloWorld")] 18 | [assembly: AssemblyCopyright("Copyright (c) Microsoft. All Rights Reserved.")] 19 | [assembly: AssemblyTrademark("")] 20 | [assembly: AssemblyCulture("")] 21 | 22 | // Setting ComVisible to false makes the types in this assembly not visible 23 | // to COM components. If you need to access a type in this assembly from 24 | // COM, set the ComVisible attribute to true on that type. 25 | [assembly: ComVisible(false)] 26 | 27 | // The following GUID is for the ID of the typelib if this project is exposed to COM 28 | [assembly: Guid("bfddeb7f-6868-44b1-8797-06dbf9abb128")] 29 | 30 | // Version information for an assembly consists of the following four values: 31 | // 32 | // Major Version 33 | // Minor Version 34 | // Build Number 35 | // Revision 36 | // 37 | // You can specify all the values or you can default the Build and Revision Numbers 38 | // by using the '*' as shown below: 39 | // [assembly: AssemblyVersion("1.0.*")] 40 | [assembly: AssemblyVersion("1.0.0.0")] 41 | [assembly: AssemblyFileVersion("1.0.0.0")] 42 | -------------------------------------------------------------------------------- /EsentInteropSamples/DbUtilTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | // 6 | // Assembly configuration for DbUtilTests. 7 | // 8 | //----------------------------------------------------------------------- 9 | 10 | using System.Reflection; 11 | using System.Runtime.InteropServices; 12 | 13 | // General Information about an assembly is controlled through the following 14 | // set of attributes. Change these attribute values to modify the information 15 | // associated with an assembly. 16 | [assembly: AssemblyTitle("DbUtilTests")] 17 | [assembly: AssemblyDescription("")] 18 | [assembly: AssemblyConfiguration("")] 19 | [assembly: AssemblyCompany("Microsoft")] 20 | [assembly: AssemblyProduct("DbUtilTests")] 21 | [assembly: AssemblyCopyright("Copyright © Microsoft")] 22 | [assembly: AssemblyTrademark("")] 23 | [assembly: AssemblyCulture("")] 24 | 25 | // Setting ComVisible to false makes the types in this assembly not visible 26 | // to COM componenets. If you need to access a type in this assembly from 27 | // COM, set the ComVisible attribute to true on that type. 28 | [assembly: ComVisible(false)] 29 | 30 | // The following GUID is for the ID of the typelib if this project is exposed to COM 31 | [assembly: Guid("fa5cee94-8836-4e47-89b4-7a1140725e10")] 32 | 33 | // Version information for an assembly consists of the following four values: 34 | // 35 | // Major Version 36 | // Minor Version 37 | // Build Number 38 | // Revision 39 | // 40 | // You can specify all the values or you can default the Revision and Build Numbers 41 | // by using the '*' as shown below: 42 | [assembly: AssemblyVersion("1.0.0.0")] 43 | [assembly: AssemblyFileVersion("1.0.0.0")] 44 | -------------------------------------------------------------------------------- /EsentCollections/Settings.StyleCop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | True 8 | 9 | 10 | 11 | 12 | True 13 | 14 | 15 | 16 | 17 | True 18 | 19 | 20 | 21 | 22 | True 23 | 24 | 25 | 26 | 27 | True 28 | 29 | 30 | 31 | 32 | False 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | True 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /EsentCollectionsSamples/RssDictionarySample/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | using System.Reflection; 8 | using System.Runtime.InteropServices; 9 | 10 | // General Information about an assembly is controlled through the following 11 | // set of attributes. Change these attribute values to modify the information 12 | // associated with an assembly. 13 | [assembly: AssemblyTitle("RssDictionarySample")] 14 | [assembly: AssemblyDescription("")] 15 | [assembly: AssemblyConfiguration("")] 16 | [assembly: AssemblyCompany("Microsoft")] 17 | [assembly: AssemblyProduct("RssDictionarySample")] 18 | [assembly: AssemblyCopyright("Copyright (c) Microsoft. All Rights Reserved.")] 19 | [assembly: AssemblyTrademark("")] 20 | [assembly: AssemblyCulture("")] 21 | 22 | // Setting ComVisible to false makes the types in this assembly not visible 23 | // to COM components. If you need to access a type in this assembly from 24 | // COM, set the ComVisible attribute to true on that type. 25 | [assembly: ComVisible(false)] 26 | 27 | // The following GUID is for the ID of the typelib if this project is exposed to COM 28 | [assembly: Guid("0c1a5643-543e-412c-a5f0-feb50cb1bee8")] 29 | 30 | // Version information for an assembly consists of the following four values: 31 | // 32 | // Major Version 33 | // Minor Version 34 | // Build Number 35 | // Revision 36 | // 37 | // You can specify all the values or you can default the Build and Revision Numbers 38 | // by using the '*' as shown below: 39 | // [assembly: AssemblyVersion("1.0.*")] 40 | [assembly: AssemblyVersion("1.0.0.0")] 41 | [assembly: AssemblyFileVersion("1.0.0.0")] 42 | -------------------------------------------------------------------------------- /isamunittests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | // 6 | // Assembly properties. 7 | // 8 | // -------------------------------------------------------------------------------------------------------------------- 9 | 10 | using System; 11 | using System.Reflection; 12 | using System.Runtime.InteropServices; 13 | 14 | // General Information about an assembly is controlled through the following 15 | // set of attributes. Change these attribute values to modify the information 16 | // associated with an assembly. 17 | [assembly: AssemblyTitle("IsamUnitTests")] 18 | [assembly: AssemblyDescription("")] 19 | [assembly: AssemblyConfiguration("")] 20 | [assembly: AssemblyCompany("Microsoft")] 21 | [assembly: AssemblyProduct("IsamUnitTests")] 22 | [assembly: AssemblyCopyright("Copyright (c) Microsoft. All Rights Reserved.")] 23 | [assembly: AssemblyTrademark("")] 24 | [assembly: AssemblyCulture("")] 25 | 26 | // Setting ComVisible to false makes the types in this assembly not visible 27 | // to COM components. If you need to access a type in this assembly from 28 | // COM, set the ComVisible attribute to true on that type. 29 | [assembly: ComVisible(false)] 30 | 31 | [assembly: CLSCompliant(true)] 32 | 33 | // Version information for an assembly consists of the following four values: 34 | // 35 | // Major Version 36 | // Minor Version 37 | // Build Number 38 | // Revision 39 | // 40 | // You can specify all the values or you can default the Build and Revision Numbers 41 | // by using the '*' as shown below: 42 | // [assembly: AssemblyVersion("1.0.*")] 43 | [assembly: AssemblyVersion("1.0.0.0")] 44 | [assembly: AssemblyFileVersion("1.0.0.0")] 45 | 46 | -------------------------------------------------------------------------------- /EsentInterop/OnlineMaintenanceHelpers.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Diagnostics; 12 | using System.Text; 13 | using Microsoft.Isam.Esent.Interop.Implementation; 14 | 15 | /// 16 | /// Helper methods for the ESENT API. These methods deal with database 17 | /// meta-data. 18 | /// 19 | public static partial class Api 20 | { 21 | /// 22 | /// Starts and stops database defragmentation tasks that improves data 23 | /// organization within a database. 24 | /// 25 | /// The session to use for the call. 26 | /// The database to be defragmented. 27 | /// 28 | /// Under some options defragmentation is performed for the entire database described by the given 29 | /// database ID, and other options (such as ) require 30 | /// the name of the table to defragment. 31 | /// 32 | /// Defragmentation options. 33 | /// A warning code. 34 | /// 35 | public static JET_wrn Defragment( 36 | JET_SESID sesid, 37 | JET_DBID dbid, 38 | string tableName, 39 | DefragGrbit grbit) 40 | { 41 | return Api.Check(Impl.Defragment(sesid, dbid, tableName, grbit)); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /EsentInterop/BoxedValueCache.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | using System; 10 | 11 | /// 12 | /// A cache for boxed values. 13 | /// 14 | /// The type of object to cache. 15 | internal static class BoxedValueCache 16 | where T : struct, IEquatable 17 | { 18 | /// 19 | /// Number of boxed values to cache. 20 | /// 21 | private const int NumCachedBoxedValues = 257; 22 | 23 | /// 24 | /// Cached boxed values. 25 | /// 26 | private static readonly object[] BoxedValues = new object[NumCachedBoxedValues]; 27 | 28 | /// 29 | /// Gets a boxed version of the value. A cached copy is used if possible. 30 | /// 31 | /// The value to box. 32 | /// A boxed version of the value. 33 | public static object GetBoxedValue(T? value) 34 | { 35 | if (!value.HasValue) 36 | { 37 | return null; 38 | } 39 | 40 | T valueToBox = value.Value; 41 | int index = (valueToBox.GetHashCode() & 0x7fffffff) % NumCachedBoxedValues; 42 | object boxedValue = BoxedValues[index]; 43 | if (null == boxedValue || !((T)boxedValue).Equals(valueToBox)) 44 | { 45 | boxedValue = valueToBox; 46 | BoxedValues[index] = boxedValue; 47 | } 48 | 49 | return boxedValue; 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /EsentInteropSamples/DbUtil/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | using System.Reflection; 8 | using System.Runtime.InteropServices; 9 | 10 | // General Information about an assembly is controlled through the following 11 | // set of attributes. Change these attribute values to modify the information 12 | // associated with an assembly. 13 | [assembly: AssemblyTitle("DbUtil")] 14 | [assembly: AssemblyDescription("")] 15 | [assembly: AssemblyConfiguration("")] 16 | [assembly: AssemblyCompany("Microsoft")] 17 | [assembly: AssemblyProduct("DbUtil")] 18 | [assembly: AssemblyCopyright("Copyright (c) Microsoft. All rights reserved.")] 19 | [assembly: AssemblyTrademark("")] 20 | [assembly: AssemblyCulture("")] 21 | 22 | // Setting ComVisible to false makes the types in this assembly not visible 23 | // to COM components. If you need to access a type in this assembly from 24 | // COM, set the ComVisible attribute to true on that type. 25 | [assembly: ComVisible(false)] 26 | 27 | // The following GUID is for the ID of the typelib if this project is exposed to COM 28 | [assembly: Guid("e100851f-8342-408d-8c80-b79b0c8387df")] 29 | 30 | // Version information for an assembly consists of the following four values: 31 | // 32 | // Major Version 33 | // Minor Version 34 | // Build Number 35 | // Revision 36 | // 37 | // You can specify all the values or you can default the Build and Revision Numbers 38 | // by using the '*' as shown below: 39 | // [assembly: AssemblyVersion("1.0.*")] 40 | [assembly: AssemblyVersion("1.0.0.0")] 41 | [assembly: AssemblyFileVersion("1.0.0.0")] 42 | 43 | [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("DbUtilTests")] -------------------------------------------------------------------------------- /Pixie/EsentColumnNotFoundException.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | using System; 8 | using System.Runtime.Serialization; 9 | 10 | namespace Microsoft.Isam.Esent 11 | { 12 | /// 13 | /// The requested column isn't present in the table. 14 | /// 15 | [Serializable] 16 | public class EsentColumnNotFoundException : EsentException 17 | { 18 | /// 19 | /// Initializes a new instance of the EsentColumnNotFoundException class. 20 | /// 21 | /// The table that was searched for the column. 22 | /// The name of the column. 23 | /// The exception raised when the column was searched for. 24 | internal EsentColumnNotFoundException(string table, string column, Exception innerException) 25 | : base(String.Format("Column '{0}' is not present in the table '{1}'", column, table), innerException) 26 | { 27 | this.Data["table"] = table; 28 | this.Data["column"] = column; 29 | } 30 | 31 | /// 32 | /// Initializes a new instance of the EsentColumnNotFoundException class. This constructor 33 | /// is used to deserialize a serialized exception. 34 | /// 35 | /// The data needed to deserialize the object. 36 | /// The deserialization context. 37 | protected EsentColumnNotFoundException(SerializationInfo info, StreamingContext context) : 38 | base(info, context) 39 | { 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /EsentCollectionsTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | // 6 | // Assembly properties. 7 | // 8 | // -------------------------------------------------------------------------------------------------------------------- 9 | 10 | using System; 11 | using System.Reflection; 12 | using System.Runtime.InteropServices; 13 | 14 | // General Information about an assembly is controlled through the following 15 | // set of attributes. Change these attribute values to modify the information 16 | // associated with an assembly. 17 | [assembly: AssemblyTitle("EsentCollectionsTests")] 18 | [assembly: AssemblyDescription("Persistent Dictionary Tests for ESE/ESENT")] 19 | [assembly: AssemblyConfiguration("")] 20 | [assembly: AssemblyCompany("Microsoft")] 21 | [assembly: AssemblyProduct("EsentCollectionsTests")] 22 | [assembly: AssemblyCopyright("Copyright (c) Microsoft. All Rights Reserved.")] 23 | [assembly: AssemblyTrademark("")] 24 | [assembly: AssemblyCulture("")] 25 | 26 | // Setting ComVisible to false makes the types in this assembly not visible 27 | // to COM components. If you need to access a type in this assembly from 28 | // COM, set the ComVisible attribute to true on that type. 29 | [assembly: ComVisible(false)] 30 | 31 | [assembly: CLSCompliant(true)] 32 | 33 | // Version information for an assembly consists of the following four values: 34 | // 35 | // Major Version 36 | // Minor Version 37 | // Build Number 38 | // Revision 39 | // 40 | // You can specify all the values or you can default the Build and Revision Numbers 41 | // by using the '*' as shown below: 42 | // [assembly: AssemblyVersion("1.0.*")] 43 | [assembly: AssemblyVersion("1.0.0.0")] 44 | [assembly: AssemblyFileVersion("1.0.0.0")] 45 | -------------------------------------------------------------------------------- /EsentInterop/ObjectInfoFlags.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | using System; 10 | 11 | /// 12 | /// Flags for ESENT objects (tables). Used in . 13 | /// 14 | [Flags] 15 | public enum ObjectInfoFlags 16 | { 17 | /// 18 | /// Default options. 19 | /// 20 | None = 0, 21 | 22 | /// 23 | /// Object is for internal use only. 24 | /// 25 | System = -2147483648, // 0x80000000 26 | // It's possible to use bit shift to avoid triggering fxcop CA2217. 27 | // System = (long)0x1L << 31, // 0x80000000; 28 | // (http://social.msdn.microsoft.com/Forums/en-US/vstscode/thread/a44aa5c1-c62a-46b7-8009-dc46ba21ba93) 29 | // But we don't want to change the type of the enum to a long. 30 | 31 | /// 32 | /// Table's DDL is fixed. 33 | /// 34 | TableFixedDDL = 0x40000000, 35 | 36 | /// 37 | /// Table's DDL is inheritable. 38 | /// 39 | TableTemplate = 0x20000000, 40 | 41 | /// 42 | /// Table's DDL is inherited from a template table. 43 | /// 44 | TableDerived = 0x10000000, 45 | 46 | /// 47 | /// Fixed or variable columns in derived tables (so that fixed or variable 48 | /// columns can be added to the template in the future). 49 | /// Used in conjunction with . 50 | /// 51 | TableNoFixedVarColumnsInDerivedTables = 0x04000000, 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /EsentCollections/Copy.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | // 6 | // Provides generic copy methods. 7 | // 8 | // -------------------------------------------------------------------------------------------------------------------- 9 | 10 | namespace Microsoft.Isam.Esent.Collections.Generic 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | /// 16 | /// Provides generic copy methods. 17 | /// 18 | internal static class Copy 19 | { 20 | /// 21 | /// Copy one collection to an array. 22 | /// 23 | /// The type to compare. 24 | /// The items to copy. 25 | /// The index to copy into. 26 | /// The location in the index to start copying into. 27 | public static void CopyTo(ICollection items, T[] array, int arrayIndex) 28 | { 29 | if (null == array) 30 | { 31 | throw new ArgumentNullException("array"); 32 | } 33 | 34 | if (arrayIndex < 0 || arrayIndex >= array.Length) 35 | { 36 | throw new ArgumentOutOfRangeException("arrayIndex", arrayIndex, "not inside array"); 37 | } 38 | 39 | if (checked(array.Length - arrayIndex) < items.Count) 40 | { 41 | throw new ArgumentOutOfRangeException("array", array.Length, "array is not long enough"); 42 | } 43 | 44 | int i = arrayIndex; 45 | foreach (T t in items) 46 | { 47 | array[i++] = t; 48 | } 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /EsentInteropSamples/StockSample/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | // Properties for the StockSample application 6 | //----------------------------------------------------------------------- 7 | 8 | using System; 9 | using System.Reflection; 10 | using System.Runtime.InteropServices; 11 | 12 | // General Information about an assembly is controlled through the following 13 | // set of attributes. Change these attribute values to modify the information 14 | // associated with an assembly. 15 | [assembly: AssemblyTitle("StockSample")] 16 | [assembly: AssemblyDescription("")] 17 | [assembly: AssemblyConfiguration("")] 18 | [assembly: AssemblyCompany("Microsoft")] 19 | [assembly: AssemblyProduct("StockSample")] 20 | [assembly: AssemblyCopyright("Copyright (c) Microsoft. All rights reserved.")] 21 | [assembly: AssemblyTrademark("")] 22 | [assembly: AssemblyCulture("")] 23 | 24 | // Setting ComVisible to false makes the types in this assembly not visible 25 | // to COM components. If you need to access a type in this assembly from 26 | // COM, set the ComVisible attribute to true on that type. 27 | [assembly: ComVisible(false)] 28 | 29 | [assembly: CLSCompliant(true)] 30 | 31 | // The following GUID is for the ID of the typelib if this project is exposed to COM 32 | [assembly: Guid("65560f34-47de-446b-b2d4-49149e1e8e73")] 33 | 34 | // Version information for an assembly consists of the following four values: 35 | // 36 | // Major Version 37 | // Minor Version 38 | // Build Number 39 | // Revision 40 | // 41 | // You can specify all the values or you can default the Build and Revision Numbers 42 | // by using the '*' as shown below: 43 | // [assembly: AssemblyVersion("1.0.*")] 44 | [assembly: AssemblyVersion("1.0.0.0")] 45 | [assembly: AssemblyFileVersion("1.0.0.0")] 46 | -------------------------------------------------------------------------------- /EsentInterop/EsentException.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent 8 | { 9 | using System; 10 | using System.Runtime.Serialization; 11 | #if !MANAGEDESENT_SUPPORTS_SERIALIZATION && MANAGEDESENT_ON_WSA 12 | using Microsoft.Isam.Esent.Interop; 13 | using SerializableAttribute = Microsoft.Isam.Esent.Interop.SerializableAttribute; 14 | #endif 15 | 16 | /// 17 | /// Base class for ESENT exceptions. 18 | /// 19 | [Serializable] 20 | public abstract class EsentException : Exception 21 | { 22 | /// 23 | /// Initializes a new instance of the EsentException class. 24 | /// 25 | protected EsentException() 26 | { 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the EsentException class with a specified error message. 31 | /// 32 | /// The message that describes the error. 33 | protected EsentException(string message) 34 | : base(message) 35 | { 36 | } 37 | 38 | /// 39 | /// Initializes a new instance of the EsentException class. This constructor 40 | /// is used to deserialize a serialized exception. 41 | /// 42 | /// The data needed to deserialize the object. 43 | /// The deserialization context. 44 | protected EsentException(SerializationInfo info, StreamingContext context) 45 | #if (MANAGEDESENT_SUPPORTS_SERIALIZATION || !MANAGEDESENT_ON_WSA) && !NET 46 | : base(info, context) 47 | #endif 48 | { 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /EsentInteropSamples/EsentSample/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | // 6 | // Properties for the EsentSample application. 7 | // 8 | // -------------------------------------------------------------------------------------------------------------------- 9 | 10 | using System.Reflection; 11 | using System.Runtime.InteropServices; 12 | 13 | // General Information about an assembly is controlled through the following 14 | // set of attributes. Change these attribute values to modify the information 15 | // associated with an assembly. 16 | [assembly: AssemblyTitle("EsentSample")] 17 | [assembly: AssemblyDescription("")] 18 | [assembly: AssemblyConfiguration("")] 19 | [assembly: AssemblyCompany("Microsoft")] 20 | [assembly: AssemblyProduct("EsentSample")] 21 | [assembly: AssemblyCopyright("Copyright (c) Microsoft. All Rights Reserved.")] 22 | [assembly: AssemblyTrademark("")] 23 | [assembly: AssemblyCulture("")] 24 | 25 | // Setting ComVisible to false makes the types in this assembly not visible 26 | // to COM components. If you need to access a type in this assembly from 27 | // COM, set the ComVisible attribute to true on that type. 28 | [assembly: ComVisible(false)] 29 | 30 | // The following GUID is for the ID of the typelib if this project is exposed to COM 31 | [assembly: Guid("17266187-4a15-4f2b-a96d-c721d2a2fc3d")] 32 | 33 | // Version information for an assembly consists of the following four values: 34 | // 35 | // Major Version 36 | // Minor Version 37 | // Build Number 38 | // Revision 39 | // 40 | // You can specify all the values or you can default the Build and Revision Numbers 41 | // by using the '*' as shown below: 42 | // [assembly: AssemblyVersion("1.0.*")] 43 | [assembly: AssemblyVersion("1.0.0.0")] 44 | [assembly: AssemblyFileVersion("1.0.0.0")] 45 | -------------------------------------------------------------------------------- /EsentCollectionsTests/Cleanup.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | // 6 | // Methods for test cleanup. 7 | // 8 | // -------------------------------------------------------------------------------------------------------------------- 9 | 10 | namespace EsentCollectionsTests 11 | { 12 | using System; 13 | using System.IO; 14 | using System.Threading; 15 | 16 | /// 17 | /// Methods for test cleanup. 18 | /// 19 | public static class Cleanup 20 | { 21 | /// 22 | /// Delete a directory, retrying the operation if the delete fails. 23 | /// 24 | /// 25 | /// The directory to delete. 26 | /// 27 | public static void DeleteDirectoryWithRetry(string directory) 28 | { 29 | const int MaxAttempts = 3; 30 | for (int attempt = 1; attempt <= MaxAttempts; ++attempt) 31 | { 32 | try 33 | { 34 | if (Directory.Exists(directory)) 35 | { 36 | Directory.Delete(directory, true); 37 | } 38 | 39 | return; 40 | } 41 | catch (UnauthorizedAccessException) 42 | { 43 | if (attempt == MaxAttempts) 44 | { 45 | throw; 46 | } 47 | } 48 | catch (IOException) 49 | { 50 | if (attempt == MaxAttempts) 51 | { 52 | throw; 53 | } 54 | } 55 | 56 | Thread.Sleep(TimeSpan.FromSeconds(1)); 57 | } 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /EsentCollections/PersistentDictionaryMath.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | // 6 | // A collection of math-related functions useful for PersistentDictionary utilization. 7 | // 8 | // -------------------------------------------------------------------------------------------------------------------- 9 | 10 | namespace Microsoft.Isam.Esent.Collections.Generic 11 | { 12 | /// 13 | /// A collection of math-related functions useful for PersistentDictionary utilization. 14 | /// 15 | internal static class PersistentDictionaryMath 16 | { 17 | /// 18 | /// Calculates a hash code for the normalized key. 19 | /// 20 | /// A byte array. 21 | /// A hash code based on the byte array. 22 | /// 23 | /// This is similar to Store's IEqualityComparer<object[]>.GetHashCode(object[] x). 24 | /// It is not meant to be cryptographically secure. 25 | /// 26 | public static int GetHashCodeForKey(byte[] normalizedKey) 27 | { 28 | // This is similar to Store's IEqualityComparer.GetHashCode(object[] x) 29 | 30 | // XOR-together the hash code 4-bytes at a time. 31 | int hashCode = normalizedKey.Length; 32 | for (int i = 0; i < normalizedKey.Length; ++i) 33 | { 34 | hashCode ^= normalizedKey[i]; 35 | 36 | // Rotate the hash by one bit so that arrays with the same 37 | // elements in a different order will have different hash 38 | // values 39 | hashCode = hashCode << 1 | hashCode >> 31; 40 | } 41 | 42 | return hashCode; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /EsentCollections/PersistentDictionaryTracing.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | // 6 | // PersistentDictionary tracing code. 7 | // 8 | // -------------------------------------------------------------------------------------------------------------------- 9 | 10 | namespace Microsoft.Isam.Esent.Collections.Generic 11 | { 12 | using System; 13 | using System.Diagnostics; 14 | using System.Globalization; 15 | 16 | /// 17 | /// PersistentDictionary tracing. 18 | /// 19 | public partial class PersistentDictionary where TKey : IComparable 20 | { 21 | /// 22 | /// PersistentDictionary tracing. 23 | /// 24 | private readonly TraceSwitch traceSwitch = new TraceSwitch("PersistentDictionary", "PersistentDictionary"); 25 | 26 | /// 27 | /// Gets the TraceSwitch for the dictionary. 28 | /// 29 | /// 30 | /// The TraceSwitch for the dictionary. 31 | /// 32 | public TraceSwitch TraceSwitch 33 | { 34 | [DebuggerStepThrough] 35 | get { return this.traceSwitch; } 36 | } 37 | 38 | /// 39 | /// Trace the results of examining a Where expression. 40 | /// 41 | /// The calculated range. 42 | /// True if the range is to be enumerated in reverse order. 43 | [Conditional("TRACE")] 44 | internal void TraceWhere(KeyRange range, bool isReversed) 45 | { 46 | Trace.WriteLineIf(this.traceSwitch.TraceVerbose, string.Format(CultureInfo.InvariantCulture, "WHERE: {0} {1}", range, isReversed ? "(reversed)" : string.Empty)); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Pixie/EsentSqlParseException.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | using System; 8 | using System.Runtime.Serialization; 9 | 10 | namespace Microsoft.Isam.Esent 11 | { 12 | /// 13 | /// Parse exceptions. 14 | /// 15 | [Serializable] 16 | public class EsentSqlParseException : EsentException 17 | { 18 | /// 19 | /// Trace object used to track parse exceptions. 20 | /// 21 | private static readonly Tracer tracer = new Tracer("ParseException", "Parsing exception", "ParseException"); 22 | 23 | /// 24 | /// Initializes a new instance of the EsentSqlParseException class. 25 | /// 26 | /// Description of the parse error. 27 | internal EsentSqlParseException(string description) 28 | : base(description) 29 | { 30 | this.Tracer.TraceError(description); 31 | } 32 | 33 | /// 34 | /// Initializes a new instance of the EsentSqlParseException class. This constructor 35 | /// is used to deserialize a serialized exception. 36 | /// 37 | /// The data needed to deserialize the object. 38 | /// The deserialization context. 39 | protected EsentSqlParseException(SerializationInfo info, StreamingContext context) : 40 | base(info, context) 41 | { 42 | } 43 | 44 | /// 45 | /// Gets the Tracer object for the ParseException class. 46 | /// 47 | private Tracer Tracer 48 | { 49 | get 50 | { 51 | return EsentSqlParseException.tracer; 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /EsentInterop/TableColumnInfoEnumerator.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace Microsoft.Isam.Esent.Interop 8 | { 9 | /// 10 | /// Enumerate columns in a table specified by dbid and name. 11 | /// 12 | internal sealed class TableColumnInfoEnumerator : ColumnInfoEnumerator 13 | { 14 | /// 15 | /// The database containing the table. 16 | /// 17 | private readonly JET_DBID dbid; 18 | 19 | /// 20 | /// The name of the table. 21 | /// 22 | private readonly string tablename; 23 | 24 | /// 25 | /// Initializes a new instance of the class. 26 | /// 27 | /// 28 | /// The session to use. 29 | /// 30 | /// 31 | /// The database containing the table. 32 | /// 33 | /// 34 | /// The name of the table. 35 | /// 36 | public TableColumnInfoEnumerator(JET_SESID sesid, JET_DBID dbid, string tablename) 37 | : base(sesid) 38 | { 39 | this.dbid = dbid; 40 | this.tablename = tablename; 41 | } 42 | 43 | /// 44 | /// Open the table to be enumerated. This should set . 45 | /// 46 | protected override void OpenTable() 47 | { 48 | JET_COLUMNLIST columnlist; 49 | Api.JetGetColumnInfo(this.Sesid, this.dbid, this.tablename, string.Empty, out columnlist); 50 | this.Columnlist = columnlist; 51 | this.TableidToEnumerate = this.Columnlist.tableid; 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /EsentInteropTests/Windows8SerializationTests.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace InteropApiTests 8 | { 9 | using Microsoft.Isam.Esent.Interop; 10 | using Microsoft.Isam.Esent.Interop.Windows8; 11 | using Microsoft.VisualStudio.TestTools.UnitTesting; 12 | 13 | /// 14 | /// Tests for serialization/deserialization of objects. 15 | /// 16 | public partial class SerializationTests 17 | { 18 | #if !MANAGEDESENT_ON_CORECLR 19 | /// 20 | /// Verify that an ErrorInfo can be serialized. 21 | /// 22 | [TestMethod] 23 | [Priority(0)] 24 | [Description("Verify that an ErrorInfo can be serialized")] 25 | public void VerifyErrorInfoCanBeSerialized() 26 | { 27 | var expected = new JET_ERRINFOBASIC() 28 | { 29 | errValue = JET_err.ReadVerifyFailure, 30 | errcat = JET_ERRCAT.Corruption, 31 | rgCategoricalHierarchy = new JET_ERRCAT[] { JET_ERRCAT.Data, 0, 0, 0, 0, 0, 0, 0 }, 32 | lSourceLine = 42, 33 | rgszSourceFile = "sourcefile.cxx", 34 | }; 35 | 36 | var actual = SerializeDeserialize(expected); 37 | Assert.AreNotSame(expected, actual); 38 | Assert.AreEqual(expected.errValue, actual.errValue); 39 | Assert.AreEqual(expected.errcat, actual.errcat); 40 | Assert.AreEqual(expected.rgCategoricalHierarchy[0], actual.rgCategoricalHierarchy[0]); 41 | Assert.AreEqual(expected.rgCategoricalHierarchy[1], actual.rgCategoricalHierarchy[1]); 42 | Assert.AreEqual(expected.lSourceLine, actual.lSourceLine); 43 | Assert.AreEqual(expected.rgszSourceFile, actual.rgszSourceFile); 44 | } 45 | #endif // !MANAGEDESENT_ON_CORECLR 46 | } 47 | } -------------------------------------------------------------------------------- /Pixie/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | using System; 8 | using System.Reflection; 9 | using System.Runtime.CompilerServices; 10 | using System.Runtime.InteropServices; 11 | 12 | // General Information about an assembly is controlled through the following 13 | // set of attributes. Change these attribute values to modify the information 14 | // associated with an assembly. 15 | [assembly: AssemblyTitle("Pixie")] 16 | [assembly: AssemblyDescription("")] 17 | [assembly: AssemblyConfiguration("")] 18 | [assembly: AssemblyCompany("")] 19 | [assembly: AssemblyProduct("Pixie")] 20 | [assembly: AssemblyCopyright("Copyright (c) Microsoft. All Rights Reserved.")] 21 | [assembly: AssemblyTrademark("")] 22 | [assembly: AssemblyCulture("")] 23 | 24 | // Setting ComVisible to false makes the types in this assembly not visible 25 | // to COM components. If you need to access a type in this assembly from 26 | // COM, set the ComVisible attribute to true on that type. 27 | [assembly: ComVisible(false)] 28 | 29 | [assembly: CLSCompliant(true)] 30 | 31 | // The following GUID is for the ID of the typelib if this project is exposed to COM 32 | [assembly: Guid("e424efba-1479-4999-b927-ab01997334db")] 33 | 34 | // Version information for an assembly consists of the following four values: 35 | // 36 | // Major Version 37 | // Minor Version 38 | // Build Number 39 | // Revision 40 | // 41 | // You can specify all the values or you can default the Build and Revision Numbers 42 | // by using the '*' as shown below: 43 | // [assembly: AssemblyVersion("1.0.*")] 44 | [assembly: AssemblyVersion("1.0.0.0")] 45 | [assembly: AssemblyFileVersion("1.0.0.0")] 46 | 47 | [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("PixieTests")] 48 | 49 | // This assembly is generated by Rhino.Mocks 50 | [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] 51 | -------------------------------------------------------------------------------- /EsentCollectionsTests/EqualityAsserts.cs: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | // 6 | // Test the Key class. 7 | // 8 | // -------------------------------------------------------------------------------------------------------------------- 9 | 10 | namespace EsentCollectionsTests 11 | { 12 | using System; 13 | using Microsoft.VisualStudio.TestTools.UnitTesting; 14 | 15 | /// 16 | /// Asserts to verify Equals() and GetHashCode() implementations. 17 | /// 18 | internal static class EqualityAsserts 19 | { 20 | /// 21 | /// Helper method to compare two objects for equality. This 22 | /// verifies Object.Equals, IEquatable.Equals and 23 | /// Object.GetHashCode. 24 | /// 25 | /// The type of the object. 26 | /// The first object. 27 | /// The second object. 28 | /// True if the object are the same. 29 | public static void TestEqualsAndHashCode(T a, T b, bool areEqual) where T : IEquatable 30 | { 31 | // IEquatable.Equals 32 | Assert.AreEqual(a.Equals(b), areEqual); 33 | Assert.AreEqual(b.Equals(a), areEqual); 34 | 35 | // Object.Equals 36 | Assert.AreEqual(a.Equals((object)b), areEqual); 37 | Assert.AreEqual(b.Equals((object)a), areEqual); 38 | 39 | // GetHashCode 40 | if (areEqual) 41 | { 42 | Assert.AreEqual(a.GetHashCode(), b.GetHashCode()); 43 | Assert.AreEqual(a, b); 44 | } 45 | else 46 | { 47 | Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode()); 48 | Assert.AreNotEqual(a, b); 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /EsentInteropTests/CompactDatabaseTests.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | #if !MANAGEDESENT_ON_WSA // Not exposed in MSDK 8 | namespace InteropApiTests 9 | { 10 | using System; 11 | using Microsoft.Isam.Esent.Interop; 12 | using Microsoft.VisualStudio.TestTools.UnitTesting; 13 | 14 | /// 15 | /// Tests for . 16 | /// 17 | [TestClass] 18 | public class CompactDatabaseTests 19 | { 20 | #region Setup/Teardown 21 | 22 | /// 23 | /// Verifies no instances are leaked. 24 | /// 25 | [TestCleanup] 26 | public void Teardown() 27 | { 28 | SetupHelper.CheckProcessForInstanceLeaks(); 29 | } 30 | 31 | #endregion 32 | 33 | /// 34 | /// Test . 35 | /// 36 | [TestMethod] 37 | [Priority(2)] 38 | [Description("Test JetCompact")] 39 | public void TestJetCompact() 40 | { 41 | var test = new DatabaseFileTestHelper(EseInteropTestHelper.PathGetRandomFileName() + "-compactdatabase", true); 42 | test.TestCompactDatabase(); 43 | } 44 | 45 | /// 46 | /// Test exception handling. 47 | /// 48 | [TestMethod] 49 | [Priority(2)] 50 | [Description("Test JetCompact exception handling")] 51 | [ExpectedException(typeof(ArgumentNullException))] 52 | public void TestJetCompactExceptionHandling() 53 | { 54 | var ex = new ArgumentNullException(); 55 | var test = new DatabaseFileTestHelper(EseInteropTestHelper.PathGetRandomFileName() + "-compactdatabase", true); 56 | test.TestCompactDatabaseCallbackExceptionHandling(ex); 57 | } 58 | } 59 | } 60 | #endif // !MANAGEDESENT_ON_WSA -------------------------------------------------------------------------------- /isamunittests/isamunittests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | $(DefineConstants);MANAGEDESENT_SUPPORTS_ANSI 7 | Library 8 | Properties 9 | IsamUnitTests 10 | IsamUnitTests 11 | net8.0;net472 12 | false 13 | false 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | $(DefineConstants);MANAGEDESENT_RHINO_MOCKS_UNAVAILABLE 23 | 24 | 25 | 26 | False 27 | ..\External Components\Rhino.Mocks\Rhino.Mocks.dll 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 49 | -------------------------------------------------------------------------------- /EsentInteropTests/MyContractResolver.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | namespace InteropApiTests 8 | { 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Linq; 12 | using System.Reflection; 13 | using Newtonsoft.Json; 14 | using Newtonsoft.Json.Converters; 15 | using Newtonsoft.Json.Serialization; 16 | 17 | /// 18 | /// Allow serialization/deserialization of all properties/fields on object using newtonsoft.json serializer. 19 | /// 20 | public class MyContractResolver : DefaultContractResolver 21 | { 22 | /// 23 | /// Mark all properties/fields as needing serialization. 24 | /// 25 | /// 26 | /// type of the object. 27 | /// 28 | /// 29 | /// List of all members to serialize 30 | /// 31 | protected override List GetSerializableMembers(Type objectType) 32 | { 33 | var flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; 34 | MemberInfo[] fields = objectType.GetFields(flags); 35 | return fields 36 | .Concat(objectType.GetProperties(flags).Where(propInfo => propInfo.CanWrite)) 37 | .ToList(); 38 | } 39 | 40 | /// 41 | /// Mark all properties/fields as needing serialization. 42 | /// 43 | /// 44 | /// type of the object. 45 | /// 46 | /// 47 | /// unused parameter. 48 | /// 49 | /// 50 | /// List of all members to serialize 51 | /// 52 | protected override IList CreateProperties(Type type, MemberSerialization memberSerialization) 53 | { 54 | return base.CreateProperties(type, MemberSerialization.Fields); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Pixie/DisposableObjectId.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. 4 | // 5 | //----------------------------------------------------------------------- 6 | 7 | using System; 8 | 9 | namespace Microsoft.Isam.Esent 10 | { 11 | /// 12 | /// A unique identifier for a disposable object. 13 | /// 14 | internal struct DisposableObjectId : IComparable 15 | { 16 | /// 17 | /// Gets or sets the value of the Id. 18 | /// 19 | public long Value { get; set; } 20 | 21 | #region IComparable Members 22 | 23 | /// 24 | /// Compare two DisposableObjectsIds. 25 | /// 26 | /// The first id. 27 | /// The second id. 28 | /// True if the first id is less than the second id. 29 | public static bool operator <(DisposableObjectId left, DisposableObjectId right) 30 | { 31 | return left.CompareTo(right) < 0; 32 | } 33 | 34 | /// 35 | /// Compare two DisposableObjectsIds. 36 | /// 37 | /// The first id. 38 | /// The second id. 39 | /// True if the first id is greater than the second id. 40 | public static bool operator >(DisposableObjectId left, DisposableObjectId right) 41 | { 42 | return left.CompareTo(right) > 0; 43 | } 44 | 45 | /// 46 | /// Compare two DisposableObjectIds. This can be used by structures 47 | /// that sort objects. 48 | /// 49 | /// The id to compare with. 50 | /// An indication of their relative values. 51 | public int CompareTo(DisposableObjectId otherId) 52 | { 53 | return this.Value.CompareTo(otherId.Value); 54 | } 55 | 56 | #endregion 57 | } 58 | } --------------------------------------------------------------------------------