Beispiel #1
0
        public void AddExternalLogin(string provider, string providerKey)
        {
            if (string.IsNullOrEmpty(provider))
                throw new ArgumentNullException("provider");

            if (string.IsNullOrEmpty(providerKey))
                throw new ArgumentNullException("providerKey");

            if (Accounts != null && Accounts.Any() && Accounts.Any(x => x.Provider.Equals(provider) && x.ProviderKey.Equals(providerKey))) {
                throw new DomainException("User already contains a login for provider {0}.", provider);
            }

            var @event = new ExternalAccountAddedEvent(provider, providerKey);
            RaiseEvent(@event);
        }
Beispiel #2
0
 void OnExternalAccountAdded(ExternalAccountAddedEvent @event)
 {
     var account = new Account(@event.Provider, @event.ProviderKey);
     Accounts.Add(account);
 }