Browse Source

Remove EventHub.EntityFrameworkCore.DbMigrations project

pull/46/head
Halil İbrahim Kalkan 5 years ago
parent
commit
a002e918ee
  1. 7
      EventHub.sln
  2. 2
      src/EventHub.Admin.HttpApi.Host/EventHub.Admin.HttpApi.Host.csproj
  3. 2
      src/EventHub.Admin.HttpApi.Host/EventHubAdminHttpApiHostModule.cs
  4. 7
      src/EventHub.Application/EventHubApplicationAutoMapperProfile.cs
  5. 5
      src/EventHub.Application/Events/EventAppService.cs
  6. 8
      src/EventHub.Application/Events/Registrations/EventRegistrationAppService.cs
  7. 4
      src/EventHub.Application/Events/Registrations/EventRegistrationNotifier.cs
  8. 7
      src/EventHub.Application/Organizations/Memberships/OrganizationMembershipAppService.cs
  9. 5
      src/EventHub.Application/Organizations/OrganizationAppService.cs
  10. 7
      src/EventHub.Application/Users/UserAppService.cs
  11. 5
      src/EventHub.BackgroundServices/Events/EventReminderNotifier.cs
  12. 5
      src/EventHub.BackgroundServices/Events/EventTimingChangeNotifier.cs
  13. 5
      src/EventHub.BackgroundServices/Events/NewEventNotifier.cs
  14. 4
      src/EventHub.DbMigrator/Data/EventHubSampleDataSeedContributor.cs
  15. 2
      src/EventHub.DbMigrator/EventHub.DbMigrator.csproj
  16. 2
      src/EventHub.DbMigrator/EventHubDbMigratorModule.cs
  17. 2
      src/EventHub.Domain/Data/EventHubDbMigrationService.cs
  18. 8
      src/EventHub.Domain/Events/Registrations/EventRegistrationManager.cs
  19. 6
      src/EventHub.Domain/Organizations/Memberships/OrganizationMembershipManager.cs
  20. 78
      src/EventHub.Domain/Users/AppUser.cs
  21. 22
      src/EventHub.Domain/Users/EventHubIdentityUserExtensions.cs
  22. 16
      src/EventHub.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/EventHubEntityFrameworkCoreDbMigrationsModule.cs
  23. 47
      src/EventHub.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/EventHubMigrationsDbContext.cs
  24. 18
      src/EventHub.EntityFrameworkCore.DbMigrations/EventHub.EntityFrameworkCore.DbMigrations.csproj
  25. 2636
      src/EventHub.EntityFrameworkCore.DbMigrations/Migrations/20210421100913_Initial.Designer.cs
  26. 2639
      src/EventHub.EntityFrameworkCore.DbMigrations/Migrations/20210428213802_Added_CountryName_To_Event.Designer.cs
  27. 23
      src/EventHub.EntityFrameworkCore.DbMigrations/Migrations/20210428213802_Added_CountryName_To_Event.cs
  28. 35
      src/EventHub.EntityFrameworkCore.DbMigrations/Migrations/20210614064205_Moved_IsTimingChangeEmailSent_To_Event.cs
  29. 2
      src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreEventHubDbSchemaMigrator.cs
  30. 50
      src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EventHubDbContext.cs
  31. 8
      src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EventHubDbContextFactory.cs
  32. 22
      src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EventHubDbContextModelCreatingExtensions.cs
  33. 2
      src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EventHubEntityFrameworkCoreModule.cs
  34. 4
      src/EventHub.EntityFrameworkCore/EventHub.EntityFrameworkCore.csproj
  35. 17
      src/EventHub.EntityFrameworkCore/Migrations/20210623133429_Initial.Designer.cs
  36. 3159
      src/EventHub.EntityFrameworkCore/Migrations/20210623133429_Initial.cs
  37. 15
      src/EventHub.EntityFrameworkCore/Migrations/EventHubDbContextModelSnapshot.cs
  38. 2
      src/EventHub.HttpApi.Host/EventHub.HttpApi.Host.csproj
  39. 2
      src/EventHub.HttpApi.Host/EventHubHttpApiHostModule.cs
  40. 5
      src/EventHub.IdentityServer/EventHub.IdentityServer.csproj
  41. 2
      src/EventHub.IdentityServer/EventHubIdentityServerModule.cs
  42. 6
      test/EventHub.EntityFrameworkCore.Tests/EntityFrameworkCore/EventHubEntityFrameworkCoreTestModule.cs
  43. 2
      test/EventHub.EntityFrameworkCore.Tests/EventHub.EntityFrameworkCore.Tests.csproj
  44. 9
      test/EventHub.TestBase/EventHubTestBase.cs

7
EventHub.sln

@ -15,8 +15,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{04DBDB01-7
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventHub.Application.Tests", "test\EventHub.Application.Tests\EventHub.Application.Tests.csproj", "{50B2631D-129C-47B3-A587-029CCD6099BC}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventHub.Application.Tests", "test\EventHub.Application.Tests\EventHub.Application.Tests.csproj", "{50B2631D-129C-47B3-A587-029CCD6099BC}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventHub.EntityFrameworkCore.DbMigrations", "src\EventHub.EntityFrameworkCore.DbMigrations\EventHub.EntityFrameworkCore.DbMigrations.csproj", "{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventHub.Domain.Shared", "src\EventHub.Domain.Shared\EventHub.Domain.Shared.csproj", "{42F719ED-8413-4895-B5B4-5AB56079BC66}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventHub.Domain.Shared", "src\EventHub.Domain.Shared\EventHub.Domain.Shared.csproj", "{42F719ED-8413-4895-B5B4-5AB56079BC66}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventHub.Application.Contracts", "src\EventHub.Application.Contracts\EventHub.Application.Contracts.csproj", "{520659C8-C734-4298-A3DA-B539DB9DFC0B}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventHub.Application.Contracts", "src\EventHub.Application.Contracts\EventHub.Application.Contracts.csproj", "{520659C8-C734-4298-A3DA-B539DB9DFC0B}"
@ -89,10 +87,6 @@ Global
{50B2631D-129C-47B3-A587-029CCD6099BC}.Debug|Any CPU.Build.0 = Debug|Any CPU {50B2631D-129C-47B3-A587-029CCD6099BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{50B2631D-129C-47B3-A587-029CCD6099BC}.Release|Any CPU.ActiveCfg = Release|Any CPU {50B2631D-129C-47B3-A587-029CCD6099BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{50B2631D-129C-47B3-A587-029CCD6099BC}.Release|Any CPU.Build.0 = Release|Any CPU {50B2631D-129C-47B3-A587-029CCD6099BC}.Release|Any CPU.Build.0 = Release|Any CPU
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}.Release|Any CPU.Build.0 = Release|Any CPU
{42F719ED-8413-4895-B5B4-5AB56079BC66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {42F719ED-8413-4895-B5B4-5AB56079BC66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{42F719ED-8413-4895-B5B4-5AB56079BC66}.Debug|Any CPU.Build.0 = Debug|Any CPU {42F719ED-8413-4895-B5B4-5AB56079BC66}.Debug|Any CPU.Build.0 = Debug|Any CPU
{42F719ED-8413-4895-B5B4-5AB56079BC66}.Release|Any CPU.ActiveCfg = Release|Any CPU {42F719ED-8413-4895-B5B4-5AB56079BC66}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -182,7 +176,6 @@ Global
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F} = {81F0EB50-4CF9-402D-B723-A07E95F8D7CB} {554AD327-6DBA-4F8F-96F8-81CE7A0C863F} = {81F0EB50-4CF9-402D-B723-A07E95F8D7CB}
{42F719ED-8413-4895-B5B4-5AB56079BC66} = {81F0EB50-4CF9-402D-B723-A07E95F8D7CB} {42F719ED-8413-4895-B5B4-5AB56079BC66} = {81F0EB50-4CF9-402D-B723-A07E95F8D7CB}
{C956DD76-69C8-4A9C-83EA-D17DF83340FD} = {81F0EB50-4CF9-402D-B723-A07E95F8D7CB} {C956DD76-69C8-4A9C-83EA-D17DF83340FD} = {81F0EB50-4CF9-402D-B723-A07E95F8D7CB}
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0} = {81F0EB50-4CF9-402D-B723-A07E95F8D7CB}
{BAA6ED88-6783-48EF-8691-46F4BED14023} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} {BAA6ED88-6783-48EF-8691-46F4BED14023} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{073C361E-B8F4-49F5-93CC-72A3FF49C026} = {BAA6ED88-6783-48EF-8691-46F4BED14023} {073C361E-B8F4-49F5-93CC-72A3FF49C026} = {BAA6ED88-6783-48EF-8691-46F4BED14023}
{F8CF0FE2-9F75-4940-92EC-3D021416DEBF} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} {F8CF0FE2-9F75-4940-92EC-3D021416DEBF} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}

2
src/EventHub.Admin.HttpApi.Host/EventHub.Admin.HttpApi.Host.csproj

@ -25,7 +25,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\EventHub.Admin.Application\EventHub.Admin.Application.csproj" /> <ProjectReference Include="..\EventHub.Admin.Application\EventHub.Admin.Application.csproj" />
<ProjectReference Include="..\EventHub.Admin.HttpApi\EventHub.Admin.HttpApi.csproj" /> <ProjectReference Include="..\EventHub.Admin.HttpApi\EventHub.Admin.HttpApi.csproj" />
<ProjectReference Include="..\EventHub.EntityFrameworkCore.DbMigrations\EventHub.EntityFrameworkCore.DbMigrations.csproj" /> <ProjectReference Include="..\EventHub.EntityFrameworkCore\EventHub.EntityFrameworkCore.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

2
src/EventHub.Admin.HttpApi.Host/EventHubAdminHttpApiHostModule.cs

@ -32,7 +32,7 @@ namespace EventHub.Admin
[DependsOn( [DependsOn(
typeof(EventHubAdminApplicationModule), typeof(EventHubAdminApplicationModule),
typeof(EventHubAdminHttpApiModule), typeof(EventHubAdminHttpApiModule),
typeof(EventHubEntityFrameworkCoreDbMigrationsModule), typeof(EventHubEntityFrameworkCoreModule),
typeof(AbpAutofacModule), typeof(AbpAutofacModule),
typeof(AbpCachingStackExchangeRedisModule), typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpAspNetCoreSerilogModule), typeof(AbpAspNetCoreSerilogModule),

7
src/EventHub.Application/EventHubApplicationAutoMapperProfile.cs

@ -7,6 +7,7 @@ using EventHub.Organizations;
using EventHub.Organizations.Memberships; using EventHub.Organizations.Memberships;
using EventHub.Users; using EventHub.Users;
using Volo.Abp.AutoMapper; using Volo.Abp.AutoMapper;
using Volo.Abp.Identity;
namespace EventHub namespace EventHub
{ {
@ -17,7 +18,7 @@ namespace EventHub
CreateMap<Organization, OrganizationInListDto>(); CreateMap<Organization, OrganizationInListDto>();
CreateMap<Organization, OrganizationProfileDto>(); CreateMap<Organization, OrganizationProfileDto>();
CreateMap<AppUser, OrganizationMemberDto>(); CreateMap<IdentityUser, OrganizationMemberDto>();
CreateMap<Event, EventDto>(); CreateMap<Event, EventDto>();
CreateMap<Event, EventInListDto>() CreateMap<Event, EventInListDto>()
@ -29,14 +30,14 @@ namespace EventHub
.Ignore(x => x.OrganizationName) .Ignore(x => x.OrganizationName)
.Ignore(x => x.OrganizationDisplayName); .Ignore(x => x.OrganizationDisplayName);
CreateMap<AppUser, EventAttendeeDto>(); CreateMap<IdentityUser, EventAttendeeDto>();
CreateMap<Event, EventLocationDto>() CreateMap<Event, EventLocationDto>()
.Ignore(x => x.Country); .Ignore(x => x.Country);
CreateMap<Country, CountryLookupDto>(); CreateMap<Country, CountryLookupDto>();
CreateMap<AppUser, UserDto>(); CreateMap<IdentityUser, UserDto>();
} }
} }
} }

5
src/EventHub.Application/Events/EventAppService.cs

@ -11,6 +11,7 @@ using Volo.Abp.Application.Dtos;
using Volo.Abp.Authorization; using Volo.Abp.Authorization;
using Volo.Abp.BlobStoring; using Volo.Abp.BlobStoring;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity;
using Volo.Abp.Users; using Volo.Abp.Users;
namespace EventHub.Events namespace EventHub.Events
@ -22,7 +23,7 @@ namespace EventHub.Events
private readonly IRepository<EventRegistration, Guid> _eventRegistrationRepository; private readonly IRepository<EventRegistration, Guid> _eventRegistrationRepository;
private readonly IRepository<Event, Guid> _eventRepository; private readonly IRepository<Event, Guid> _eventRepository;
private readonly IRepository<Organization, Guid> _organizationRepository; private readonly IRepository<Organization, Guid> _organizationRepository;
private readonly IRepository<AppUser, Guid> _userRepository; private readonly IRepository<IdentityUser, Guid> _userRepository;
private readonly IRepository<Country, Guid> _countriesRepository; private readonly IRepository<Country, Guid> _countriesRepository;
private readonly IBlobContainer<EventCoverImageContainer> _eventBlobContainer; private readonly IBlobContainer<EventCoverImageContainer> _eventBlobContainer;
@ -32,7 +33,7 @@ namespace EventHub.Events
IRepository<EventRegistration, Guid> eventRegistrationRepository, IRepository<EventRegistration, Guid> eventRegistrationRepository,
IRepository<Event, Guid> eventRepository, IRepository<Event, Guid> eventRepository,
IRepository<Organization, Guid> organizationRepository, IRepository<Organization, Guid> organizationRepository,
IRepository<AppUser, Guid> userRepository, IRepository<IdentityUser, Guid> userRepository,
IRepository<Country, Guid> countriesRepository, IRepository<Country, Guid> countriesRepository,
IBlobContainer<EventCoverImageContainer> eventBlobContainer) IBlobContainer<EventCoverImageContainer> eventBlobContainer)
{ {

8
src/EventHub.Application/Events/Registrations/EventRegistrationAppService.cs

@ -2,25 +2,25 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using EventHub.Users;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
using Volo.Abp.Users; using Volo.Abp.Users;
using Volo.Abp.Identity;
namespace EventHub.Events.Registrations namespace EventHub.Events.Registrations
{ {
public class EventRegistrationAppService : EventHubAppService, IEventRegistrationAppService public class EventRegistrationAppService : EventHubAppService, IEventRegistrationAppService
{ {
private readonly EventRegistrationManager _eventRegistrationManager; private readonly EventRegistrationManager _eventRegistrationManager;
private readonly IRepository<AppUser, Guid> _userRepository; private readonly IRepository<IdentityUser, Guid> _userRepository;
private readonly IRepository<Event, Guid> _eventRepository; private readonly IRepository<Event, Guid> _eventRepository;
private readonly IRepository<EventRegistration, Guid> _eventRegistrationRepository; private readonly IRepository<EventRegistration, Guid> _eventRegistrationRepository;
private readonly EventRegistrationNotifier _eventRegistrationNotifier; private readonly EventRegistrationNotifier _eventRegistrationNotifier;
public EventRegistrationAppService( public EventRegistrationAppService(
EventRegistrationManager eventRegistrationManager, EventRegistrationManager eventRegistrationManager,
IRepository<AppUser, Guid> userRepository, IRepository<IdentityUser, Guid> userRepository,
IRepository<Event, Guid> eventRepository, IRepository<Event, Guid> eventRepository,
IRepository<EventRegistration, Guid> eventRegistrationRepository, IRepository<EventRegistration, Guid> eventRegistrationRepository,
EventRegistrationNotifier eventRegistrationNotifier) EventRegistrationNotifier eventRegistrationNotifier)
@ -77,7 +77,7 @@ namespace EventHub.Events.Registrations
return new PagedResultDto<EventAttendeeDto>( return new PagedResultDto<EventAttendeeDto>(
totalCount, totalCount,
ObjectMapper.Map<List<AppUser>, List<EventAttendeeDto>>(users) ObjectMapper.Map<List<IdentityUser>, List<EventAttendeeDto>>(users)
); );
} }

4
src/EventHub.Application/Events/Registrations/EventRegistrationNotifier.cs

@ -1,8 +1,8 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using EventHub.Emailing; using EventHub.Emailing;
using EventHub.Users;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Emailing; using Volo.Abp.Emailing;
using Volo.Abp.Identity;
using Volo.Abp.TextTemplating; using Volo.Abp.TextTemplating;
namespace EventHub.Events.Registrations namespace EventHub.Events.Registrations
@ -22,7 +22,7 @@ namespace EventHub.Events.Registrations
public async Task NotifyAsync( public async Task NotifyAsync(
Event @event, Event @event,
AppUser user) IdentityUser user)
{ {
if (user is null || @event is null) if (user is null || @event is null)
{ {

7
src/EventHub.Application/Organizations/Memberships/OrganizationMembershipAppService.cs

@ -6,6 +6,7 @@ using EventHub.Users;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity;
using Volo.Abp.Users; using Volo.Abp.Users;
namespace EventHub.Organizations.Memberships namespace EventHub.Organizations.Memberships
@ -13,13 +14,13 @@ namespace EventHub.Organizations.Memberships
public class OrganizationMembershipAppService : EventHubAppService, IOrganizationMembershipAppService public class OrganizationMembershipAppService : EventHubAppService, IOrganizationMembershipAppService
{ {
private readonly OrganizationMembershipManager _organizationMembershipManager; private readonly OrganizationMembershipManager _organizationMembershipManager;
private readonly IRepository<AppUser, Guid> _userRepository; private readonly IRepository<IdentityUser, Guid> _userRepository;
private readonly IRepository<Organization, Guid> _organizationRepository; private readonly IRepository<Organization, Guid> _organizationRepository;
private readonly IRepository<OrganizationMembership, Guid> _organizationMembershipsRepository; private readonly IRepository<OrganizationMembership, Guid> _organizationMembershipsRepository;
public OrganizationMembershipAppService( public OrganizationMembershipAppService(
OrganizationMembershipManager organizationMembershipManager, OrganizationMembershipManager organizationMembershipManager,
IRepository<AppUser, Guid> userRepository, IRepository<IdentityUser, Guid> userRepository,
IRepository<Organization, Guid> organizationRepository, IRepository<Organization, Guid> organizationRepository,
IRepository<OrganizationMembership, Guid> organizationMembershipsRepository) IRepository<OrganizationMembership, Guid> organizationMembershipsRepository)
{ {
@ -72,7 +73,7 @@ namespace EventHub.Organizations.Memberships
return new PagedResultDto<OrganizationMemberDto>( return new PagedResultDto<OrganizationMemberDto>(
totalCount, totalCount,
ObjectMapper.Map<List<AppUser>, List<OrganizationMemberDto>>(users) ObjectMapper.Map<List<IdentityUser>, List<OrganizationMemberDto>>(users)
); );
} }
} }

5
src/EventHub.Application/Organizations/OrganizationAppService.cs

@ -9,6 +9,7 @@ using Volo.Abp.Application.Dtos;
using Volo.Abp.Authorization; using Volo.Abp.Authorization;
using Volo.Abp.BlobStoring; using Volo.Abp.BlobStoring;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity;
using Volo.Abp.Users; using Volo.Abp.Users;
namespace EventHub.Organizations namespace EventHub.Organizations
@ -19,14 +20,14 @@ namespace EventHub.Organizations
private readonly IRepository<OrganizationMembership, Guid> _organizationMembershipsRepository; private readonly IRepository<OrganizationMembership, Guid> _organizationMembershipsRepository;
private readonly OrganizationManager _organizationManager; private readonly OrganizationManager _organizationManager;
private readonly IBlobContainer<OrganizationProfilePictureContainer> _organizationBlobContainer; private readonly IBlobContainer<OrganizationProfilePictureContainer> _organizationBlobContainer;
private readonly IRepository<AppUser, Guid> _userRepository; private readonly IRepository<IdentityUser, Guid> _userRepository;
public OrganizationAppService( public OrganizationAppService(
IRepository<Organization, Guid> organizationRepository, IRepository<Organization, Guid> organizationRepository,
IRepository<OrganizationMembership, Guid> organizationMembershipsRepository, IRepository<OrganizationMembership, Guid> organizationMembershipsRepository,
OrganizationManager organizationManager, OrganizationManager organizationManager,
IBlobContainer<OrganizationProfilePictureContainer> organizationBlobContainer, IBlobContainer<OrganizationProfilePictureContainer> organizationBlobContainer,
IRepository<AppUser, Guid> userRepository) IRepository<IdentityUser, Guid> userRepository)
{ {
_organizationRepository = organizationRepository; _organizationRepository = organizationRepository;
_organizationMembershipsRepository = organizationMembershipsRepository; _organizationMembershipsRepository = organizationMembershipsRepository;

7
src/EventHub.Application/Users/UserAppService.cs

@ -2,14 +2,15 @@ using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using EventHub.Members; using EventHub.Members;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity;
namespace EventHub.Users namespace EventHub.Users
{ {
public class UserAppService : EventHubAppService, IUserAppService public class UserAppService : EventHubAppService, IUserAppService
{ {
private readonly IRepository<AppUser, Guid> _userRepository; private readonly IRepository<IdentityUser, Guid> _userRepository;
public UserAppService(IRepository<AppUser, Guid> userRepository) public UserAppService(IRepository<IdentityUser, Guid> userRepository)
{ {
_userRepository = userRepository; _userRepository = userRepository;
} }
@ -18,7 +19,7 @@ namespace EventHub.Users
{ {
var user = await _userRepository.FindAsync(x => x.UserName == username); var user = await _userRepository.FindAsync(x => x.UserName == username);
return ObjectMapper.Map<AppUser, UserDto>(user); return ObjectMapper.Map<IdentityUser, UserDto>(user);
} }
} }
} }

5
src/EventHub.BackgroundServices/Events/EventReminderNotifier.cs

@ -7,6 +7,7 @@ using EventHub.Users;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
using Volo.Abp.Emailing; using Volo.Abp.Emailing;
using Volo.Abp.Identity;
using Volo.Abp.Linq; using Volo.Abp.Linq;
using Volo.Abp.TextTemplating; using Volo.Abp.TextTemplating;
@ -16,14 +17,14 @@ namespace EventHub.Events
{ {
private readonly IEmailSender _emailSender; private readonly IEmailSender _emailSender;
private readonly ITemplateRenderer _templateRenderer; private readonly ITemplateRenderer _templateRenderer;
private readonly IRepository<AppUser, Guid> _userRepository; private readonly IRepository<IdentityUser, Guid> _userRepository;
private readonly IRepository<EventRegistration, Guid> _eventRegistrationRepository; private readonly IRepository<EventRegistration, Guid> _eventRegistrationRepository;
private readonly IAsyncQueryableExecuter _asyncExecuter; private readonly IAsyncQueryableExecuter _asyncExecuter;
public EventReminderNotifier( public EventReminderNotifier(
IEmailSender emailSender, IEmailSender emailSender,
ITemplateRenderer templateRenderer, ITemplateRenderer templateRenderer,
IRepository<AppUser, Guid> userRepository, IRepository<IdentityUser, Guid> userRepository,
IRepository<EventRegistration, Guid> eventRegistrationRepository, IRepository<EventRegistration, Guid> eventRegistrationRepository,
IAsyncQueryableExecuter asyncExecuter) IAsyncQueryableExecuter asyncExecuter)
{ {

5
src/EventHub.BackgroundServices/Events/EventTimingChangeNotifier.cs

@ -7,6 +7,7 @@ using EventHub.Users;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
using Volo.Abp.Emailing; using Volo.Abp.Emailing;
using Volo.Abp.Identity;
using Volo.Abp.Linq; using Volo.Abp.Linq;
using Volo.Abp.TextTemplating; using Volo.Abp.TextTemplating;
@ -17,14 +18,14 @@ namespace EventHub.Events
private readonly IEmailSender _emailSender; private readonly IEmailSender _emailSender;
private readonly ITemplateRenderer _templateRenderer; private readonly ITemplateRenderer _templateRenderer;
private readonly IAsyncQueryableExecuter _asyncExecuter; private readonly IAsyncQueryableExecuter _asyncExecuter;
private readonly IRepository<AppUser, Guid> _userRepository; private readonly IRepository<IdentityUser, Guid> _userRepository;
private readonly IRepository<EventRegistration, Guid> _eventRegistrationRepository; private readonly IRepository<EventRegistration, Guid> _eventRegistrationRepository;
public EventTimingChangeNotifier( public EventTimingChangeNotifier(
IEmailSender emailSender, IEmailSender emailSender,
ITemplateRenderer templateRenderer, ITemplateRenderer templateRenderer,
IAsyncQueryableExecuter asyncExecuter, IAsyncQueryableExecuter asyncExecuter,
IRepository<AppUser, Guid> userRepository, IRepository<IdentityUser, Guid> userRepository,
IRepository<EventRegistration, Guid> eventRegistrationRepository) IRepository<EventRegistration, Guid> eventRegistrationRepository)
{ {
_emailSender = emailSender; _emailSender = emailSender;

5
src/EventHub.BackgroundServices/Events/NewEventNotifier.cs

@ -7,6 +7,7 @@ using EventHub.Users;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
using Volo.Abp.Emailing; using Volo.Abp.Emailing;
using Volo.Abp.Identity;
using Volo.Abp.Linq; using Volo.Abp.Linq;
using Volo.Abp.TextTemplating; using Volo.Abp.TextTemplating;
@ -17,14 +18,14 @@ namespace EventHub.Events
private readonly IEmailSender _emailSender; private readonly IEmailSender _emailSender;
private readonly ITemplateRenderer _templateRenderer; private readonly ITemplateRenderer _templateRenderer;
private readonly IRepository<OrganizationMembership, Guid> _organizationMembershipsRepository; private readonly IRepository<OrganizationMembership, Guid> _organizationMembershipsRepository;
private readonly IRepository<AppUser, Guid> _userRepository; private readonly IRepository<IdentityUser, Guid> _userRepository;
private readonly IAsyncQueryableExecuter _asyncExecuter; private readonly IAsyncQueryableExecuter _asyncExecuter;
public NewEventNotifier( public NewEventNotifier(
IEmailSender emailSender, IEmailSender emailSender,
ITemplateRenderer templateRenderer, ITemplateRenderer templateRenderer,
IRepository<OrganizationMembership, Guid> organizationMembershipsRepository, IRepository<OrganizationMembership, Guid> organizationMembershipsRepository,
IRepository<AppUser, Guid> userRepository, IRepository<IdentityUser, Guid> userRepository,
IAsyncQueryableExecuter asyncExecuter) IAsyncQueryableExecuter asyncExecuter)
{ {
_emailSender = emailSender; _emailSender = emailSender;

4
src/EventHub.DbMigrator/Data/EventHubSampleDataSeedContributor.cs

@ -24,7 +24,7 @@ namespace EventHub.DbMigrator.Data
private readonly IRepository<Event, Guid> _eventRepository; private readonly IRepository<Event, Guid> _eventRepository;
private readonly EventManager _eventManager; private readonly EventManager _eventManager;
private readonly EventRegistrationManager _eventRegistrationManager; private readonly EventRegistrationManager _eventRegistrationManager;
private readonly IRepository<AppUser, Guid> _userRepository; private readonly IRepository<IdentityUser, Guid> _userRepository;
private Guid _userSandraId; private Guid _userSandraId;
private Guid _userSergeyId; private Guid _userSergeyId;
@ -46,7 +46,7 @@ namespace EventHub.DbMigrator.Data
IRepository<Event, Guid> eventRepository, IRepository<Event, Guid> eventRepository,
EventManager eventManager, EventManager eventManager,
EventRegistrationManager eventRegistrationManager, EventRegistrationManager eventRegistrationManager,
IRepository<AppUser, Guid> userRepository) IRepository<IdentityUser, Guid> userRepository)
{ {
_guidGenerator = guidGenerator; _guidGenerator = guidGenerator;
_identityUserManager = identityUserManager; _identityUserManager = identityUserManager;

2
src/EventHub.DbMigrator/EventHub.DbMigrator.csproj

@ -30,7 +30,7 @@
<PackageReference Include="Volo.Abp.Autofac" Version="4.2.1" /> <PackageReference Include="Volo.Abp.Autofac" Version="4.2.1" />
<ProjectReference Include="..\EventHub.Application.Contracts\EventHub.Application.Contracts.csproj" /> <ProjectReference Include="..\EventHub.Application.Contracts\EventHub.Application.Contracts.csproj" />
<ProjectReference Include="..\EventHub.Admin.Application.Contracts\EventHub.Admin.Application.Contracts.csproj" /> <ProjectReference Include="..\EventHub.Admin.Application.Contracts\EventHub.Admin.Application.Contracts.csproj" />
<ProjectReference Include="..\EventHub.EntityFrameworkCore.DbMigrations\EventHub.EntityFrameworkCore.DbMigrations.csproj" /> <ProjectReference Include="..\EventHub.EntityFrameworkCore\EventHub.EntityFrameworkCore.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

2
src/EventHub.DbMigrator/EventHubDbMigratorModule.cs

@ -8,7 +8,7 @@ namespace EventHub.DbMigrator
{ {
[DependsOn( [DependsOn(
typeof(AbpAutofacModule), typeof(AbpAutofacModule),
typeof(EventHubEntityFrameworkCoreDbMigrationsModule), typeof(EventHubEntityFrameworkCoreModule),
typeof(EventHubApplicationContractsModule), typeof(EventHubApplicationContractsModule),
typeof(EventHubAdminApplicationContractsModule) typeof(EventHubAdminApplicationContractsModule)
)] )]

2
src/EventHub.Domain/Data/EventHubDbMigrationService.cs

@ -121,7 +121,7 @@ namespace EventHub.Data
var srcDirectoryPath = Path.Combine(slnDirectoryPath, "src"); var srcDirectoryPath = Path.Combine(slnDirectoryPath, "src");
return Directory.GetDirectories(srcDirectoryPath) return Directory.GetDirectories(srcDirectoryPath)
.FirstOrDefault(d => d.EndsWith(".DbMigrations")); .FirstOrDefault(d => d.EndsWith(".EntityFrameworkCore"));
} }
private static string GetSolutionDirectoryPath() private static string GetSolutionDirectoryPath()

8
src/EventHub.Domain/Events/Registrations/EventRegistrationManager.cs

@ -1,9 +1,9 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using EventHub.Users;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services; using Volo.Abp.Domain.Services;
using Volo.Abp.Identity;
namespace EventHub.Events.Registrations namespace EventHub.Events.Registrations
{ {
@ -18,7 +18,7 @@ namespace EventHub.Events.Registrations
public async Task RegisterAsync( public async Task RegisterAsync(
Event @event, Event @event,
AppUser user) IdentityUser user)
{ {
if (IsPastEvent(@event)) if (IsPastEvent(@event))
{ {
@ -49,7 +49,7 @@ namespace EventHub.Events.Registrations
public async Task UnregisterAsync( public async Task UnregisterAsync(
Event @event, Event @event,
AppUser user) IdentityUser user)
{ {
if (IsPastEvent(@event)) if (IsPastEvent(@event))
{ {
@ -63,7 +63,7 @@ namespace EventHub.Events.Registrations
public async Task<bool> IsRegisteredAsync( public async Task<bool> IsRegisteredAsync(
Event @event, Event @event,
AppUser user) IdentityUser user)
{ {
return await _eventRegistrationRepository return await _eventRegistrationRepository
.AnyAsync(x => x.EventId == @event.Id && x.UserId == user.Id); .AnyAsync(x => x.EventId == @event.Id && x.UserId == user.Id);

6
src/EventHub.Domain/Organizations/Memberships/OrganizationMembershipManager.cs

@ -1,8 +1,8 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using EventHub.Users;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services; using Volo.Abp.Domain.Services;
using Volo.Abp.Identity;
namespace EventHub.Organizations.Memberships namespace EventHub.Organizations.Memberships
{ {
@ -17,7 +17,7 @@ namespace EventHub.Organizations.Memberships
public async Task JoinAsync( public async Task JoinAsync(
Organization organization, Organization organization,
AppUser user) IdentityUser user)
{ {
if (await IsJoinedAsync(organization, user)) if (await IsJoinedAsync(organization, user))
{ {
@ -35,7 +35,7 @@ namespace EventHub.Organizations.Memberships
public async Task<bool> IsJoinedAsync( public async Task<bool> IsJoinedAsync(
Organization organization, Organization organization,
AppUser user) IdentityUser user)
{ {
return await _organizationMembershipsRepository return await _organizationMembershipsRepository
.AnyAsync(x => x.OrganizationId == organization.Id && x.UserId == user.Id); .AnyAsync(x => x.OrganizationId == organization.Id && x.UserId == user.Id);

78
src/EventHub.Domain/Users/AppUser.cs

@ -1,78 +0,0 @@
using System;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.Users;
namespace EventHub.Users
{
/* This entity shares the same table/collection ("AbpUsers" by default) with the
* IdentityUser entity of the Identity module.
*
* - You can define your custom properties into this class.
* - You never create or delete this entity, because it is Identity module's job.
* - You can query users from database with this entity.
* - You can update values of your custom properties.
*/
public class AppUser : FullAuditedAggregateRoot<Guid>, IUser
{
#region Base properties
/* These properties are shared with the IdentityUser entity of the Identity module.
* Do not change these properties through this class. Instead, use Identity module
* services (like IdentityUserManager) to change them.
* So, this properties are designed as read only!
*/
public virtual Guid? TenantId { get; private set; }
public virtual string UserName { get; private set; }
public virtual string Name { get; private set; }
public virtual string Surname { get; private set; }
public virtual string Email { get; private set; }
public virtual bool EmailConfirmed { get; private set; }
public virtual string PhoneNumber { get; private set; }
public virtual bool PhoneNumberConfirmed { get; private set; }
#endregion
/* Add your own properties here. Example:
*
* public string MyProperty { get; set; }
*
* If you add a property and using the EF Core, remember these;
*
* 1. Update EventHubDbContext.OnModelCreating
* to configure the mapping for your new property
* 2. Update EventHubEfCoreEntityExtensionMappings to extend the IdentityUser entity
* and add your new property to the migration.
* 3. Use the Add-Migration to add a new database migration.
* 4. Run the .DbMigrator project (or use the Update-Database command) to apply
* schema change to the database.
*/
private AppUser()
{
}
public string GetFullNameOrUsername()
{
if (!string.IsNullOrWhiteSpace(Name) && !string.IsNullOrWhiteSpace(Surname))
{
return Name + " " + Surname;
}
if (!string.IsNullOrWhiteSpace(Name))
{
return Name;
}
return UserName;
}
}
}

22
src/EventHub.Domain/Users/EventHubIdentityUserExtensions.cs

@ -0,0 +1,22 @@
using Volo.Abp.Identity;
namespace EventHub.Users
{
public static class EventHubIdentityUserExtensions
{
public static string GetFullNameOrUsername(this IdentityUser user)
{
if (!string.IsNullOrWhiteSpace(user.Name) && !string.IsNullOrWhiteSpace(user.Surname))
{
return user.Name + " " + user.Surname;
}
if (!string.IsNullOrWhiteSpace(user.Name))
{
return user.Name;
}
return user.UserName;
}
}
}

16
src/EventHub.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/EventHubEntityFrameworkCoreDbMigrationsModule.cs

@ -1,16 +0,0 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
namespace EventHub.EntityFrameworkCore
{
[DependsOn(
typeof(EventHubEntityFrameworkCoreModule)
)]
public class EventHubEntityFrameworkCoreDbMigrationsModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAbpDbContext<EventHubMigrationsDbContext>();
}
}
}

47
src/EventHub.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/EventHubMigrationsDbContext.cs

@ -1,47 +0,0 @@
using EventHub.Events.Registrations;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.BackgroundJobs.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Identity;
using Volo.Abp.Identity.EntityFrameworkCore;
using Volo.Abp.IdentityServer.EntityFrameworkCore;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Abp.BlobStoring.Database.EntityFrameworkCore;
namespace EventHub.EntityFrameworkCore
{
/* This DbContext is only used for database migrations.
* It is not used on runtime. See EventHubDbContext for the runtime DbContext.
* It is a unified model that includes configuration for
* all used modules and your application.
*/
public class EventHubMigrationsDbContext : AbpDbContext<EventHubMigrationsDbContext>
{
public EventHubMigrationsDbContext(DbContextOptions<EventHubMigrationsDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
/* Include modules to your migration db context */
builder.ConfigurePermissionManagement();
builder.ConfigureSettingManagement();
builder.ConfigureBackgroundJobs();
builder.ConfigureAuditLogging();
builder.ConfigureIdentity();
builder.ConfigureIdentityServer();
/* Configure your own tables/entities inside the ConfigureEventHub method */
builder.ConfigureEventHub(true);
builder.ConfigureBlobStoring();
}
}
}

18
src/EventHub.EntityFrameworkCore.DbMigrations/EventHub.EntityFrameworkCore.DbMigrations.csproj

@ -1,18 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>EventHub</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\EventHub.EntityFrameworkCore\EventHub.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.*" />
</ItemGroup>
</Project>

2636
src/EventHub.EntityFrameworkCore.DbMigrations/Migrations/20210421100913_Initial.Designer.cs

File diff suppressed because it is too large

2639
src/EventHub.EntityFrameworkCore.DbMigrations/Migrations/20210428213802_Added_CountryName_To_Event.Designer.cs

File diff suppressed because it is too large

23
src/EventHub.EntityFrameworkCore.DbMigrations/Migrations/20210428213802_Added_CountryName_To_Event.cs

@ -1,23 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace EventHub.Migrations
{
public partial class Added_CountryName_To_Event : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "CountryName",
table: "EhEvents",
type: "text",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CountryName",
table: "EhEvents");
}
}
}

35
src/EventHub.EntityFrameworkCore.DbMigrations/Migrations/20210614064205_Moved_IsTimingChangeEmailSent_To_Event.cs

@ -1,35 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace EventHub.Migrations
{
public partial class Moved_IsTimingChangeEmailSent_To_Event : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsTimingChangeEmailSent",
table: "EhEventRegistrations");
migrationBuilder.AddColumn<bool>(
name: "IsTimingChangeEmailSent",
table: "EhEvents",
type: "boolean",
nullable: false,
defaultValue: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsTimingChangeEmailSent",
table: "EhEvents");
migrationBuilder.AddColumn<bool>(
name: "IsTimingChangeEmailSent",
table: "EhEventRegistrations",
type: "boolean",
nullable: false,
defaultValue: true);
}
}
}

2
src/EventHub.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/EntityFrameworkCoreEventHubDbSchemaMigrator.cs → src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreEventHubDbSchemaMigrator.cs

@ -27,7 +27,7 @@ namespace EventHub.EntityFrameworkCore
*/ */
await _serviceProvider await _serviceProvider
.GetRequiredService<EventHubMigrationsDbContext>() .GetRequiredService<EventHubDbContext>()
.Database .Database
.MigrateAsync(); .MigrateAsync();
} }

50
src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EventHubDbContext.cs

@ -4,12 +4,16 @@ using EventHub.Events.Registrations;
using EventHub.Organizations; using EventHub.Organizations;
using EventHub.Organizations.Memberships; using EventHub.Organizations.Memberships;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using EventHub.Users; using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.BackgroundJobs.EntityFrameworkCore;
using Volo.Abp.BlobStoring.Database.EntityFrameworkCore;
using Volo.Abp.Data; using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.Modeling;
using Volo.Abp.Identity; using Volo.Abp.Identity;
using Volo.Abp.Users.EntityFrameworkCore; using Volo.Abp.Identity.EntityFrameworkCore;
using Volo.Abp.IdentityServer.EntityFrameworkCore;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
namespace EventHub.EntityFrameworkCore namespace EventHub.EntityFrameworkCore
{ {
@ -23,14 +27,26 @@ namespace EventHub.EntityFrameworkCore
* used modules (as explained above). See EventHubMigrationsDbContext for migrations. * used modules (as explained above). See EventHubMigrationsDbContext for migrations.
*/ */
[ConnectionStringName("Default")] [ConnectionStringName("Default")]
public class EventHubDbContext : AbpDbContext<EventHubDbContext> public class EventHubDbContext :
AbpDbContext<EventHubDbContext>,
IIdentityDbContext
{ {
public DbSet<AppUser> Users { get; set; }
public DbSet<Organization> Organizations { get; set; } public DbSet<Organization> Organizations { get; set; }
public DbSet<OrganizationMembership> OrganizationMemberships { get; set; } public DbSet<OrganizationMembership> OrganizationMemberships { get; set; }
public DbSet<Event> Events { get; set; } public DbSet<Event> Events { get; set; }
public DbSet<EventRegistration> EventRegistrations { get; set; } public DbSet<EventRegistration> EventRegistrations { get; set; }
public DbSet<Country> Countries { get; set; } public DbSet<Country> Countries { get; set; }
#region Entities from the used modules
public DbSet<IdentityUser> Users { get; set; }
public DbSet<IdentityRole> Roles { get; set; }
public DbSet<IdentityClaimType> ClaimTypes { get; set; }
public DbSet<OrganizationUnit> OrganizationUnits { get; set; }
public DbSet<IdentitySecurityLog> SecurityLogs { get; set; }
public DbSet<IdentityLinkUser> LinkUsers { get; set; }
#endregion
public EventHubDbContext(DbContextOptions<EventHubDbContext> options) public EventHubDbContext(DbContextOptions<EventHubDbContext> options)
: base(options) : base(options)
@ -42,23 +58,15 @@ namespace EventHub.EntityFrameworkCore
{ {
base.OnModelCreating(builder); base.OnModelCreating(builder);
/* Configure the shared tables (with included modules) here */ builder.ConfigurePermissionManagement();
builder.ConfigureSettingManagement();
builder.Entity<AppUser>(b => builder.ConfigureBackgroundJobs();
{ builder.ConfigureAuditLogging();
b.ToTable(AbpIdentityDbProperties.DbTablePrefix + "Users"); //Sharing the same table "AbpUsers" with the IdentityUser builder.ConfigureIdentity();
builder.ConfigureIdentityServer();
b.ConfigureByConvention(); builder.ConfigureBlobStoring();
b.ConfigureAbpUser();
/* Configure mappings for your additional properties
* Also see the EventHubEfCoreEntityExtensionMappings class
*/
});
/* Configure your own tables/entities inside the ConfigureEventHub method */
builder.ConfigureEventHub(false); builder.ConfigureEventHub();
} }
} }
} }

8
src/EventHub.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/EventHubMigrationsDbContextFactory.cs → src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EventHubDbContextFactory.cs

@ -7,18 +7,18 @@ namespace EventHub.EntityFrameworkCore
{ {
/* This class is needed for EF Core console commands /* This class is needed for EF Core console commands
* (like Add-Migration and Update-Database commands) */ * (like Add-Migration and Update-Database commands) */
public class EventHubMigrationsDbContextFactory : IDesignTimeDbContextFactory<EventHubMigrationsDbContext> public class EventHubDbContextFactory : IDesignTimeDbContextFactory<EventHubDbContext>
{ {
public EventHubMigrationsDbContext CreateDbContext(string[] args) public EventHubDbContext CreateDbContext(string[] args)
{ {
EventHubEfCoreEntityExtensionMappings.Configure(); EventHubEfCoreEntityExtensionMappings.Configure();
var configuration = BuildConfiguration(); var configuration = BuildConfiguration();
var builder = new DbContextOptionsBuilder<EventHubMigrationsDbContext>() var builder = new DbContextOptionsBuilder<EventHubDbContext>()
.UseNpgsql(configuration.GetConnectionString("Default")); .UseNpgsql(configuration.GetConnectionString("Default"));
return new EventHubMigrationsDbContext(builder.Options); return new EventHubDbContext(builder.Options);
} }
private static IConfigurationRoot BuildConfiguration() private static IConfigurationRoot BuildConfiguration()

22
src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EventHubDbContextModelCreatingExtensions.cs

@ -12,9 +12,7 @@ namespace EventHub.EntityFrameworkCore
{ {
public static class EventHubDbContextModelCreatingExtensions public static class EventHubDbContextModelCreatingExtensions
{ {
public static void ConfigureEventHub( public static void ConfigureEventHub(this ModelBuilder builder)
this ModelBuilder builder,
bool isMigrationDbContext)
{ {
Check.NotNull(builder, nameof(builder)); Check.NotNull(builder, nameof(builder));
@ -29,11 +27,7 @@ namespace EventHub.EntityFrameworkCore
b.Property(x => x.Name).IsRequired().HasMaxLength(OrganizationConsts.MaxNameLength); b.Property(x => x.Name).IsRequired().HasMaxLength(OrganizationConsts.MaxNameLength);
b.Property(x => x.DisplayName).IsRequired().HasMaxLength(OrganizationConsts.MaxDisplayNameLength); b.Property(x => x.DisplayName).IsRequired().HasMaxLength(OrganizationConsts.MaxDisplayNameLength);
b.Property(x => x.Description).IsRequired().HasMaxLength(OrganizationConsts.MaxDescriptionNameLength); b.Property(x => x.Description).IsRequired().HasMaxLength(OrganizationConsts.MaxDescriptionNameLength);
b.HasOne<IdentityUser>().WithMany().HasForeignKey(x => x.OwnerUserId).IsRequired().OnDelete(DeleteBehavior.NoAction);
if (isMigrationDbContext)
{
b.HasOne<IdentityUser>().WithMany().HasForeignKey(x => x.OwnerUserId).IsRequired().OnDelete(DeleteBehavior.NoAction);
}
b.HasIndex(x => x.Name); b.HasIndex(x => x.Name);
b.HasIndex(x => x.DisplayName); b.HasIndex(x => x.DisplayName);
@ -46,11 +40,7 @@ namespace EventHub.EntityFrameworkCore
b.ConfigureByConvention(); b.ConfigureByConvention();
b.HasOne<Organization>().WithMany().HasForeignKey(x => x.OrganizationId).IsRequired().OnDelete(DeleteBehavior.NoAction); b.HasOne<Organization>().WithMany().HasForeignKey(x => x.OrganizationId).IsRequired().OnDelete(DeleteBehavior.NoAction);
b.HasOne<IdentityUser>().WithMany().HasForeignKey(x => x.UserId).IsRequired().OnDelete(DeleteBehavior.NoAction);
if (isMigrationDbContext)
{
b.HasOne<IdentityUser>().WithMany().HasForeignKey(x => x.UserId).IsRequired().OnDelete(DeleteBehavior.NoAction);
}
b.HasIndex(x => new {x.OrganizationId, x.UserId}); b.HasIndex(x => new {x.OrganizationId, x.UserId});
}); });
@ -89,11 +79,7 @@ namespace EventHub.EntityFrameworkCore
b.ConfigureByConvention(); b.ConfigureByConvention();
b.HasOne<Event>().WithMany().HasForeignKey(x => x.EventId).IsRequired().OnDelete(DeleteBehavior.NoAction); b.HasOne<Event>().WithMany().HasForeignKey(x => x.EventId).IsRequired().OnDelete(DeleteBehavior.NoAction);
b.HasOne<IdentityUser>().WithMany().HasForeignKey(x => x.UserId).IsRequired().OnDelete(DeleteBehavior.NoAction);
if (isMigrationDbContext)
{
b.HasOne<IdentityUser>().WithMany().HasForeignKey(x => x.UserId).IsRequired().OnDelete(DeleteBehavior.NoAction);
}
b.HasIndex(x => new {x.EventId, x.UserId}); b.HasIndex(x => new {x.EventId, x.UserId});
}); });

2
src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EventHubEntityFrameworkCoreModule.cs

@ -34,6 +34,8 @@ namespace EventHub.EntityFrameworkCore
{ {
context.Services.AddAbpDbContext<EventHubDbContext>(options => context.Services.AddAbpDbContext<EventHubDbContext>(options =>
{ {
options.ReplaceDbContext<IIdentityDbContext>();
/* Remove "includeAllEntities: true" to create /* Remove "includeAllEntities: true" to create
* default repositories only for aggregate roots */ * default repositories only for aggregate roots */
options.AddDefaultRepositories(includeAllEntities: true); options.AddDefaultRepositories(includeAllEntities: true);

4
src/EventHub.EntityFrameworkCore/EventHub.EntityFrameworkCore.csproj

@ -7,6 +7,10 @@
<RootNamespace>EventHub</RootNamespace> <RootNamespace>EventHub</RootNamespace>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.*" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.BlobStoring.Database.EntityFrameworkCore" Version="4.2.1" /> <PackageReference Include="Volo.Abp.BlobStoring.Database.EntityFrameworkCore" Version="4.2.1" />
<ProjectReference Include="..\EventHub.Domain\EventHub.Domain.csproj" /> <ProjectReference Include="..\EventHub.Domain\EventHub.Domain.csproj" />

17
src/EventHub.EntityFrameworkCore.DbMigrations/Migrations/20210614064205_Moved_IsTimingChangeEmailSent_To_Event.Designer.cs → src/EventHub.EntityFrameworkCore/Migrations/20210623133429_Initial.Designer.cs

@ -10,9 +10,9 @@ using Volo.Abp.EntityFrameworkCore;
namespace EventHub.Migrations namespace EventHub.Migrations
{ {
[DbContext(typeof(EventHubMigrationsDbContext))] [DbContext(typeof(EventHubDbContext))]
[Migration("20210614064205_Moved_IsTimingChangeEmailSent_To_Event")] [Migration("20210623133429_Initial")]
partial class Moved_IsTimingChangeEmailSent_To_Event partial class Initial
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
@ -26,7 +26,6 @@ namespace EventHub.Migrations
modelBuilder.Entity("EventHub.Countries.Country", b => modelBuilder.Entity("EventHub.Countries.Country", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<string>("Name") b.Property<string>("Name")
@ -44,7 +43,6 @@ namespace EventHub.Migrations
modelBuilder.Entity("EventHub.Events.Event", b => modelBuilder.Entity("EventHub.Events.Event", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<int?>("Capacity") b.Property<int?>("Capacity")
@ -174,7 +172,6 @@ namespace EventHub.Migrations
modelBuilder.Entity("EventHub.Events.Registrations.EventRegistration", b => modelBuilder.Entity("EventHub.Events.Registrations.EventRegistration", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
@ -213,7 +210,6 @@ namespace EventHub.Migrations
modelBuilder.Entity("EventHub.Organizations.Memberships.OrganizationMembership", b => modelBuilder.Entity("EventHub.Organizations.Memberships.OrganizationMembership", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
@ -252,7 +248,6 @@ namespace EventHub.Migrations
modelBuilder.Entity("EventHub.Organizations.Organization", b => modelBuilder.Entity("EventHub.Organizations.Organization", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
@ -728,7 +723,6 @@ namespace EventHub.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
@ -775,7 +769,6 @@ namespace EventHub.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<Guid?>("SourceTenantId") b.Property<Guid?>("SourceTenantId")
@ -801,7 +794,6 @@ namespace EventHub.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
@ -878,7 +870,6 @@ namespace EventHub.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<string>("Action") b.Property<string>("Action")
@ -953,7 +944,6 @@ namespace EventHub.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<int>("AccessFailedCount") b.Property<int>("AccessFailedCount")
@ -1233,7 +1223,6 @@ namespace EventHub.Migrations
modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<string>("Code") b.Property<string>("Code")

3159
src/EventHub.EntityFrameworkCore.DbMigrations/Migrations/20210421100913_Initial.cs → src/EventHub.EntityFrameworkCore/Migrations/20210623133429_Initial.cs

File diff suppressed because it is too large

15
src/EventHub.EntityFrameworkCore.DbMigrations/Migrations/EventHubMigrationsDbContextModelSnapshot.cs → src/EventHub.EntityFrameworkCore/Migrations/EventHubDbContextModelSnapshot.cs

@ -9,8 +9,8 @@ using Volo.Abp.EntityFrameworkCore;
namespace EventHub.Migrations namespace EventHub.Migrations
{ {
[DbContext(typeof(EventHubMigrationsDbContext))] [DbContext(typeof(EventHubDbContext))]
partial class EventHubMigrationsDbContextModelSnapshot : ModelSnapshot partial class EventHubDbContextModelSnapshot : ModelSnapshot
{ {
protected override void BuildModel(ModelBuilder modelBuilder) protected override void BuildModel(ModelBuilder modelBuilder)
{ {
@ -24,7 +24,6 @@ namespace EventHub.Migrations
modelBuilder.Entity("EventHub.Countries.Country", b => modelBuilder.Entity("EventHub.Countries.Country", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<string>("Name") b.Property<string>("Name")
@ -42,7 +41,6 @@ namespace EventHub.Migrations
modelBuilder.Entity("EventHub.Events.Event", b => modelBuilder.Entity("EventHub.Events.Event", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<int?>("Capacity") b.Property<int?>("Capacity")
@ -172,7 +170,6 @@ namespace EventHub.Migrations
modelBuilder.Entity("EventHub.Events.Registrations.EventRegistration", b => modelBuilder.Entity("EventHub.Events.Registrations.EventRegistration", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
@ -211,7 +208,6 @@ namespace EventHub.Migrations
modelBuilder.Entity("EventHub.Organizations.Memberships.OrganizationMembership", b => modelBuilder.Entity("EventHub.Organizations.Memberships.OrganizationMembership", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
@ -250,7 +246,6 @@ namespace EventHub.Migrations
modelBuilder.Entity("EventHub.Organizations.Organization", b => modelBuilder.Entity("EventHub.Organizations.Organization", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
@ -726,7 +721,6 @@ namespace EventHub.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
@ -773,7 +767,6 @@ namespace EventHub.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<Guid?>("SourceTenantId") b.Property<Guid?>("SourceTenantId")
@ -799,7 +792,6 @@ namespace EventHub.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
@ -876,7 +868,6 @@ namespace EventHub.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<string>("Action") b.Property<string>("Action")
@ -951,7 +942,6 @@ namespace EventHub.Migrations
modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<int>("AccessFailedCount") b.Property<int>("AccessFailedCount")
@ -1231,7 +1221,6 @@ namespace EventHub.Migrations
modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<string>("Code") b.Property<string>("Code")

2
src/EventHub.HttpApi.Host/EventHub.HttpApi.Host.csproj

@ -25,7 +25,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\EventHub.Application\EventHub.Application.csproj" /> <ProjectReference Include="..\EventHub.Application\EventHub.Application.csproj" />
<ProjectReference Include="..\EventHub.HttpApi\EventHub.HttpApi.csproj" /> <ProjectReference Include="..\EventHub.HttpApi\EventHub.HttpApi.csproj" />
<ProjectReference Include="..\EventHub.EntityFrameworkCore.DbMigrations\EventHub.EntityFrameworkCore.DbMigrations.csproj" /> <ProjectReference Include="..\EventHub.EntityFrameworkCore\EventHub.EntityFrameworkCore.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

2
src/EventHub.HttpApi.Host/EventHubHttpApiHostModule.cs

@ -33,7 +33,7 @@ namespace EventHub
[DependsOn( [DependsOn(
typeof(EventHubApplicationModule), typeof(EventHubApplicationModule),
typeof(EventHubHttpApiModule), typeof(EventHubHttpApiModule),
typeof(EventHubEntityFrameworkCoreDbMigrationsModule), typeof(EventHubEntityFrameworkCoreModule),
typeof(AbpAutofacModule), typeof(AbpAutofacModule),
typeof(AbpCachingStackExchangeRedisModule), typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpAspNetCoreSerilogModule), typeof(AbpAspNetCoreSerilogModule),

5
src/EventHub.IdentityServer/EventHub.IdentityServer.csproj

@ -45,7 +45,10 @@
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="4.2.1" /> <PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="4.2.1" />
<PackageReference Include="Volo.Abp.Account.Web.IdentityServer" Version="4.2.1" /> <PackageReference Include="Volo.Abp.Account.Web.IdentityServer" Version="4.2.1" />
<PackageReference Include="Volo.Abp.Account.Application" Version="4.2.1" /> <PackageReference Include="Volo.Abp.Account.Application" Version="4.2.1" />
<ProjectReference Include="..\EventHub.EntityFrameworkCore.DbMigrations\EventHub.EntityFrameworkCore.DbMigrations.csproj" /> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EventHub.EntityFrameworkCore\EventHub.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\EventHub.Web.Theme\EventHub.Web.Theme.csproj" /> <ProjectReference Include="..\EventHub.Web.Theme\EventHub.Web.Theme.csproj" />
</ItemGroup> </ItemGroup>

2
src/EventHub.IdentityServer/EventHubIdentityServerModule.cs

@ -39,7 +39,7 @@ namespace EventHub
typeof(AbpAccountWebIdentityServerModule), typeof(AbpAccountWebIdentityServerModule),
typeof(AbpAccountApplicationModule), typeof(AbpAccountApplicationModule),
typeof(EventHubWebThemeModule), typeof(EventHubWebThemeModule),
typeof(EventHubEntityFrameworkCoreDbMigrationsModule), typeof(EventHubEntityFrameworkCoreModule),
typeof(AbpAspNetCoreSerilogModule) typeof(AbpAspNetCoreSerilogModule)
)] )]
public class EventHubIdentityServerModule : AbpModule public class EventHubIdentityServerModule : AbpModule

6
test/EventHub.EntityFrameworkCore.Tests/EntityFrameworkCore/EventHubEntityFrameworkCoreTestModule.cs

@ -11,7 +11,7 @@ using Volo.Abp.Modularity;
namespace EventHub.EntityFrameworkCore namespace EventHub.EntityFrameworkCore
{ {
[DependsOn( [DependsOn(
typeof(EventHubEntityFrameworkCoreDbMigrationsModule), typeof(EventHubEntityFrameworkCoreModule),
typeof(EventHubTestBaseModule), typeof(EventHubTestBaseModule),
typeof(AbpEntityFrameworkCoreSqliteModule) typeof(AbpEntityFrameworkCoreSqliteModule)
)] )]
@ -47,11 +47,11 @@ namespace EventHub.EntityFrameworkCore
var connection = new SqliteConnection("Data Source=:memory:"); var connection = new SqliteConnection("Data Source=:memory:");
connection.Open(); connection.Open();
var options = new DbContextOptionsBuilder<EventHubMigrationsDbContext>() var options = new DbContextOptionsBuilder<EventHubDbContext>()
.UseSqlite(connection) .UseSqlite(connection)
.Options; .Options;
using (var context = new EventHubMigrationsDbContext(options)) using (var context = new EventHubDbContext(options))
{ {
context.GetService<IRelationalDatabaseCreator>().CreateTables(); context.GetService<IRelationalDatabaseCreator>().CreateTables();
} }

2
test/EventHub.EntityFrameworkCore.Tests/EventHub.EntityFrameworkCore.Tests.csproj

@ -8,7 +8,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\src\EventHub.EntityFrameworkCore.DbMigrations\EventHub.EntityFrameworkCore.DbMigrations.csproj" /> <ProjectReference Include="..\..\src\EventHub.EntityFrameworkCore\EventHub.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\EventHub.TestBase\EventHub.TestBase.csproj" /> <ProjectReference Include="..\EventHub.TestBase\EventHub.TestBase.csproj" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.Sqlite" Version="4.2.1" /> <PackageReference Include="Volo.Abp.EntityFrameworkCore.Sqlite" Version="4.2.1" />
</ItemGroup> </ItemGroup>

9
test/EventHub.TestBase/EventHubTestBase.cs

@ -2,7 +2,6 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using EventHub.Events; using EventHub.Events;
using EventHub.Organizations; using EventHub.Organizations;
using EventHub.Users;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities;
@ -125,20 +124,20 @@ namespace EventHub
return @event; return @event;
} }
protected virtual async Task<AppUser> GetUserOrNullAsync(Guid id) protected virtual async Task<IdentityUser> GetUserOrNullAsync(Guid id)
{ {
var userRepository = GetRequiredService<IRepository<AppUser, Guid>>(); var userRepository = GetRequiredService<IRepository<IdentityUser, Guid>>();
return await WithUnitOfWorkAsync( return await WithUnitOfWorkAsync(
() => userRepository.FindAsync(id) () => userRepository.FindAsync(id)
); );
} }
protected virtual async Task<AppUser> GetUserAsync(Guid id) protected virtual async Task<IdentityUser> GetUserAsync(Guid id)
{ {
var user = await GetUserOrNullAsync(id); var user = await GetUserOrNullAsync(id);
if (user == null) if (user == null)
{ {
throw new EntityNotFoundException(typeof(AppUser), id); throw new EntityNotFoundException(typeof(IdentityUser), id);
} }
return user; return user;

Loading…
Cancel
Save