Merge pull request #6 from abpframework/master

Merging master
pull/781/head
Marcelo Mohr Maciel 7 years ago committed by GitHub
commit 04ff89a9f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -13,10 +13,10 @@ namespace Volo.Abp.Domain.Entities
IHasExtraProperties, IHasExtraProperties,
IHasConcurrencyStamp IHasConcurrencyStamp
{ {
public Dictionary<string, object> ExtraProperties { get; protected set; } public virtual Dictionary<string, object> ExtraProperties { get; protected set; }
[DisableAuditing] [DisableAuditing]
public string ConcurrencyStamp { get; set; } public virtual string ConcurrencyStamp { get; set; }
private readonly ICollection<object> _localEvents = new Collection<object>(); private readonly ICollection<object> _localEvents = new Collection<object>();
private readonly ICollection<object> _distributedEvents = new Collection<object>(); private readonly ICollection<object> _distributedEvents = new Collection<object>();
@ -65,10 +65,10 @@ namespace Volo.Abp.Domain.Entities
IHasExtraProperties, IHasExtraProperties,
IHasConcurrencyStamp IHasConcurrencyStamp
{ {
public Dictionary<string, object> ExtraProperties { get; protected set; } public virtual Dictionary<string, object> ExtraProperties { get; protected set; }
[DisableAuditing] [DisableAuditing]
public string ConcurrencyStamp { get; set; } public virtual string ConcurrencyStamp { get; set; }
private readonly ICollection<object> _localEvents = new Collection<object>(); private readonly ICollection<object> _localEvents = new Collection<object>();
private readonly ICollection<object> _distributedEvents = new Collection<object>(); private readonly ICollection<object> _distributedEvents = new Collection<object>();

@ -1,12 +1,10 @@
using System; using System;
using System.Collections.Generic;
using Volo.Abp.Data;
using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities;
using Volo.Abp.Users; using Volo.Abp.Users;
namespace Volo.Blogging.Users namespace Volo.Blogging.Users
{ {
public class BlogUser : AggregateRoot<Guid>, IUser, IHasExtraProperties public class BlogUser : AggregateRoot<Guid>, IUser
{ {
public virtual Guid? TenantId { get; protected set; } public virtual Guid? TenantId { get; protected set; }
@ -24,16 +22,14 @@ namespace Volo.Blogging.Users
public virtual bool PhoneNumberConfirmed { get; protected set; } public virtual bool PhoneNumberConfirmed { get; protected set; }
public virtual Dictionary<string, object> ExtraProperties { get; protected set; }
protected BlogUser() protected BlogUser()
{ {
ExtraProperties = new Dictionary<string, object>();
} }
public BlogUser(IUserData user) public BlogUser(IUserData user)
: base(user.Id)
{ {
Id = user.Id;
Email = user.Email; Email = user.Email;
Name = user.Name; Name = user.Name;
Surname = user.Surname; Surname = user.Surname;
@ -42,8 +38,17 @@ namespace Volo.Blogging.Users
PhoneNumberConfirmed = user.PhoneNumberConfirmed; PhoneNumberConfirmed = user.PhoneNumberConfirmed;
UserName = user.UserName; UserName = user.UserName;
TenantId = user.TenantId; TenantId = user.TenantId;
}
ExtraProperties = new Dictionary<string, object>(); public void Update(IUserData user)
{
Email = user.Email;
Name = user.Name;
Surname = user.Surname;
EmailConfirmed = user.EmailConfirmed;
PhoneNumber = user.PhoneNumber;
PhoneNumberConfirmed = user.PhoneNumberConfirmed;
UserName = user.UserName;
} }
} }
} }

@ -0,0 +1,39 @@
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.Users;
namespace Volo.Blogging.Users
{
public class BlogUserSynchronizer :
IDistributedEventHandler<EntityUpdatedEto<UserEto>>,
ITransientDependency
{
protected IBlogUserRepository UserRepository { get; }
protected IBlogUserLookupService UserLookupService { get; }
public BlogUserSynchronizer(IBlogUserRepository userRepository, IBlogUserLookupService userLookupService)
{
UserRepository = userRepository;
UserLookupService = userLookupService;
}
public async Task HandleEventAsync(EntityUpdatedEto<UserEto> eventData)
{
var user = await UserRepository.FindAsync(eventData.Entity.Id);
if (user == null)
{
//TODO: Why needed (ask to @ebicoglu)?
user = await UserLookupService.FindByIdAsync(eventData.Entity.Id);
if (user == null)
{
return;
}
}
user.Update(eventData.Entity);
await UserRepository.UpdateAsync(user);
}
}
}

@ -29,7 +29,7 @@ namespace Volo.Blogging
} }
[HttpGet] [HttpGet]
[Route("read/{id}")] [Route("read")]
public Task<PostWithDetailsDto> GetForReadingAsync(GetPostInput input) public Task<PostWithDetailsDto> GetForReadingAsync(GetPostInput input)
{ {
return _postAppService.GetForReadingAsync(input); return _postAppService.GetForReadingAsync(input);

@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection; using Acme.BookStore.Permissions;
using Acme.BookStore.Permissions;
using Volo.Abp.Authorization.Permissions; using Volo.Abp.Authorization.Permissions;
using Volo.Abp.AutoMapper; using Volo.Abp.AutoMapper;
using Volo.Abp.Identity; using Volo.Abp.Identity;
@ -25,8 +24,6 @@ namespace Acme.BookStore
{ {
options.AddProfile<BookStoreApplicationAutoMapperProfile>(); options.AddProfile<BookStoreApplicationAutoMapperProfile>();
}); });
context.Services.AddAssemblyOf<BookStoreApplicationModule>();
} }
} }
} }

@ -35,8 +35,6 @@ namespace Acme.BookStore
{ {
options.DefinitionProviders.Add<BookStoreSettingDefinitionProvider>(); options.DefinitionProviders.Add<BookStoreSettingDefinitionProvider>();
}); });
context.Services.AddAssemblyOf<BookStoreDomainModule>();
} }
} }
} }

@ -21,8 +21,6 @@ namespace Acme.BookStore.EntityFrameworkCore
{ {
options.AddDefaultRepositories(); options.AddDefaultRepositories();
}); });
context.Services.AddAssemblyOf<BookStoreEntityFrameworkCoreModule>();
} }
} }
} }

@ -64,8 +64,6 @@ namespace Acme.BookStore
ConfigureNavigationServices(); ConfigureNavigationServices();
ConfigureAutoApiControllers(); ConfigureAutoApiControllers();
ConfigureSwaggerServices(context.Services); ConfigureSwaggerServices(context.Services);
context.Services.AddAssemblyOf<BookStoreWebModule>();
} }
private void ConfigureDatabaseServices() private void ConfigureDatabaseServices()

@ -26,8 +26,6 @@ namespace Acme.BookStore
context.Services.AddAlwaysAllowAuthorization(); context.Services.AddAlwaysAllowAuthorization();
ConfigureInMemorySqlite(context.Services); ConfigureInMemorySqlite(context.Services);
context.Services.AddAssemblyOf<BookStoreApplicationTestModule>();
} }
private void ConfigureInMemorySqlite(IServiceCollection services) private void ConfigureInMemorySqlite(IServiceCollection services)

@ -41,8 +41,6 @@ namespace Acme.BookStore
{ {
ConfigureLocalizationServices(context.Services); ConfigureLocalizationServices(context.Services);
ConfigureNavigationServices(context.Services); ConfigureNavigationServices(context.Services);
context.Services.AddAssemblyOf<BookStoreWebTestModule>();
} }
private static void ConfigureLocalizationServices(IServiceCollection services) private static void ConfigureLocalizationServices(IServiceCollection services)

@ -1,8 +1,8 @@
using Microsoft.AspNetCore.Mvc.RazorPages; using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
namespace AuthServer.Host.Pages namespace AuthServer.Host.Pages
{ {
public class IndexModel : PageModel public class IndexModel : AbpPageModel
{ {
public void OnGet() public void OnGet()
{ {

@ -1,4 +1,17 @@
@page @page
@using Volo.Abp.Users
@model PublicWebSite.Host.Pages.IndexModel @model PublicWebSite.Host.Pages.IndexModel
@inject ICurrentUser CurrentUser
<h1>Public Web Site Application</h1> <h1>Public Web Site Application</h1>
<h2 class="lead">Welcome...</h2> <h2 class="lead">Welcome...</h2>
@if (CurrentUser.IsAuthenticated)
{
<a abp-button="Primary" asp-controller="Logout" asp-action="Index" asp-area="Account">Logout</a>
}
else
{
<form method="POST">
<input type="submit" asp-page-handler="Login" value="Login" />
</form>
}

@ -1,16 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Mvc.RazorPages; using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
namespace PublicWebSite.Host.Pages namespace PublicWebSite.Host.Pages
{ {
public class IndexModel : PageModel public class IndexModel : AbpPageModel
{ {
public void OnGet() public void OnGet()
{ {
}
public async Task OnPostLoginAsync()
{
await HttpContext.ChallengeAsync("oidc");
} }
} }
} }

@ -1,12 +1,12 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.RazorPages;
using MyCompanyName.ProductManagement; using MyCompanyName.ProductManagement;
using ProductManagement; using ProductManagement;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
namespace PublicWebSite.Host.Pages namespace PublicWebSite.Host.Pages
{ {
public class ProductsModel : PageModel public class ProductsModel : AbpPageModel
{ {
public ListResultDto<ProductDto> Products { get; set; } public ListResultDto<ProductDto> Products { get; set; }

@ -0,0 +1,4 @@
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling

@ -24,6 +24,7 @@
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" /> <ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.MongoDB\Volo.Abp.MongoDB.csproj" /> <ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.MongoDB\Volo.Abp.MongoDB.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.EventBus.RabbitMQ\Volo.Abp.EventBus.RabbitMQ.csproj" /> <ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.EventBus.RabbitMQ\Volo.Abp.EventBus.RabbitMQ.csproj" />
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.Identity.HttpApi.Client\Volo.Abp.Identity.HttpApi.Client.csproj" />
<ProjectReference Include="..\..\..\..\modules\blogging\src\Volo.Blogging.HttpApi\Volo.Blogging.HttpApi.csproj" /> <ProjectReference Include="..\..\..\..\modules\blogging\src\Volo.Blogging.HttpApi\Volo.Blogging.HttpApi.csproj" />
<ProjectReference Include="..\..\..\..\modules\blogging\src\Volo.Blogging.MongoDB\Volo.Blogging.MongoDB.csproj" /> <ProjectReference Include="..\..\..\..\modules\blogging\src\Volo.Blogging.MongoDB\Volo.Blogging.MongoDB.csproj" />
<ProjectReference Include="..\..\..\..\modules\blogging\src\Volo.Blogging.Application\Volo.Blogging.Application.csproj" /> <ProjectReference Include="..\..\..\..\modules\blogging\src\Volo.Blogging.Application\Volo.Blogging.Application.csproj" />

@ -10,6 +10,7 @@ using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.SqlServer; using Volo.Abp.EntityFrameworkCore.SqlServer;
using Volo.Abp.EventBus.RabbitMq; using Volo.Abp.EventBus.RabbitMq;
using Volo.Abp.Guids; using Volo.Abp.Guids;
using Volo.Abp.Identity;
using Volo.Abp.Localization; using Volo.Abp.Localization;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement.EntityFrameworkCore; using Volo.Abp.PermissionManagement.EntityFrameworkCore;
@ -31,7 +32,8 @@ namespace BloggingService.Host
typeof(AbpSettingManagementEntityFrameworkCoreModule), typeof(AbpSettingManagementEntityFrameworkCoreModule),
typeof(BloggingHttpApiModule), typeof(BloggingHttpApiModule),
typeof(BloggingMongoDbModule), typeof(BloggingMongoDbModule),
typeof(BloggingApplicationModule) typeof(BloggingApplicationModule),
typeof(AbpIdentityHttpApiClientModule)
)] )]
public class BloggingServiceHostModule : AbpModule public class BloggingServiceHostModule : AbpModule
{ {

@ -7,6 +7,11 @@
"Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true", "Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true",
"Blogging": "mongodb://localhost|MsDemo_Blogging" "Blogging": "mongodb://localhost|MsDemo_Blogging"
}, },
"RemoteServices": {
"Default": {
"BaseUrl": "http://localhost:65129/"
}
},
"Redis": { "Redis": {
"Configuration": "127.0.0.1" "Configuration": "127.0.0.1"
}, },

Loading…
Cancel
Save