/// <summary>
        /// Internal use
        /// </summary>
        public EventLocation ShallowCopy(bool allData = false, bool preserveState = false, bool checkLoadState = false)
        {
            EventLocation e = new EventLocation();

            e.StartAutoUpdating = false;
            e.EventID           = EventID;
            e.ClassName_        = ClassName_;
            e.MethodName_       = MethodName_;
            e.FileName_         = FileName_;
            e.LineNumber        = LineNumber;
            if (allData)
            {
                if (!checkLoadState || IsFullInfoLoaded)
                {
                    e.FullInfo = FullInfo;
                }
                e.IsFullInfoLoaded = IsFullInfoLoaded;
            }
            e.DistinctString = GetDistinctString(true);
            e.IsPersisted    = IsPersisted;
            if (preserveState)
            {
                e.IsEntityChanged = IsEntityChanged;
            }
            else
            {
                e.IsEntityChanged = false;
            }
            e.StartAutoUpdating = true;
            return(e);
        }
 /// <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(EventLocation other)
 {
     if (other == null)
     {
         return(false);
     }
     else
     {
         return(EventID == other.EventID);
     }
 }
Exemple #3
0
 /// <summary>
 /// <see cref="EventStackFrame.EventLocationRef" /> is not initialized when the entity is created. Clients could call this method to load it provided a proper delegate <see cref="EventStackFrame.DelLoadEventLocationRef" /> was setup
 /// before calling it.
 /// </summary>
 public void LoadEventLocationRef()
 {
     if (_EventLocationRef != null)
     {
         return;
     }
     if (DelLoadEventLocationRef != null)
     {
         _EventLocationRef = DelLoadEventLocationRef();
     }
 }
 /// <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(EventLocation other)
 {
     if (other == null)
     {
         return(false);
     }
     if (EventID != other.EventID)
     {
         return(false);
     }
     return(true);
 }
 /// <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(EventLocation from, EventLocation to)
 {
     if (to.IsPersisted)
     {
     }
     else
     {
         to.IsPersisted = from.IsPersisted;
         to.EventID     = from.EventID;
         to.ClassName_  = from.ClassName_;
         to.MethodName_ = from.MethodName_;
         to.FileName_   = from.FileName_;
         to.FullInfo    = from.FullInfo;
         to.LineNumber  = from.LineNumber;
     }
 }
 /// <summary>
 /// Internal use
 /// </summary>
 public EventLocation ShallowCopy(bool allData = false, bool preserveState = false, bool checkLoadState = false)
 {
     EventLocation e = new EventLocation();
     e.StartAutoUpdating = false;
     e.EventID = EventID;
     e.ClassName_ = ClassName_;
     e.MethodName_ = MethodName_;
     e.FileName_ = FileName_;
     e.LineNumber = LineNumber;
     if (allData)
     {
         if (!checkLoadState || IsFullInfoLoaded)
             e.FullInfo = FullInfo;
         e.IsFullInfoLoaded = IsFullInfoLoaded;
     }
     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(EventLocation newdata)
 {
     int cnt = 0;
     IsEntityChanged = cnt > 0;
 }
 /// <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(EventLocation from, EventLocation to)
 {
     if (to.IsPersisted)
     {
     }
     else
     {
         to.IsPersisted = from.IsPersisted;
         to.EventID = from.EventID;
         to.ClassName_ = from.ClassName_;
         to.MethodName_ = from.MethodName_;
         to.FileName_ = from.FileName_;
         to.FullInfo = from.FullInfo;
         to.LineNumber = from.LineNumber;
     }
 }
 /// <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(EventLocation other)
 {
     if (other == null)
         return false;
     else
         return EventID == other.EventID;
 }              
 /// <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(EventLocation other)
 {
     if (other == null)
         return false;
     if (EventID != other.EventID)
         return false;
     return true;
 }              
 /// <summary>
 /// <see cref="EventStackFrame.EventLocationRef" /> is not initialized when the entity is created. Clients could call this method to load it provided a proper delegate <see cref="EventStackFrame.DelLoadEventLocationRef" /> was setup
 /// before calling it.
 /// </summary>
 public void LoadEventLocationRef()
 {
     if (_EventLocationRef != null)
         return;
     if (DelLoadEventLocationRef != null)
         _EventLocationRef = DelLoadEventLocationRef();
 }
 private static EventLocation getLocation(string id, LocationInfo loc)
 {
     EventLocation eloc = new EventLocation();
     eloc.EventID = id;
     eloc.ClassName_ = loc.ClassName;
     // 220 is the current FileName_ size.
     eloc.FileName_ = loc.FileName != null && loc.FileName.Length > 220 ? "..." + loc.FileName.Substring(loc.FileName.Length - 220 - 3) : loc.FileName;
     eloc.MethodName_ = loc.MethodName;
     eloc.LineNumber = loc.LineNumber;
     if (loc.StackFrames != null && loc.StackFrames.Length > 0)
     {
         List<EventStackFrame> frames = new List<EventStackFrame>();
         int frmId = 1;
         foreach (var frm in loc.StackFrames)
         {
             if (_maxStackFramesUp >= 0 && frmId > _maxStackFramesUp)
                 break;
             else if (_userStackFramesOnly && string.IsNullOrEmpty(frm.FileName))
                 continue;
             EventStackFrame efrm = new EventStackFrame();
             efrm.EventID = id;
             efrm.ID = frmId++;
             efrm.ClassName_ = frm.ClassName;
             // 220 is the current FileName_ size.
             efrm.FileName_ = frm.FileName != null && frm.FileName.Length > 220 ? "..." + frm.FileName.Substring(frm.FileName.Length - 220 - 3) : frm.FileName;
             efrm.LineNumber = frm.LineNumber;
             string callinfo = frm.Method.Name + "(";
             foreach (var p in frm.Method.Parameters)
                 callinfo += p + ", ";
             callinfo = callinfo.TrimEnd(", ".ToCharArray()) + ")";
             efrm.MethodInfo = callinfo;
             frames.Add(efrm);
         }
         eloc.ChangedEventStackFrames = frames.ToArray();
     }
     return eloc;
 }
        /// <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(EventLocation newdata)
        {
            int cnt = 0;

            IsEntityChanged = cnt > 0;
        }