示例#1
0
 private async Task <int> SaveMsgIntoDatabaseAsync(RegisteredUserEvent msg)
 {
     using (var scope = _serviceScopeFactory.CreateScope())
     {
         var ctx = scope.ServiceProvider.GetService <UserContext>();
         ctx.Users.Add(msg.User);
         return(await ctx.SaveChangesAsync());
     }
 }
示例#2
0
 void Apply(RegisteredUserEvent @event)
 {
     Id          = @event.Id;
     Name        = @event.Name;
     Surname     = @event.Surname;
     Email       = @event.Email;
     UserName    = @event.UserName;
     IsActivated = false;
 }
        private async Task <int> SaveMsgIntoElasticAsync(RegisteredUserEvent arg)
        {
            var res = await _esClientProvider.Client.IndexAsync(arg.User);

            if (!res.IsValid)
            {
                throw new InvalidOperationException(res.DebugInformation);
            }
            return(Convert.ToInt32(res.Id));
        }