Esempio n. 1
0
        /// <summary>
        /// Internal use
        /// </summary>
        public EventStackFrame ShallowCopy(bool allData = false, bool preserveState = false, bool checkLoadState = false)
        {
            EventStackFrame e = new EventStackFrame();

            e.StartAutoUpdating = false;
            e.ID         = ID;
            e.EventID    = EventID;
            e.ClassName_ = ClassName_;
            e.MethodInfo = MethodInfo;
            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);
        }
Esempio n. 2
0
 /// <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(EventStackFrame other)
 {
     if (other == null)
     {
         return(false);
     }
     else
     {
         return(ID == other.ID && EventID == other.EventID);
     }
 }
Esempio n. 3
0
 /// <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(EventStackFrame other)
 {
     if (other == null)
     {
         return(false);
     }
     if (ID != other.ID)
     {
         return(false);
     }
     if (EventID != other.EventID)
     {
         return(false);
     }
     return(true);
 }
Esempio n. 4
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(EventStackFrame from, EventStackFrame to)
 {
     if (to.IsPersisted)
     {
     }
     else
     {
         to.IsPersisted = from.IsPersisted;
         to.ID          = from.ID;
         to.EventID     = from.EventID;
         to.ClassName_  = from.ClassName_;
         to.MethodInfo  = from.MethodInfo;
         to.FileName_   = from.FileName_;
         to.FullInfo    = from.FullInfo;
         to.LineNumber  = from.LineNumber;
     }
 }
 /// <summary>
 /// Internal use
 /// </summary>
 public EventStackFrame ShallowCopy(bool allData = false, bool preserveState = false, bool checkLoadState = false)
 {
     EventStackFrame e = new EventStackFrame();
     e.StartAutoUpdating = false;
     e.ID = ID;
     e.EventID = EventID;
     e.ClassName_ = ClassName_;
     e.MethodInfo = MethodInfo;
     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(EventStackFrame 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(EventStackFrame from, EventStackFrame to)
 {
     if (to.IsPersisted)
     {
     }
     else
     {
         to.IsPersisted = from.IsPersisted;
         to.ID = from.ID;
         to.EventID = from.EventID;
         to.ClassName_ = from.ClassName_;
         to.MethodInfo = from.MethodInfo;
         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(EventStackFrame other)
 {
     if (other == null)
         return false;
     else
         return ID == other.ID &&  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(EventStackFrame other)
 {
     if (other == null)
         return false;
     if (ID != other.ID)
         return false;
     if (EventID != other.EventID)
         return false;
     return true;
 }              
 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;
 }
Esempio n. 11
0
        /// <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(EventStackFrame newdata)
        {
            int cnt = 0;

            IsEntityChanged = cnt > 0;
        }