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); }
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(); }
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(); } }
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); }