public UniqueRaise(RaiseType raiseType, ClassDefineMetadata metadata, object entity, bool autoDisposed)
        {
            key       = String.Format("{0}:{1}:{2}", metadata.EntityType.FullName, EntityUtil.GetId(entity), raiseType);
            NotRaised = !WorkbenchUtil <string, bool> .GetValue(UniqueRaiseKey, key);

            if (NotRaised)
            {
                WorkbenchUtil <string, bool> .SetValue(UniqueRaiseKey, key, true);
            }

            AutoDisposed = autoDisposed;
        }
Esempio n. 2
0
 public FontStyle(FontStyle style)
 {
     this.FontName    = style.FontName;
     this.FontSize    = style.FontSize;
     this.FontColor   = style.FontColor;
     this.IsBold      = false;
     this.IsItalic    = false;
     this.IsUnderLine = false;
     this.Align       = Alignment.Default;
     this.BgColor     = style.BgColor;
     this.Link        = "";
     this.Raise       = RaiseType.Normal;
 }
Esempio n. 3
0
 public FontStyle(string fontName, uint fontSize, Color fontColor, bool underline, bool italic, bool bold, Alignment align, Color bgColor)
 {
     this.FontName    = fontName;
     this.FontSize    = fontSize;
     this.FontColor   = fontColor;
     this.IsUnderLine = underline;
     this.IsItalic    = italic;
     this.IsBold      = bold;
     this.Align       = align;
     this.BgColor     = bgColor;
     this.Link        = "";
     this.Raise       = RaiseType.Normal;
 }
        internal static object Raise(object entity, RaiseType raiseType, UniqueRaise ur = null)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            var metadata = GetDefineMetadata(entity.GetType());

            if (metadata == null)
            {
                throw new PlatformException("无法获取对象的定义 {0}", entity.GetType().FullName);
            }

            var interceptors = RepositoryFramework.GetInterceptors(metadata.EntityType);

            if (ur == null)
            {
                ur = new UniqueRaise(raiseType, metadata, entity, true);
            }

            if (ur.NotRaised)
            {
                foreach (var interceptor in interceptors)
                {
                    switch (raiseType)
                    {
                    case RaiseType.PreCreate:
                        interceptor.PreCreate(entity);
                        break;

                    case RaiseType.PreUpdate:
                        interceptor.PreUpdate(entity);
                        break;

                    case RaiseType.PreDelete:
                        interceptor.PreDelete(entity);
                        break;

                    case RaiseType.PostCreate:
                        interceptor.PostCreate(entity);
                        break;

                    case RaiseType.PostUpdate:
                        interceptor.PostUpdate(entity);
                        break;

                    case RaiseType.PostDelete:
                        interceptor.PostDelete(entity);
                        break;

                    case RaiseType.PostLoad:
                        interceptor.PostLoad(entity);
                        break;
                    }
                }
            }

            if (ur.NotRaised && ur.AutoDisposed)
            {
                ur.Dispose();
            }

            return(entity);
        }