예제 #1
0
        public static bool SetOffSet(string hubName, string partitionId, DateTime offset)
        {
            try
            {
                EventHub eh = GDPRDatabase.EventHubs.Find(hubName, partitionId);

                if (eh == null)
                {
                    eh = new EventHub();
                    eh.EventHubName = hubName;
                    eh.PartitionId  = partitionId;
                    eh.ModifyDate   = DateTime.Now;
                    eh.CreateDate   = DateTime.Now;
                    GDPRDatabase.Entry(eh).State = System.Data.Entity.EntityState.Added;
                }
                else
                {
                    GDPRDatabase.Entry(eh).State = System.Data.Entity.EntityState.Modified;
                }

                eh.CheckPoint = offset;
                GDPRDatabase.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
            }

            return(false);
        }
예제 #2
0
        public static DateTime GetOffset(string hubName, string partitionId)
        {
            EventHub eh = GDPRDatabase.EventHubs.Find(hubName, partitionId);

            if (eh == null)
            {
                SetOffSet(hubName, partitionId, DateTime.MinValue);
                return(DateTime.MinValue);
            }

            return(eh.CheckPoint);
        }