Browse Source

Merge pull request #6 from abpframework/master

Merging master
pull/781/head
Marcelo Mohr Maciel 7 years ago
committed by GitHub
parent
commit
04ff89a9f8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/AggregateRoot.cs
  2. 21
      modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Users/BlogUser.cs
  3. 39
      modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Users/BlogUserSynchronizer.cs
  4. 2
      modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs
  5. 5
      samples/BookStore/src/Acme.BookStore.Application/BookStoreApplicationModule.cs
  6. 2
      samples/BookStore/src/Acme.BookStore.Domain/BookStoreDomainModule.cs
  7. 2
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreEntityFrameworkCoreModule.cs
  8. 2
      samples/BookStore/src/Acme.BookStore.Web/BookStoreWebModule.cs
  9. 2
      samples/BookStore/test/Acme.BookStore.Application.Tests/BookStoreApplicationTestModule.cs
  10. 2
      samples/BookStore/test/Acme.BookStore.Web.Tests/BookStoreWebTestModule.cs
  11. 4
      samples/MicroserviceDemo/applications/AuthServer.Host/Pages/Index.cshtml.cs
  12. 15
      samples/MicroserviceDemo/applications/PublicWebSite.Host/Pages/Index.cshtml
  13. 15
      samples/MicroserviceDemo/applications/PublicWebSite.Host/Pages/Index.cshtml.cs
  14. 4
      samples/MicroserviceDemo/applications/PublicWebSite.Host/Pages/Products.cshtml.cs
  15. 4
      samples/MicroserviceDemo/applications/PublicWebSite.Host/Pages/_ViewImports.cshtml
  16. BIN
      samples/MicroserviceDemo/applications/PublicWebSite.Host/wwwroot/files/ec882345a403be325bc539ebda211e79.jpg
  17. 1
      samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingService.Host.csproj
  18. 4
      samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingServiceHostModule.cs
  19. 5
      samples/MicroserviceDemo/microservices/BloggingService.Host/appsettings.json

8
framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/AggregateRoot.cs

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

21
modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Users/BlogUser.cs

@ -1,12 +1,10 @@
using System;
using System.Collections.Generic;
using Volo.Abp.Data;
using Volo.Abp.Domain.Entities;
using Volo.Abp.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; }
@ -24,16 +22,14 @@ namespace Volo.Blogging.Users
public virtual bool PhoneNumberConfirmed { get; protected set; }
public virtual Dictionary<string, object> ExtraProperties { get; protected set; }
protected BlogUser()
{
ExtraProperties = new Dictionary<string, object>();
}
public BlogUser(IUserData user)
: base(user.Id)
{
Id = user.Id;
Email = user.Email;
Name = user.Name;
Surname = user.Surname;
@ -42,8 +38,17 @@ namespace Volo.Blogging.Users
PhoneNumberConfirmed = user.PhoneNumberConfirmed;
UserName = user.UserName;
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;
}
}
}

39
modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Users/BlogUserSynchronizer.cs

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

2
modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs

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

5
samples/BookStore/src/Acme.BookStore.Application/BookStoreApplicationModule.cs

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

2
samples/BookStore/src/Acme.BookStore.Domain/BookStoreDomainModule.cs

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

2
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreEntityFrameworkCoreModule.cs

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

2
samples/BookStore/src/Acme.BookStore.Web/BookStoreWebModule.cs

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

2
samples/BookStore/test/Acme.BookStore.Application.Tests/BookStoreApplicationTestModule.cs

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

2
samples/BookStore/test/Acme.BookStore.Web.Tests/BookStoreWebTestModule.cs

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

4
samples/MicroserviceDemo/applications/AuthServer.Host/Pages/Index.cshtml.cs

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

15
samples/MicroserviceDemo/applications/PublicWebSite.Host/Pages/Index.cshtml

@ -1,4 +1,17 @@
@page
@using Volo.Abp.Users
@model PublicWebSite.Host.Pages.IndexModel
@inject ICurrentUser CurrentUser
<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>
}

15
samples/MicroserviceDemo/applications/PublicWebSite.Host/Pages/Index.cshtml.cs

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

4
samples/MicroserviceDemo/applications/PublicWebSite.Host/Pages/Products.cshtml.cs

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

4
samples/MicroserviceDemo/applications/PublicWebSite.Host/Pages/_ViewImports.cshtml

@ -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

BIN
samples/MicroserviceDemo/applications/PublicWebSite.Host/wwwroot/files/ec882345a403be325bc539ebda211e79.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 KiB

1
samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingService.Host.csproj

@ -24,6 +24,7 @@
<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.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.MongoDB\Volo.Blogging.MongoDB.csproj" />
<ProjectReference Include="..\..\..\..\modules\blogging\src\Volo.Blogging.Application\Volo.Blogging.Application.csproj" />

4
samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingServiceHostModule.cs

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

5
samples/MicroserviceDemo/microservices/BloggingService.Host/appsettings.json

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

Loading…
Cancel
Save