コード例 #1
0
 public static long GenerateSequence(string sequenceName)
 {
     using (var objectSpace = ApplicationHelper.Instance.Application.CreateObjectSpace()){
         long seq = 0;
         GenerateSequence(objectSpace.Session(), sequenceName, l => seq = l);
         Instance.Accept();
         return(seq);
     }
 }
コード例 #2
0
        public static void SetNextSequence(ITypeInfo typeInfo, string prefix, long nextId)
        {
            var objectByKey = Instance._explicitUnitOfWork.FindObject(_sequenceObjectType, GetCriteria(prefix + typeInfo.FullName), true);

            Instance._sequence = objectByKey != null ? (ISequenceObject)objectByKey : CreateSequenceObject(prefix + typeInfo.FullName, Instance._explicitUnitOfWork);
            Instance._sequence.NextSequence = nextId;
            Instance._explicitUnitOfWork.FlushChanges();
            Instance.Accept();
        }
コード例 #3
0
 private static void SessionOnAfterCommitTransaction(object sender, SessionManipulationEventArgs e)
 {
     ((Session)sender).AfterCommitTransaction -= SessionOnAfterCommitTransaction;
     Instance.Accept();
 }