mirror of https://github.com/EasyAbp/EShop.git
237 changed files with 2611 additions and 362 deletions
@ -1,10 +0,0 @@ |
|||||
using Volo.Abp.Localization; |
|
||||
|
|
||||
namespace EasyAbp.EShop.Baskets.Localization |
|
||||
{ |
|
||||
[LocalizationResourceName("EasyAbpEShopBaskets")] |
|
||||
public class BasketsResource |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
@ -1,40 +0,0 @@ |
|||||
using System; |
|
||||
using JetBrains.Annotations; |
|
||||
using Volo.Abp.Domain.Entities.Auditing; |
|
||||
using Volo.Abp.MultiTenancy; |
|
||||
|
|
||||
namespace EasyAbp.EShop.Baskets.BasketItems |
|
||||
{ |
|
||||
public class BasketItem : CreationAuditedAggregateRoot<Guid>, IMultiTenant |
|
||||
{ |
|
||||
public virtual Guid? TenantId { get; protected set; } |
|
||||
|
|
||||
public virtual string BasketLabel { get; protected set; } |
|
||||
|
|
||||
public virtual Guid UserId { get; protected set; } |
|
||||
|
|
||||
public virtual Guid ProductId { get; protected set; } |
|
||||
|
|
||||
public virtual Guid ProductSkuId { get; protected set; } |
|
||||
|
|
||||
public virtual int Quantity { get; protected set; } |
|
||||
|
|
||||
[CanBeNull] |
|
||||
public virtual string MediaResources { get; protected set; } |
|
||||
|
|
||||
[NotNull] |
|
||||
public virtual string ProductName { get; protected set; } |
|
||||
|
|
||||
[NotNull] |
|
||||
public virtual string SkuDescription { get; protected set; } |
|
||||
|
|
||||
[NotNull] |
|
||||
public virtual string Currency { get; protected set; } |
|
||||
|
|
||||
public virtual decimal UnitPrice { get; protected set; } |
|
||||
|
|
||||
public virtual decimal TotalPrice { get; protected set; } |
|
||||
|
|
||||
public virtual decimal TotalDiscount { get; protected set; } |
|
||||
} |
|
||||
} |
|
||||
@ -1,11 +0,0 @@ |
|||||
namespace EasyAbp.EShop.Baskets |
|
||||
{ |
|
||||
public static class BasketsDbProperties |
|
||||
{ |
|
||||
public static string DbTablePrefix { get; set; } = "EShopBaskets"; |
|
||||
|
|
||||
public static string DbSchema { get; set; } = null; |
|
||||
|
|
||||
public const string ConnectionStringName = "EShopBaskets"; |
|
||||
} |
|
||||
} |
|
||||
@ -1,12 +0,0 @@ |
|||||
using Volo.Abp.Modularity; |
|
||||
|
|
||||
namespace EasyAbp.EShop.Baskets |
|
||||
{ |
|
||||
[DependsOn( |
|
||||
typeof(EShopBasketsDomainSharedModule) |
|
||||
)] |
|
||||
public class EShopBasketsDomainModule : AbpModule |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
@page |
|
||||
@inherits EasyAbp.EShop.Baskets.Web.Pages.BasketsPage |
|
||||
@model EasyAbp.EShop.Baskets.Web.Pages.EShop.Baskets.IndexModel |
|
||||
@{ |
|
||||
} |
|
||||
<h1>Baskets</h1> |
|
||||
<p>A sample page for the Baskets module.</p> |
|
||||
@ -1,13 +0,0 @@ |
|||||
using Volo.Abp.Modularity; |
|
||||
|
|
||||
namespace EasyAbp.EShop.Baskets |
|
||||
{ |
|
||||
[DependsOn( |
|
||||
typeof(EShopBasketsApplicationModule), |
|
||||
typeof(EShopBasketsDomainTestModule) |
|
||||
)] |
|
||||
public class EShopBasketsApplicationTestModule : AbpModule |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
@ -1,16 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
|
|
||||
<Import Project="..\..\..\..\common.props" /> |
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework> |
|
||||
<RootNamespace>EasyAbp.EShop.Baskets</RootNamespace> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<ProjectReference Include="..\..\src\EasyAbp.EShop.Baskets.Application\EasyAbp.EShop.Baskets.Application.csproj" /> |
|
||||
<ProjectReference Include="..\EasyAbp.EShop.Baskets.Domain.Tests\EasyAbp.EShop.Baskets.Domain.Tests.csproj" /> |
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
</Project> |
|
||||
@ -0,0 +1,13 @@ |
|||||
|
version: '3.4' |
||||
|
|
||||
|
services: |
||||
|
migrations: |
||||
|
build: |
||||
|
context: ../../ |
||||
|
dockerfile: templates/service/database/Dockerfile |
||||
|
depends_on: |
||||
|
- sqlserver |
||||
|
environment: |
||||
|
- IdentityServer_DB=Plugins_Identity |
||||
|
- Plugins_DB=Plugins_ModuleDb |
||||
|
- SA_PASSWORD=yourStrong(!)Password |
||||
@ -0,0 +1,29 @@ |
|||||
|
version: '3.4' |
||||
|
|
||||
|
services: |
||||
|
sqlserver: |
||||
|
environment: |
||||
|
- SA_PASSWORD=yourStrong(!)Password |
||||
|
- ACCEPT_EULA=Y |
||||
|
ports: |
||||
|
- "51599:1433" |
||||
|
|
||||
|
identity-server: |
||||
|
environment: |
||||
|
- ASPNETCORE_URLS=http://0.0.0.0:80 |
||||
|
- ConnectionStrings__Default=Server=sqlserver;Database=Plugins_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false |
||||
|
- ConnectionStrings__SqlServerCache=Server=sqlserver;Database=Plugins_Cache;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false |
||||
|
ports: |
||||
|
- "51600:80" |
||||
|
|
||||
|
plugins: |
||||
|
environment: |
||||
|
- ASPNETCORE_URLS=http://0.0.0.0:80 |
||||
|
- ConnectionStrings__Default=Server=sqlserver;Database=Plugins_ModuleDb;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false |
||||
|
- ConnectionStrings__AbpSettingManagement=Server=sqlserver;Database=Plugins_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false |
||||
|
- ConnectionStrings__AbpPermissionManagement=Server=sqlserver;Database=Plugins_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false |
||||
|
- ConnectionStrings__AbpAuditLogging=Server=sqlserver;Database=Plugins_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false |
||||
|
- ConnectionStrings__SqlServerCache=Server=sqlserver;Database=Plugins_Cache;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false |
||||
|
- AuthServer__Authority=http://identity-server |
||||
|
ports: |
||||
|
- "51601:80" |
||||
@ -0,0 +1,19 @@ |
|||||
|
using EasyAbp.EShop.Plugins.Localization; |
||||
|
using Volo.Abp.Authorization.Permissions; |
||||
|
using Volo.Abp.Localization; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Plugins.Authorization |
||||
|
{ |
||||
|
public class PluginsPermissionDefinitionProvider : PermissionDefinitionProvider |
||||
|
{ |
||||
|
public override void Define(IPermissionDefinitionContext context) |
||||
|
{ |
||||
|
//var moduleGroup = context.AddGroup(PluginsPermissions.GroupName, L("Permission:Plugins"));
|
||||
|
} |
||||
|
|
||||
|
private static LocalizableString L(string name) |
||||
|
{ |
||||
|
return LocalizableString.Create<PluginsResource>(name); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
using Volo.Abp.Reflection; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Plugins.Authorization |
||||
|
{ |
||||
|
public class PluginsPermissions |
||||
|
{ |
||||
|
public const string GroupName = "EasyAbp.EShop.Plugins"; |
||||
|
|
||||
|
public static string[] GetAll() |
||||
|
{ |
||||
|
return ReflectionHelper.GetPublicConstantsRecursively(typeof(PluginsPermissions)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
using EasyAbp.EShop.Plugins.Localization; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Plugins |
||||
|
{ |
||||
|
public abstract class PluginsAppService : ApplicationService |
||||
|
{ |
||||
|
protected PluginsAppService() |
||||
|
{ |
||||
|
LocalizationResource = typeof(PluginsResource); |
||||
|
ObjectMapperContext = typeof(EShopPluginsApplicationModule); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
using AutoMapper; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Plugins |
||||
|
{ |
||||
|
public class PluginsApplicationAutoMapperProfile : Profile |
||||
|
{ |
||||
|
public PluginsApplicationAutoMapperProfile() |
||||
|
{ |
||||
|
/* You can configure your AutoMapper mapping configuration here. |
||||
|
* Alternatively, you can split your mapping configurations |
||||
|
* into multiple profile classes for a better organization. */ |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,37 @@ |
|||||
|
using Volo.Abp.Modularity; |
||||
|
using Volo.Abp.Localization; |
||||
|
using EasyAbp.EShop.Plugins.Localization; |
||||
|
using Volo.Abp.Localization.ExceptionHandling; |
||||
|
using Volo.Abp.Validation; |
||||
|
using Volo.Abp.Validation.Localization; |
||||
|
using Volo.Abp.VirtualFileSystem; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Plugins |
||||
|
{ |
||||
|
[DependsOn( |
||||
|
typeof(AbpValidationModule) |
||||
|
)] |
||||
|
public class EShopPluginsDomainSharedModule : AbpModule |
||||
|
{ |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
Configure<AbpVirtualFileSystemOptions>(options => |
||||
|
{ |
||||
|
options.FileSets.AddEmbedded<EShopPluginsDomainSharedModule>("EasyAbp.EShop.Plugins"); |
||||
|
}); |
||||
|
|
||||
|
Configure<AbpLocalizationOptions>(options => |
||||
|
{ |
||||
|
options.Resources |
||||
|
.Add<PluginsResource>("en") |
||||
|
.AddBaseTypes(typeof(AbpValidationResource)) |
||||
|
.AddVirtualJson("/Localization/Plugins"); |
||||
|
}); |
||||
|
|
||||
|
Configure<AbpExceptionLocalizationOptions>(options => |
||||
|
{ |
||||
|
options.MapCodeNamespace("Plugins", typeof(PluginsResource)); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
using Volo.Abp.Localization; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Plugins.Localization |
||||
|
{ |
||||
|
[LocalizationResourceName("EasyAbpEShopPlugins")] |
||||
|
public class PluginsResource |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
namespace EasyAbp.EShop.Plugins |
||||
|
{ |
||||
|
public static class PluginsErrorCodes |
||||
|
{ |
||||
|
//Add your business exception error codes here...
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
using Volo.Abp.Modularity; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Plugins |
||||
|
{ |
||||
|
[DependsOn( |
||||
|
typeof(EShopPluginsDomainSharedModule) |
||||
|
)] |
||||
|
public class EShopPluginsDomainModule : AbpModule |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
namespace EasyAbp.EShop.Plugins |
||||
|
{ |
||||
|
public static class PluginsDbProperties |
||||
|
{ |
||||
|
public static string DbTablePrefix { get; set; } = "EShopPlugins"; |
||||
|
|
||||
|
public static string DbSchema { get; set; } = null; |
||||
|
|
||||
|
public const string ConnectionStringName = "EShopPlugins"; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
using Volo.Abp.Settings; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Plugins.Settings |
||||
|
{ |
||||
|
public class PluginsSettingDefinitionProvider : SettingDefinitionProvider |
||||
|
{ |
||||
|
public override void Define(ISettingDefinitionContext context) |
||||
|
{ |
||||
|
/* Define module settings here. |
||||
|
* Use names from PluginsSettings class. |
||||
|
*/ |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
namespace EasyAbp.EShop.Plugins.Settings |
||||
|
{ |
||||
|
public static class PluginsSettings |
||||
|
{ |
||||
|
public const string GroupName = "EasyAbp.EShop.Plugins"; |
||||
|
|
||||
|
/* Add constants for setting names. Example: |
||||
|
* public const string MySettingName = GroupName + ".MySettingName"; |
||||
|
*/ |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Volo.Abp.EntityFrameworkCore; |
||||
|
using Volo.Abp.Modularity; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Plugins.EntityFrameworkCore |
||||
|
{ |
||||
|
[DependsOn( |
||||
|
typeof(EShopPluginsDomainModule), |
||||
|
typeof(AbpEntityFrameworkCoreModule) |
||||
|
)] |
||||
|
public class EShopPluginsEntityFrameworkCoreModule : AbpModule |
||||
|
{ |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
context.Services.AddAbpDbContext<PluginsDbContext>(options => |
||||
|
{ |
||||
|
/* Add custom repositories here. Example: |
||||
|
* options.AddRepository<Question, EfCoreQuestionRepository>(); |
||||
|
*/ |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
using Volo.Abp.Data; |
||||
|
using Volo.Abp.EntityFrameworkCore; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Plugins.EntityFrameworkCore |
||||
|
{ |
||||
|
[ConnectionStringName(PluginsDbProperties.ConnectionStringName)] |
||||
|
public interface IPluginsDbContext : IEfCoreDbContext |
||||
|
{ |
||||
|
/* Add DbSet for each Aggregate Root here. Example: |
||||
|
* DbSet<Question> Questions { get; } |
||||
|
*/ |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Volo.Abp.Data; |
||||
|
using Volo.Abp.EntityFrameworkCore; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Plugins.EntityFrameworkCore |
||||
|
{ |
||||
|
[ConnectionStringName(PluginsDbProperties.ConnectionStringName)] |
||||
|
public class PluginsDbContext : AbpDbContext<PluginsDbContext>, IPluginsDbContext |
||||
|
{ |
||||
|
/* Add DbSet for each Aggregate Root here. Example: |
||||
|
* public DbSet<Question> Questions { get; set; } |
||||
|
*/ |
||||
|
|
||||
|
public PluginsDbContext(DbContextOptions<PluginsDbContext> options) |
||||
|
: base(options) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
protected override void OnModelCreating(ModelBuilder builder) |
||||
|
{ |
||||
|
base.OnModelCreating(builder); |
||||
|
|
||||
|
builder.ConfigureEShopPlugins(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,43 @@ |
|||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Volo.Abp; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Plugins.EntityFrameworkCore |
||||
|
{ |
||||
|
public static class PluginsDbContextModelCreatingExtensions |
||||
|
{ |
||||
|
public static void ConfigureEShopPlugins( |
||||
|
this ModelBuilder builder, |
||||
|
Action<PluginsModelBuilderConfigurationOptions> optionsAction = null) |
||||
|
{ |
||||
|
Check.NotNull(builder, nameof(builder)); |
||||
|
|
||||
|
var options = new PluginsModelBuilderConfigurationOptions( |
||||
|
PluginsDbProperties.DbTablePrefix, |
||||
|
PluginsDbProperties.DbSchema |
||||
|
); |
||||
|
|
||||
|
optionsAction?.Invoke(options); |
||||
|
|
||||
|
/* Configure all entities here. Example: |
||||
|
|
||||
|
builder.Entity<Question>(b => |
||||
|
{ |
||||
|
//Configure table & schema name
|
||||
|
b.ToTable(options.TablePrefix + "Questions", options.Schema); |
||||
|
|
||||
|
b.ConfigureByConvention(); |
||||
|
|
||||
|
//Properties
|
||||
|
b.Property(q => q.Title).IsRequired().HasMaxLength(QuestionConsts.MaxTitleLength); |
||||
|
|
||||
|
//Relations
|
||||
|
b.HasMany(question => question.Tags).WithOne().HasForeignKey(qt => qt.QuestionId); |
||||
|
|
||||
|
//Indexes
|
||||
|
b.HasIndex(q => q.CreationTime); |
||||
|
}); |
||||
|
*/ |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,18 @@ |
|||||
|
using JetBrains.Annotations; |
||||
|
using Volo.Abp.EntityFrameworkCore.Modeling; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Plugins.EntityFrameworkCore |
||||
|
{ |
||||
|
public class PluginsModelBuilderConfigurationOptions : AbpModelBuilderConfigurationOptions |
||||
|
{ |
||||
|
public PluginsModelBuilderConfigurationOptions( |
||||
|
[NotNull] string tablePrefix = "", |
||||
|
[CanBeNull] string schema = null) |
||||
|
: base( |
||||
|
tablePrefix, |
||||
|
schema) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,33 @@ |
|||||
|
using Localization.Resources.AbpUi; |
||||
|
using EasyAbp.EShop.Plugins.Localization; |
||||
|
using Volo.Abp.AspNetCore.Mvc; |
||||
|
using Volo.Abp.Localization; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Plugins |
||||
|
{ |
||||
|
[DependsOn( |
||||
|
typeof(EShopPluginsApplicationContractsModule), |
||||
|
typeof(AbpAspNetCoreMvcModule))] |
||||
|
public class EShopPluginsHttpApiModule : AbpModule |
||||
|
{ |
||||
|
public override void PreConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
PreConfigure<IMvcBuilder>(mvcBuilder => |
||||
|
{ |
||||
|
mvcBuilder.AddApplicationPartIfNotExists(typeof(EShopPluginsHttpApiModule).Assembly); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
Configure<AbpLocalizationOptions>(options => |
||||
|
{ |
||||
|
options.Resources |
||||
|
.Get<PluginsResource>() |
||||
|
.AddBaseTypes(typeof(AbpUiResource)); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
using EasyAbp.EShop.Plugins.Localization; |
||||
|
using Volo.Abp.AspNetCore.Mvc; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Plugins |
||||
|
{ |
||||
|
public abstract class PluginsController : AbpController |
||||
|
{ |
||||
|
protected PluginsController() |
||||
|
{ |
||||
|
LocalizationResource = typeof(PluginsResource); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using Volo.Abp.MongoDB; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Plugins.MongoDB |
||||
|
{ |
||||
|
[DependsOn( |
||||
|
typeof(EShopPluginsDomainModule), |
||||
|
typeof(AbpMongoDbModule) |
||||
|
)] |
||||
|
public class EShopPluginsMongoDbModule : AbpModule |
||||
|
{ |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
context.Services.AddMongoDbContext<PluginsMongoDbContext>(options => |
||||
|
{ |
||||
|
/* Add custom repositories here. Example: |
||||
|
* options.AddRepository<Question, MongoQuestionRepository>(); |
||||
|
*/ |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
using Volo.Abp.Data; |
||||
|
using Volo.Abp.MongoDB; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Plugins.MongoDB |
||||
|
{ |
||||
|
[ConnectionStringName(PluginsDbProperties.ConnectionStringName)] |
||||
|
public interface IPluginsMongoDbContext : IAbpMongoDbContext |
||||
|
{ |
||||
|
/* Define mongo collections here. Example: |
||||
|
* IMongoCollection<Question> Questions { get; } |
||||
|
*/ |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
using Volo.Abp.Data; |
||||
|
using Volo.Abp.MongoDB; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Plugins.MongoDB |
||||
|
{ |
||||
|
[ConnectionStringName(PluginsDbProperties.ConnectionStringName)] |
||||
|
public class PluginsMongoDbContext : AbpMongoDbContext, IPluginsMongoDbContext |
||||
|
{ |
||||
|
/* Add mongo collections here. Example: |
||||
|
* public IMongoCollection<Question> Questions => Collection<Question>(); |
||||
|
*/ |
||||
|
|
||||
|
protected override void CreateModel(IMongoModelBuilder modelBuilder) |
||||
|
{ |
||||
|
base.CreateModel(modelBuilder); |
||||
|
|
||||
|
modelBuilder.ConfigureEShopPlugins(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.MongoDB; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Plugins.MongoDB |
||||
|
{ |
||||
|
public static class PluginsMongoDbContextExtensions |
||||
|
{ |
||||
|
public static void ConfigureEShopPlugins( |
||||
|
this IMongoModelBuilder builder, |
||||
|
Action<AbpMongoModelBuilderConfigurationOptions> optionsAction = null) |
||||
|
{ |
||||
|
Check.NotNull(builder, nameof(builder)); |
||||
|
|
||||
|
var options = new PluginsMongoModelBuilderConfigurationOptions( |
||||
|
PluginsDbProperties.DbTablePrefix |
||||
|
); |
||||
|
|
||||
|
optionsAction?.Invoke(options); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
using JetBrains.Annotations; |
||||
|
using Volo.Abp.MongoDB; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Plugins.MongoDB |
||||
|
{ |
||||
|
public class PluginsMongoModelBuilderConfigurationOptions : AbpMongoModelBuilderConfigurationOptions |
||||
|
{ |
||||
|
public PluginsMongoModelBuilderConfigurationOptions( |
||||
|
[NotNull] string collectionPrefix = "") |
||||
|
: base(collectionPrefix) |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,57 @@ |
|||||
|
using Microsoft.AspNetCore.Mvc.RazorPages; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using EasyAbp.EShop.Plugins.Localization; |
||||
|
using Volo.Abp.AspNetCore.Mvc.Localization; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; |
||||
|
using Volo.Abp.AutoMapper; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using Volo.Abp.UI.Navigation; |
||||
|
using Volo.Abp.VirtualFileSystem; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Plugins.Web |
||||
|
{ |
||||
|
[DependsOn( |
||||
|
typeof(EShopPluginsHttpApiModule), |
||||
|
typeof(AbpAspNetCoreMvcUiThemeSharedModule), |
||||
|
typeof(AbpAutoMapperModule) |
||||
|
)] |
||||
|
public class EShopPluginsWebModule : AbpModule |
||||
|
{ |
||||
|
public override void PreConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
context.Services.PreConfigure<AbpMvcDataAnnotationsLocalizationOptions>(options => |
||||
|
{ |
||||
|
options.AddAssemblyResource(typeof(PluginsResource), typeof(EShopPluginsWebModule).Assembly); |
||||
|
}); |
||||
|
|
||||
|
PreConfigure<IMvcBuilder>(mvcBuilder => |
||||
|
{ |
||||
|
mvcBuilder.AddApplicationPartIfNotExists(typeof(EShopPluginsWebModule).Assembly); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
Configure<AbpNavigationOptions>(options => |
||||
|
{ |
||||
|
options.MenuContributors.Add(new PluginsMenuContributor()); |
||||
|
}); |
||||
|
|
||||
|
Configure<AbpVirtualFileSystemOptions>(options => |
||||
|
{ |
||||
|
options.FileSets.AddEmbedded<EShopPluginsWebModule>("EasyAbp.EShop.Plugins.Web"); |
||||
|
}); |
||||
|
|
||||
|
context.Services.AddAutoMapperObjectMapper<EShopPluginsWebModule>(); |
||||
|
Configure<AbpAutoMapperOptions>(options => |
||||
|
{ |
||||
|
options.AddMaps<EShopPluginsWebModule>(validate: true); |
||||
|
}); |
||||
|
|
||||
|
Configure<RazorPagesOptions>(options => |
||||
|
{ |
||||
|
//Configure authorization.
|
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
@page |
||||
|
@inherits EasyAbp.EShop.Plugins.Web.Pages.PluginsPage |
||||
|
@model EasyAbp.EShop.Plugins.Web.Pages.EShop.Plugins.IndexModel |
||||
|
@{ |
||||
|
} |
||||
|
<h1>Plugins</h1> |
||||
|
<p>A sample page for the Plugins module.</p> |
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue