Change object mapping style for the app startup template.

pull/3366/head
Halil İbrahim Kalkan 6 years ago
parent d93226fbac
commit 7fa67b1636

@ -1,4 +1,5 @@
using MyCompanyName.MyProjectName.MultiTenancy;
using MyCompanyName.MyProjectName.ObjectExtending;
using Volo.Abp.AuditLogging;
using Volo.Abp.BackgroundJobs;
using Volo.Abp.FeatureManagement;
@ -27,6 +28,11 @@ namespace MyCompanyName.MyProjectName
)]
public class MyProjectNameDomainModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
MyProjectNameDomainObjectExtensions.Configure();
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpMultiTenancyOptions>(options =>

@ -1,10 +1,8 @@
using Volo.Abp.Identity;
using Volo.Abp.ObjectExtending;
using Volo.Abp.Threading;
using Volo.Abp.Threading;
namespace MyCompanyName.MyProjectName.MongoDB
namespace MyCompanyName.MyProjectName.ObjectExtending
{
public static class MyProjectNameEntityExtensions
public static class MyProjectNameDomainObjectExtensions
{
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
@ -12,8 +10,11 @@ namespace MyCompanyName.MyProjectName.MongoDB
{
OneTimeRunner.Run(() =>
{
/* You can extension properties to entities
/* You can configure extension properties to entities or other object types
* defined in the depended modules.
*
* If you are using EF Core and want to map the entity extension properties to new
* table fields in the database, then configure them in the MyProjectNameEfCoreEntityExtensionMappings
*
* Example:
*
@ -21,7 +22,7 @@ namespace MyCompanyName.MyProjectName.MongoDB
* .AddOrUpdateProperty<IdentityRole, string>("Title");
*
* See the documentation for more:
* https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities
* https://docs.abp.io/en/abp/latest/Object-Extensions
*/
});
}

@ -48,7 +48,7 @@ namespace MyCompanyName.MyProjectName.Users
*
* 1. update MyProjectNameDbContext.OnModelCreating
* to configure the mapping for your new property
* 2. Update MyProjectNameEntityExtensions to extend the IdentityUser entity
* 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

@ -11,7 +11,7 @@ namespace MyCompanyName.MyProjectName.EntityFrameworkCore
{
public MyProjectNameMigrationsDbContext CreateDbContext(string[] args)
{
MyProjectNameEntityExtensions.Configure();
MyProjectNameEfCoreEntityExtensionMappings.Configure();
var configuration = BuildConfiguration();

@ -46,7 +46,7 @@ namespace MyCompanyName.MyProjectName.EntityFrameworkCore
b.ConfigureAbpUser();
/* Configure mappings for your additional properties
* Also see the MyProjectNameEntityExtensions class
* Also see the MyProjectNameEfCoreEntityExtensionMappings class
*/
});

@ -4,7 +4,7 @@ using Volo.Abp.Threading;
namespace MyCompanyName.MyProjectName.EntityFrameworkCore
{
public static class MyProjectNameEntityExtensions
public static class MyProjectNameEfCoreEntityExtensionMappings
{
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
@ -15,6 +15,11 @@ namespace MyCompanyName.MyProjectName.EntityFrameworkCore
/* You can configure entity extension properties for the
* entities defined in the used modules.
*
* The properties defined here becomes table fields.
* If you want to use the ExtraProperties dictionary of the entity
* instead of creating a new field, then define the property in the
* MyProjectNameDomainObjectExtensions class.
*
* Example:
*
* ObjectExtensionManager.Instance

@ -29,7 +29,7 @@ namespace MyCompanyName.MyProjectName.EntityFrameworkCore
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
MyProjectNameEntityExtensions.Configure();
MyProjectNameEfCoreEntityExtensionMappings.Configure();
}
public override void ConfigureServices(ServiceConfigurationContext context)

@ -24,11 +24,6 @@ namespace MyCompanyName.MyProjectName.MongoDB
)]
public class MyProjectNameMongoDbModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
MyProjectNameEntityExtensions.Configure();
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddMongoDbContext<MyProjectNameMongoDbContext>(options =>

Loading…
Cancel
Save