/// <summary>
 /// Whether or not the present entity is identitical to <paramref name="other" />, in the sense that they have the same (set of) intrinsic identifiers.
 /// </summary>
 /// <param name="other">The entity to be compared to.</param>
 /// <returns>
 ///   The result of comparison.
 /// </returns>
 public bool IsEntityTheSame(MemberNotification other)
 {
     if (other == null)
     {
         return(false);
     }
     else
     {
         return(ID == other.ID);
     }
 }
 /// <summary>
 /// Merge changes inside entity <paramref name="from" /> to the entity <paramref name="to" />. Any changes in <paramref name="from" /> that is not changed in <paramref name="to" /> is updated inside <paramref name="to" />.
 /// </summary>
 /// <param name="from">The "old" entity acting as merging source.</param>
 /// <param name="to">The "new" entity which inherits changes made in <paramref name="from" />.</param>
 /// <returns>
 /// </returns>
 public static void MergeChanges(MemberNotification from, MemberNotification to)
 {
     if (to.IsPersisted)
     {
         if (from.IsReadCountModified && !to.IsReadCountModified)
         {
             to.ReadCount           = from.ReadCount;
             to.IsReadCountModified = true;
         }
         if (from.IsBoockmarkedModified && !to.IsBoockmarkedModified)
         {
             to.Boockmarked           = from.Boockmarked;
             to.IsBoockmarkedModified = true;
         }
         if (from.IsNoticeDataModified && !to.IsNoticeDataModified)
         {
             to.NoticeData           = from.NoticeData;
             to.IsNoticeDataModified = true;
         }
         if (from.IsProcessedModified && !to.IsProcessedModified)
         {
             to.Processed           = from.Processed;
             to.IsProcessedModified = true;
         }
         if (from.IsProcessedDateModified && !to.IsProcessedDateModified)
         {
             to.ProcessedDate           = from.ProcessedDate;
             to.IsProcessedDateModified = true;
         }
     }
     else
     {
         to.IsPersisted             = from.IsPersisted;
         to.ID                      = from.ID;
         to.CreatedDate             = from.CreatedDate;
         to.PriorityLevel           = from.PriorityLevel;
         to.Title                   = from.Title;
         to.NoticeMsg               = from.NoticeMsg;
         to.ReadOnce                = from.ReadOnce;
         to.ReadCount               = from.ReadCount;
         to.IsReadCountModified     = from.IsReadCountModified;
         to.Boockmarked             = from.Boockmarked;
         to.IsBoockmarkedModified   = from.IsBoockmarkedModified;
         to.NoticeData              = from.NoticeData;
         to.IsNoticeDataModified    = from.IsNoticeDataModified;
         to.Processed               = from.Processed;
         to.IsProcessedModified     = from.IsProcessedModified;
         to.ProcessedDate           = from.ProcessedDate;
         to.IsProcessedDateModified = from.IsProcessedDateModified;
         to.ApplicationID           = from.ApplicationID;
         to.TypeID                  = from.TypeID;
         to.UserID                  = from.UserID;
     }
 }
Exemple #3
0
 /// <summary>
 /// <see cref="NotificationTaskSchedule.MemberNotificationRef" /> is not initialized when the entity is created. Clients could call this method to load it provided a proper delegate <see cref="NotificationTaskSchedule.DelLoadMemberNotificationRef" /> was setup
 /// before calling it.
 /// </summary>
 public void LoadMemberNotificationRef()
 {
     if (_MemberNotificationRef != null)
     {
         return;
     }
     if (DelLoadMemberNotificationRef != null)
     {
         _MemberNotificationRef = DelLoadMemberNotificationRef();
     }
 }
 /// <summary>
 /// Whether or not the present entity is identitical to <paramref name="other" />, in the sense that they have the same (set of) primary key(s).
 /// </summary>
 /// <param name="other">The entity to be compared to.</param>
 /// <returns>
 ///   The result of comparison.
 /// </returns>
 public bool IsEntityIdentical(MemberNotification other)
 {
     if (other == null)
     {
         return(false);
     }
     if (ID != other.ID)
     {
         return(false);
     }
     return(true);
 }
        /// <summary>
        /// Update changes to the current entity compared to an input <paramref name="newdata" /> and set the entity to a proper state for updating.
        /// </summary>
        /// <param name="newdata">The "new" entity acting as the source of the changes, if any.</param>
        /// <returns>
        /// </returns>
        public void UpdateChanges(MemberNotification newdata)
        {
            int cnt = 0;

            if (ReadCount != newdata.ReadCount)
            {
                ReadCount           = newdata.ReadCount;
                IsReadCountModified = true;
                cnt++;
            }
            if (Boockmarked != newdata.Boockmarked)
            {
                Boockmarked           = newdata.Boockmarked;
                IsBoockmarkedModified = true;
                cnt++;
            }
            if (NoticeData != newdata.NoticeData)
            {
                NoticeData           = newdata.NoticeData;
                IsNoticeDataModified = true;
                cnt++;
            }
            if (Processed != newdata.Processed)
            {
                Processed           = newdata.Processed;
                IsProcessedModified = true;
                cnt++;
            }
            if (ProcessedDate != newdata.ProcessedDate)
            {
                ProcessedDate           = newdata.ProcessedDate;
                IsProcessedDateModified = true;
                cnt++;
            }
            IsEntityChanged = cnt > 0;
        }
        /// <summary>
        /// Internal use
        /// </summary>
        public MemberNotification ShallowCopy(bool allData = false, bool preserveState = false, bool checkLoadState = false)
        {
            MemberNotification e = new MemberNotification();

            e.StartAutoUpdating = false;
            e.ID            = ID;
            e.CreatedDate   = CreatedDate;
            e.PriorityLevel = PriorityLevel;
            e.Title         = Title;
            e.ReadOnce      = ReadOnce;
            e.ReadCount     = ReadCount;
            if (preserveState)
            {
                e.IsReadCountModified = IsReadCountModified;
            }
            else
            {
                e.IsReadCountModified = false;
            }
            e.Boockmarked = Boockmarked;
            if (preserveState)
            {
                e.IsBoockmarkedModified = IsBoockmarkedModified;
            }
            else
            {
                e.IsBoockmarkedModified = false;
            }
            e.Processed = Processed;
            if (preserveState)
            {
                e.IsProcessedModified = IsProcessedModified;
            }
            else
            {
                e.IsProcessedModified = false;
            }
            e.ProcessedDate = ProcessedDate;
            if (preserveState)
            {
                e.IsProcessedDateModified = IsProcessedDateModified;
            }
            else
            {
                e.IsProcessedDateModified = false;
            }
            e.ApplicationID = ApplicationID;
            e.TypeID        = TypeID;
            e.UserID        = UserID;
            if (allData)
            {
                if (!checkLoadState || IsNoticeMsgLoaded)
                {
                    e.NoticeMsg = NoticeMsg;
                }
                e.IsNoticeMsgLoaded = IsNoticeMsgLoaded;
                if (!checkLoadState || IsNoticeDataLoaded)
                {
                    e.NoticeData = NoticeData;
                }
                if (preserveState)
                {
                    e.IsNoticeDataModified = IsNoticeDataModified;
                }
                else
                {
                    e.IsNoticeDataModified = false;
                }
                e.IsNoticeDataLoaded = IsNoticeDataLoaded;
            }
            e.DistinctString = GetDistinctString(true);
            e.IsPersisted    = IsPersisted;
            if (preserveState)
            {
                e.IsEntityChanged = IsEntityChanged;
            }
            else
            {
                e.IsEntityChanged = false;
            }
            e.StartAutoUpdating = true;
            return(e);
        }
 public static async Task<ConnectionStatus> UserConnected(string noticeHubId, string hubId, string peerId, string userId, string connectId, string languages)
 {
     var mbsvc = new UserAppMemberServiceProxy();
     var cntx = Cntx;
     cntx.AcceptLanguages = languages;
     var memb = await mbsvc.LoadEntityGraphRecursAsync(cntx, AppId, userId, null, null);
     if (memb != null)
     {
         memb.StartAutoUpdating = true;
         memb.LastActivityDate = DateTime.UtcNow;
         memb.AcceptLanguages = languages;
         List<MemberCallback> callbacks;
         if (memb.ChangedMemberCallbacks == null)
             callbacks = new List<MemberCallback>();
         else
             callbacks = new List<MemberCallback>(memb.ChangedMemberCallbacks);
         var cbk = (from d in callbacks where d.HubID == hubId && d.ChannelID == peerId select d).SingleOrDefault();
         if (cbk == null)
         {
             cbk = new MemberCallback
             {
                 ApplicationID = AppId,
                 UserID = userId,
                 HubID = hubId,
                 ChannelID = peerId,
                 ConnectionID = connectId,
                 IsDisconnected = false,
                 LastActiveDate = DateTime.UtcNow
             };
         }
         else
         {
             // it is very important to turn this on, otherwise the property will not be marked as modified.
             // and the service will not save the change!
             cbk.StartAutoUpdating = true;
             cbk.ConnectionID = connectId;
             cbk.IsDisconnected = false;
             cbk.LastActiveDate = DateTime.UtcNow;
         }
         memb.ChangedMemberCallbacks = new MemberCallback[] { cbk };
         await mbsvc.AddOrUpdateEntitiesAsync(cntx, new UserAppMemberSet(), new UserAppMember[] { memb });
         UserServiceProxy usvc = new UserServiceProxy();
         var u = await usvc.LoadEntityByKeyAsync(cntx, userId);
         memb.UserRef = u;
         var peerMb = await mbsvc.LoadEntityByKeyAsync(cntx, AppId, peerId);
         ConnectionStatus status = new ConnectionStatus();
         status.me = cbk;
         MemberCallbackServiceProxy mbcsvc = new MemberCallbackServiceProxy();
         UserAssociationServiceProxy uasvc = new UserAssociationServiceProxy();
         var peerCb = await mbcsvc.LoadEntityByKeyAsync(cntx, userId, hubId, AppId, peerId);
         if (peerCb == null || peerCb.ConnectionID == null || peerCb.IsDisconnected)
         {
             UserAssociation utop = await uasvc.LoadEntityByKeyAsync(cntx, userId, peerId, ApplicationContext.ChatAssocTypeId);
             MemberNotificationTypeServiceProxy ntsvc = new MemberNotificationTypeServiceProxy();
             var ntype = await ntsvc.LoadEntityByKeyAsync(cntx, ApplicationContext.PrivateChatNoticeTypeId);
             var notifier = await mbcsvc.LoadEntityByKeyAsync(cntx, "System", noticeHubId, AppId, peerId);
             if (notifier != null && notifier.ConnectionID != null && !notifier.IsDisconnected)
             {
                 if (utop != null && utop.NoMessages != null && utop.NoMessages == true)
                 {
                     status.status = PeerStatus.InBlackList;
                 }
                 else if (utop != null && utop.DoNotNotify != null && utop.DoNotNotify == true)
                 {
                     status.status = PeerStatus.DoNotDisturb;
                 }
                 else if (utop != null && utop.NotifyButBlock != null && utop.NotifyButBlock == true)
                 {
                     status.peerNotifier = notifier;
                     status.status = PeerStatus.NotifyButBlock;
                 }
                 else
                 {
                     status.peerNotifier = notifier;
                     status.status = PeerStatus.Notifiable;
                 }
             }
             else
             {
                 if (utop == null || utop.NoMessages == null || utop.NoMessages == false)
                     status.status = PeerStatus.LeaveMessage;
             }
             MemberNotification n = new MemberNotification 
             {
                 ID = Guid.NewGuid().ToString(),
                 Title = string.Format(ResourceUtils.GetString("20dc5913998d0e9ed01360475e46a0f9", "{0} invites you to chat, is waiting ...", peerMb.AcceptLanguages), ""),
                 CreatedDate = DateTime.UtcNow,
                 PriorityLevel = 0,
                 ReadCount = 0,
                 ApplicationID = AppId,
                 TypeID = ApplicationContext.PrivateChatNoticeTypeId,
                 UserID = peerId
             };
             bool hasIcon = !string.IsNullOrEmpty(memb.IconMime);
             n.NoticeMsg = "{ \"peerId\": \"" + userId + "\", \"peer\": \"" + u.Username + "\", \"connectId\": \"" + connectId + "\", \"hasIcon\": " + (hasIcon ? "true" : "false") + ", \"msg\": \"" + n.Title + "\", \"isCancel\": false, ";
             if (utop != null && utop.NoMessages != null && utop.NoMessages == true)
                 n.NoticeMsg += "\"noMessages\": true, ";
             else
                 n.NoticeMsg += "\"noMessages\": false, ";
             if (utop != null && utop.DoNotNotify != null && utop.DoNotNotify == true)
                 n.NoticeMsg += "\"notDisturb\": true, ";
             else
                 n.NoticeMsg += "\"notDisturb\": false, ";
             if (utop != null && utop.NotifyButBlock != null && utop.NotifyButBlock == true)
                 n.NoticeMsg += "\"keepNotified\": true }";
             else
                 n.NoticeMsg += "\"keepNotified\": false }";
             n.IsNoticeDataLoaded = true;
             MemberNotificationServiceProxy nsvc = new MemberNotificationServiceProxy();
             var r = await nsvc.AddOrUpdateEntitiesAsync(cntx, new MemberNotificationSet(), new MemberNotification[] { n });
             status.noticeType = ntype.TypeName;
             status.noticeMsg = n.NoticeMsg;
             status.noticeRecId = r.ChangedEntities[0].UpdatedItem.ID;
         }
         else
         {
             DateTime dt = DateTime.UtcNow;
             UserAssociation utop = await uasvc.LoadEntityByKeyAsync(cntx, userId, peerId, ApplicationContext.ChatAssocTypeId);
             if (utop == null)
             {
                 utop = new UserAssociation
                 {
                     TypeID = ApplicationContext.ChatAssocTypeId,
                     FromUserID = userId,
                     ToUserID = peerId,
                     CreateDate = dt,
                     AssocCount = 1,
                     LastAssoc = dt,
                     InteractCount = 0,
                     Votes = 0
                 };
             }
             else
                 utop.AssocCount++;
             UserAssociation ptou = await uasvc.LoadEntityByKeyAsync(cntx, peerId, userId, ApplicationContext.ChatAssocTypeId);
             if (ptou == null)
             {
                 ptou = new UserAssociation
                 {
                     TypeID = ApplicationContext.ChatAssocTypeId,
                     FromUserID = peerId,
                     ToUserID = userId,
                     CreateDate = dt,
                     AssocCount = 1,
                     LastAssoc = dt,
                     InteractCount = 0,
                     Votes = 0
                 };
             }
             else
                 ptou.AssocCount++;
             await uasvc.AddOrUpdateEntitiesAsync(cntx, new UserAssociationSet(), new UserAssociation[] { utop, ptou });
             status.status = PeerStatus.Connected;
         }
         if (peerCb != null)
             peerCb.UserAppMemberRef = peerMb;
         status.peer = peerCb;
         return status;
     }
     return null;
 }
 /// <summary>
 /// <see cref="NotificationTaskSchedule.MemberNotificationRef" /> is not initialized when the entity is created. Clients could call this method to load it provided a proper delegate <see cref="NotificationTaskSchedule.DelLoadMemberNotificationRef" /> was setup
 /// before calling it.
 /// </summary>
 public void LoadMemberNotificationRef()
 {
     if (_MemberNotificationRef != null)
         return;
     if (DelLoadMemberNotificationRef != null)
         _MemberNotificationRef = DelLoadMemberNotificationRef();
 }
 public static async Task<ConnectionStatus> UserCancelInteraction(string noticeHubId, string hubId, string peerId, string userId, string connectId, string languages)
 {
     var cntx = Cntx;
     MemberCallbackServiceProxy mbcsvc = new MemberCallbackServiceProxy();
     ConnectionStatus status = new ConnectionStatus();
     var notifier = await mbcsvc.LoadEntityByKeyAsync(cntx, "System", noticeHubId, AppId, peerId);
     if (notifier != null && notifier.ConnectionID != null && !notifier.IsDisconnected)
     {
         status.peerNotifier = notifier;
         status.status = PeerStatus.Notifiable;
     }
     UserServiceProxy usvc = new UserServiceProxy();
     var u = await usvc.LoadEntityByKeyAsync(cntx, userId);
     var mbsvc = new UserAppMemberServiceProxy();
     var peerMb = await mbsvc.LoadEntityByKeyAsync(cntx, AppId, peerId);
     MemberNotificationTypeServiceProxy ntsvc = new MemberNotificationTypeServiceProxy();
     var ntype = await ntsvc.LoadEntityByKeyAsync(cntx, 3);
     var peerCb = await mbcsvc.LoadEntityByKeyAsync(cntx, userId, hubId, AppId, peerId);
     string title = string.Format(ResourceUtils.GetString("cdc8520b5121c757e6eb79e098d6baef", "{0} cancelled chatting invitation.", peerMb.AcceptLanguages), u.Username);
     if (peerCb == null || peerCb.ConnectionID == null || peerCb.IsDisconnected)
     {
         MemberNotification n = new MemberNotification
         {
             ID = Guid.NewGuid().ToString(),
             Title = title,
             CreatedDate = DateTime.UtcNow,
             PriorityLevel = 0,
             ReadCount = 0,
             ApplicationID = AppId,
             TypeID = 3,
             UserID = peerId
         };
         n.NoticeMsg = "{ \"peerId\": \"" + userId + "\", \"peer\": \"" + u.Username + "\", \"connectId\": \"" + connectId + "\", \"msg\": \"" + title + "\", \"isCancel\": true, \"isDisconnect\": false }";
         n.IsNoticeDataLoaded = true;
         MemberNotificationServiceProxy nsvc = new MemberNotificationServiceProxy();
         var r = await nsvc.AddOrUpdateEntitiesAsync(cntx, new MemberNotificationSet(), new MemberNotification[] { n });
         status.noticeType = ntype.TypeName;
         status.noticeMsg = "{ \"peerId\": \"" + userId + "\", \"peer\": \"" + u.Username + "\", \"connectId\": \"" + connectId + "\", \"msg\": \"" + title + "\", \"isCancel\": true, \"isDisconnect\": false }";
         status.noticeRecId = r.ChangedEntities[0].UpdatedItem.ID;
     }
     else
     {
         status.noticeMsg = "{ \"peerId\": \"" + userId + "\", \"peer\": \"" + u.Username + "\", \"connectId\": \"" + connectId + "\", \"msg\": \"" + title + "\", \"isCancel\": true, \"isDisconnect\": true }";
     }
     status.peer = peerCb;
     return status;
 }
 /// <summary>
 /// Merge changes inside entity <paramref name="from" /> to the entity <paramref name="to" />. Any changes in <paramref name="from" /> that is not changed in <paramref name="to" /> is updated inside <paramref name="to" />.
 /// </summary>
 /// <param name="from">The "old" entity acting as merging source.</param>
 /// <param name="to">The "new" entity which inherits changes made in <paramref name="from" />.</param>
 /// <returns>
 /// </returns>
 public static void MergeChanges(MemberNotification from, MemberNotification to)
 {
     if (to.IsPersisted)
     {
         if (from.IsReadCountModified && !to.IsReadCountModified)
         {
             to.ReadCount = from.ReadCount;
             to.IsReadCountModified = true;
         }
         if (from.IsBoockmarkedModified && !to.IsBoockmarkedModified)
         {
             to.Boockmarked = from.Boockmarked;
             to.IsBoockmarkedModified = true;
         }
         if (from.IsNoticeDataModified && !to.IsNoticeDataModified)
         {
             to.NoticeData = from.NoticeData;
             to.IsNoticeDataModified = true;
         }
         if (from.IsProcessedModified && !to.IsProcessedModified)
         {
             to.Processed = from.Processed;
             to.IsProcessedModified = true;
         }
         if (from.IsProcessedDateModified && !to.IsProcessedDateModified)
         {
             to.ProcessedDate = from.ProcessedDate;
             to.IsProcessedDateModified = true;
         }
     }
     else
     {
         to.IsPersisted = from.IsPersisted;
         to.ID = from.ID;
         to.CreatedDate = from.CreatedDate;
         to.PriorityLevel = from.PriorityLevel;
         to.Title = from.Title;
         to.NoticeMsg = from.NoticeMsg;
         to.ReadOnce = from.ReadOnce;
         to.ReadCount = from.ReadCount;
         to.IsReadCountModified = from.IsReadCountModified;
         to.Boockmarked = from.Boockmarked;
         to.IsBoockmarkedModified = from.IsBoockmarkedModified;
         to.NoticeData = from.NoticeData;
         to.IsNoticeDataModified = from.IsNoticeDataModified;
         to.Processed = from.Processed;
         to.IsProcessedModified = from.IsProcessedModified;
         to.ProcessedDate = from.ProcessedDate;
         to.IsProcessedDateModified = from.IsProcessedDateModified;
         to.ApplicationID = from.ApplicationID;
         to.TypeID = from.TypeID;
         to.UserID = from.UserID;
     }
 }
 /// <summary>
 /// Whether or not the present entity is identitical to <paramref name="other" />, in the sense that they have the same (set of) intrinsic identifiers.
 /// </summary>
 /// <param name="other">The entity to be compared to.</param>
 /// <returns>
 ///   The result of comparison.
 /// </returns>
 public bool IsEntityTheSame(MemberNotification other)
 {
     if (other == null)
         return false;
     else
         return ID == other.ID;
 }              
 /// <summary>
 /// Whether or not the present entity is identitical to <paramref name="other" />, in the sense that they have the same (set of) primary key(s).
 /// </summary>
 /// <param name="other">The entity to be compared to.</param>
 /// <returns>
 ///   The result of comparison.
 /// </returns>
 public bool IsEntityIdentical(MemberNotification other)
 {
     if (other == null)
         return false;
     if (ID != other.ID)
         return false;
     return true;
 }              
 /// <summary>
 /// Internal use
 /// </summary>
 public MemberNotification ShallowCopy(bool allData = false, bool preserveState = false, bool checkLoadState = false)
 {
     MemberNotification e = new MemberNotification();
     e.StartAutoUpdating = false;
     e.ID = ID;
     e.CreatedDate = CreatedDate;
     e.PriorityLevel = PriorityLevel;
     e.Title = Title;
     e.ReadOnce = ReadOnce;
     e.ReadCount = ReadCount;
     if (preserveState)
         e.IsReadCountModified = IsReadCountModified;
     else
         e.IsReadCountModified = false;
     e.Boockmarked = Boockmarked;
     if (preserveState)
         e.IsBoockmarkedModified = IsBoockmarkedModified;
     else
         e.IsBoockmarkedModified = false;
     e.Processed = Processed;
     if (preserveState)
         e.IsProcessedModified = IsProcessedModified;
     else
         e.IsProcessedModified = false;
     e.ProcessedDate = ProcessedDate;
     if (preserveState)
         e.IsProcessedDateModified = IsProcessedDateModified;
     else
         e.IsProcessedDateModified = false;
     e.ApplicationID = ApplicationID;
     e.TypeID = TypeID;
     e.UserID = UserID;
     if (allData)
     {
         if (!checkLoadState || IsNoticeMsgLoaded)
             e.NoticeMsg = NoticeMsg;
         e.IsNoticeMsgLoaded = IsNoticeMsgLoaded;
         if (!checkLoadState || IsNoticeDataLoaded)
             e.NoticeData = NoticeData;
         if (preserveState)
             e.IsNoticeDataModified = IsNoticeDataModified;
         else
             e.IsNoticeDataModified = false;
         e.IsNoticeDataLoaded = IsNoticeDataLoaded;
     }
     e.DistinctString = GetDistinctString(true);
     e.IsPersisted = IsPersisted;
     if (preserveState)
         e.IsEntityChanged = IsEntityChanged;
     else
         e.IsEntityChanged = false;
     e.StartAutoUpdating = true;
     return e;
 }
 /// <summary>
 /// Update changes to the current entity compared to an input <paramref name="newdata" /> and set the entity to a proper state for updating.
 /// </summary>
 /// <param name="newdata">The "new" entity acting as the source of the changes, if any.</param>
 /// <returns>
 /// </returns>
 public void UpdateChanges(MemberNotification newdata)
 {
     int cnt = 0;
     if (ReadCount != newdata.ReadCount)
     {
         ReadCount = newdata.ReadCount;
         IsReadCountModified = true;
         cnt++;
     }
     if (Boockmarked != newdata.Boockmarked)
     {
         Boockmarked = newdata.Boockmarked;
         IsBoockmarkedModified = true;
         cnt++;
     }
     if (NoticeData != newdata.NoticeData)
     {
         NoticeData = newdata.NoticeData;
         IsNoticeDataModified = true;
         cnt++;
     }
     if (Processed != newdata.Processed)
     {
         Processed = newdata.Processed;
         IsProcessedModified = true;
         cnt++;
     }
     if (ProcessedDate != newdata.ProcessedDate)
     {
         ProcessedDate = newdata.ProcessedDate;
         IsProcessedDateModified = true;
         cnt++;
     }
     IsEntityChanged = cnt > 0;
 }