mirror of https://github.com/abpframework/abp.git
30 changed files with 78 additions and 256 deletions
@ -1,63 +0,0 @@ |
|||||
using System; |
|
||||
using Volo.Abp.Domain.Entities.Auditing; |
|
||||
using Volo.Abp.Users; |
|
||||
|
|
||||
namespace MyCompanyName.MyProjectName.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 MyProjectNameDbContext.OnModelCreating |
|
||||
* to configure the mapping for your new property |
|
||||
* 2. Update MyProjectNameEfCoreEntityExtensionMappings 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() |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,16 +0,0 @@ |
|||||
using Microsoft.Extensions.DependencyInjection; |
|
||||
using Volo.Abp.Modularity; |
|
||||
|
|
||||
namespace MyCompanyName.MyProjectName.EntityFrameworkCore |
|
||||
{ |
|
||||
[DependsOn( |
|
||||
typeof(MyProjectNameEntityFrameworkCoreModule) |
|
||||
)] |
|
||||
public class MyProjectNameEntityFrameworkCoreDbMigrationsModule : AbpModule |
|
||||
{ |
|
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
|
||||
{ |
|
||||
context.Services.AddAbpDbContext<MyProjectNameMigrationsDbContext>(); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,48 +0,0 @@ |
|||||
using Microsoft.EntityFrameworkCore; |
|
||||
using Volo.Abp.AuditLogging.EntityFrameworkCore; |
|
||||
using Volo.Abp.BackgroundJobs.EntityFrameworkCore; |
|
||||
using Volo.Abp.EntityFrameworkCore; |
|
||||
using Volo.Abp.FeatureManagement.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.TenantManagement.EntityFrameworkCore; |
|
||||
|
|
||||
namespace MyCompanyName.MyProjectName.EntityFrameworkCore |
|
||||
{ |
|
||||
/* This DbContext is only used for database migrations. |
|
||||
* It is not used on runtime. See MyProjectNameDbContext for the runtime DbContext. |
|
||||
* It is a unified model that includes configuration for |
|
||||
* all used modules and your application. |
|
||||
*/ |
|
||||
public class MyProjectNameMigrationsDbContext : AbpDbContext<MyProjectNameMigrationsDbContext> |
|
||||
{ |
|
||||
public MyProjectNameMigrationsDbContext(DbContextOptions<MyProjectNameMigrationsDbContext> 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(); |
|
||||
builder.ConfigureFeatureManagement(); |
|
||||
builder.ConfigureTenantManagement(); |
|
||||
|
|
||||
/* Configure your own tables/entities inside the ConfigureMyProjectName method */ |
|
||||
|
|
||||
builder.ConfigureMyProjectName(); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,21 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
|
|
||||
<Import Project="..\..\common.props" /> |
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>net5.0</TargetFramework> |
|
||||
<RootNamespace>MyCompanyName.MyProjectName</RootNamespace> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<ProjectReference Include="..\MyCompanyName.MyProjectName.EntityFrameworkCore\MyCompanyName.MyProjectName.EntityFrameworkCore.csproj" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.*"> |
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> |
|
||||
<PrivateAssets>compile; contentFiles; build; buildMultitargeting; buildTransitive; analyzers; native</PrivateAssets> |
|
||||
</PackageReference> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
</Project> |
|
||||
6
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/EntityFrameworkCoreMyProjectNameDbSchemaMigrator.cs → templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreMyProjectNameDbSchemaMigrator.cs
6
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/EntityFrameworkCoreMyProjectNameDbSchemaMigrator.cs → templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreMyProjectNameDbSchemaMigrator.cs
@ -1,22 +0,0 @@ |
|||||
using Microsoft.EntityFrameworkCore; |
|
||||
using Volo.Abp; |
|
||||
|
|
||||
namespace MyCompanyName.MyProjectName.EntityFrameworkCore |
|
||||
{ |
|
||||
public static class MyProjectNameDbContextModelCreatingExtensions |
|
||||
{ |
|
||||
public static void ConfigureMyProjectName(this ModelBuilder builder) |
|
||||
{ |
|
||||
Check.NotNull(builder, nameof(builder)); |
|
||||
|
|
||||
/* Configure your own tables/entities inside here */ |
|
||||
|
|
||||
//builder.Entity<YourEntity>(b =>
|
|
||||
//{
|
|
||||
// b.ToTable(MyProjectNameConsts.DbTablePrefix + "YourEntities", MyProjectNameConsts.DbSchema);
|
|
||||
// b.ConfigureByConvention(); //auto configure for the base class props
|
|
||||
// //...
|
|
||||
//});
|
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue