Пример #1
0
        protected Subscription(ICRUDSubscriptionStoreImplementation store, string name, Query query, Mailbox mailbox, object correlate) : base(store)
        {
            if (store == null ||
                query == null ||
                mailbox == null)
            {
                throw new CRUDException(StringConsts.ARGUMENT_ERROR + GetType().FullName + ".ctor(args...null)");
            }

            if (mailbox.Store != store)
            {
                throw new CRUDException(StringConsts.ARGUMENT_ERROR + GetType().FullName + ".ctor(mailbox.Store!=this.Store)");
            }

            m_Store   = store;
            m_Name    = name.IsNullOrWhiteSpace() ? Guid.NewGuid().ToString() : name;
            m_Query   = query;
            m_Mailbox = mailbox;
            Correlate = correlate;

            var          reg = m_Store.Subscriptions as Registry <Subscription>;
            Subscription existing;

            if (!reg.RegisterOrReplace(this, out existing))
            {
                existing.Dispose();
            }

            ((Registry <Subscription>)mailbox.Subscriptions).Register(this);
        }
Пример #2
0
  protected internal Mailbox(ICRUDSubscriptionStoreImplementation store, string name) : base(store)
  {
    m_Store = store;
    m_Name = name.IsNullOrWhiteSpace() ? Guid.NewGuid().ToString() : name;
 
    var reg = m_Store.Mailboxes as Registry<Mailbox>;
    Mailbox existing;
    if (!reg.RegisterOrReplace(this, out existing))
     existing.Dispose();
  }
Пример #3
0
        protected internal Mailbox(ICRUDSubscriptionStoreImplementation store, string name) : base(store)
        {
            m_Store = store;
            m_Name  = name.IsNullOrWhiteSpace() ? Guid.NewGuid().ToString() : name;

            var reg = m_Store.Mailboxes as Registry <Mailbox>;

            if (!reg.RegisterOrReplace(this, out Mailbox existing))
            {
                existing.Dispose();
            }
        }
Пример #4
0
    protected Subscription(ICRUDSubscriptionStoreImplementation store, string name, Query query, Mailbox mailbox) : base(store)
    {
      if (store==null ||
          query==null||
          mailbox==null) 
        throw new CRUDException(StringConsts.ARGUMENT_ERROR+GetType().FullName+".ctor(args...null)");

      if (mailbox.Store!=store)
        throw new CRUDException(StringConsts.ARGUMENT_ERROR+GetType().FullName+".ctor(mailbox.Store!=this.Store)");

      m_Store = store;
      m_Name = name.IsNullOrWhiteSpace() ? Guid.NewGuid().ToString() : name;
      m_Query = query;
      m_Mailbox = mailbox;

      var reg = m_Store.Subscriptions as Registry<Subscription>;
      Subscription existing;
      if (!reg.RegisterOrReplace(this, out existing))
       existing.Dispose();

      ((Registry<Subscription>)mailbox.Subscriptions).Register(this);
    }