Datei: IntegrationTests/PureBusinessClasses/RowVersionClass.cs
Last Commit (123a4dc)
| 1 | -- File didn't exist -- |
New Commit (16046d5)
| 1 | using System; |
| 2 | using System.Linq; |
| 3 | using System.Collections.Generic; |
| 4 | using NDO; |
| 5 | using NDO.Mapping.Attributes; |
| 6 | using NDO.Linq; |
| 7 | |
| 8 | namespace TimeStampTestClasses |
| 9 | { |
| 10 | ····/// <summary> |
| 11 | ····/// Summary for RowVersionClass |
| 12 | ····/// </summary> |
| 13 | ····[NDOPersistent] |
| 14 | ····public partial class RowVersionClass |
| 15 | ····{ |
| 16 | ········[Column( DbType = "rowversion" )] |
| 17 | ········[NDOReadOnly] |
| 18 | ········byte[] rowVersion = null; |
| 19 | ········string myData; |
| 20 | |
| 21 | ········public RowVersionClass() |
| 22 | ········{ |
| 23 | ········} |
| 24 | |
| 25 | ········public ulong RowVersion => this.rowVersion == null ? 0L : BitConverter.ToUInt64( this.rowVersion.Reverse().ToArray(), 0 );········ |
| 26 | |
| 27 | ········class SqlServerFunctions |
| 28 | ········{ |
| 29 | ············[ServerFunction( "MIN_ACTIVE_ROWVERSION" )] |
| 30 | ············public static byte[] MinActiveRowversion() |
| 31 | ············{ |
| 32 | ················return null; |
| 33 | ············} |
| 34 | ········} |
| 35 | |
| 36 | ········public static IEnumerable<RowVersionClass> GetNewerThan( PersistenceManager pm, ulong version ) |
| 37 | ········{ |
| 38 | ············byte[] versionBytes = BitConverter.GetBytes( version ).Reverse().ToArray(); |
| 39 | |
| 40 | ············return pm.Objects<RowVersionClass>().Where( |
| 41 | ················u => u.rowVersion.GreaterThan( versionBytes ) |
| 42 | ················&& u.rowVersion.LowerThan( SqlServerFunctions.MinActiveRowversion() ) |
| 43 | ············).ResultTable; |
| 44 | ········} |
| 45 | |
| 46 | ········public string MyData |
| 47 | ········{ |
| 48 | ············get { return this.myData; } |
| 49 | ············set { this.myData = value; } |
| 50 | ········} |
| 51 | ····} |
| 52 | } |
| 53 |