示例#1
0
文件: User.cs 项目: vitorsalgado/crap
        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);
        }
示例#2
0
文件: User.cs 项目: vitorsalgado/crap
 void OnExternalAccountAdded(ExternalAccountAddedEvent @event)
 {
     var account = new Account(@event.Provider, @event.ProviderKey);
     Accounts.Add(account);
 }