Skip to content

Commit 4f9a615

Browse files
committed
Removed unused code.
1 parent b08e283 commit 4f9a615

File tree

5 files changed

+11
-33
lines changed

5 files changed

+11
-33
lines changed

src/AbpCompanyName.AbpProjectName.EntityFramework/EntityFramework/AbpProjectNameDbContext.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ public class AbpProjectNameDbContext : AbpZeroDbContext<Tenant, Role, User>
1515
{
1616
/* Define an IDbSet for each entity of the application */
1717

18-
/* NOTE:
19-
* Setting "Default" to base class helps us when working migration commands on Package Manager Console.
20-
* But it may cause problems when working Migrate.exe of EF. If you will apply migrations on command line, do not
21-
* pass connection string name to base classes. ABP works either way.
22-
*/
2318
/* Default constructor is needed for EF command line tool. */
2419
public AbpProjectNameDbContext()
2520
: base(GetConnectionString())
@@ -38,7 +33,7 @@ private static string GetConnectionString()
3833
);
3934
}
4035

41-
/* This constructor is used by ABP to pass connection string defined in AbpProjectNameDataModule.PreInitialize.
36+
/* This constructor is used by ABP to pass connection string.
4237
* Notice that, actually you will not directly create an instance of AbpProjectNameDbContext since ABP automatically handles it.
4338
*/
4439
public AbpProjectNameDbContext(string nameOrConnectionString)

src/AbpCompanyName.AbpProjectName.Migrator/MultiTenantMigrateExecuter.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace AbpCompanyName.AbpProjectName.Migrator
1313
{
1414
public class MultiTenantMigrateExecuter : ITransientDependency
1515
{
16-
public Log Log { get; private set; }
16+
public Log Log { get; }
1717

1818
private readonly IAbpZeroDbMigrator _migrator;
1919
private readonly IRepository<Tenant> _tenantRepository;
@@ -61,7 +61,7 @@ public void Run(bool skipConnVerification)
6161
}
6262
catch (Exception ex)
6363
{
64-
Log.Write("An error occured during migration of host database:");
64+
Log.Write("An error occurred during migration of host database:");
6565
Log.Write(ex.ToString());
6666
Log.Write("Canceled migrations.");
6767
return;
@@ -75,7 +75,7 @@ public void Run(bool skipConnVerification)
7575
for (int i = 0; i < tenants.Count; i++)
7676
{
7777
var tenant = tenants[i];
78-
Log.Write(string.Format("Tenant database migration started... ({0} / {1})", (i + 1), tenants.Count));
78+
Log.Write($"Tenant database migration started... ({(i + 1)} / {tenants.Count})");
7979
Log.Write("Name : " + tenant.Name);
8080
Log.Write("TenancyName : " + tenant.TenancyName);
8181
Log.Write("Tenant Id : " + tenant.Id);
@@ -89,7 +89,7 @@ public void Run(bool skipConnVerification)
8989
}
9090
catch (Exception ex)
9191
{
92-
Log.Write("An error occured during migration of tenant database:");
92+
Log.Write("An error occurred during migration of tenant database:");
9393
Log.Write(ex.ToString());
9494
Log.Write("Skipped this tenant and will continue for others...");
9595
}
@@ -101,7 +101,7 @@ public void Run(bool skipConnVerification)
101101
Log.Write("This database has already migrated before (you have more than one tenant in same database). Skipping it....");
102102
}
103103

104-
Log.Write(string.Format("Tenant database migration completed. ({0} / {1})", (i + 1), tenants.Count));
104+
Log.Write($"Tenant database migration completed. ({(i + 1)} / {tenants.Count})");
105105
Log.Write("--------------------------------------------------------");
106106
}
107107

test/AbpCompanyName.AbpProjectName.Tests/AbpProjectNameTestBase.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ protected void UsingDbContext(Action<AbpProjectNameDbContext> action)
117117
UsingDbContext(AbpSession.TenantId, action);
118118
}
119119

120-
protected Task UsingDbContextAsync(Action<AbpProjectNameDbContext> action)
120+
protected Task UsingDbContextAsync(Func<AbpProjectNameDbContext, Task> action)
121121
{
122122
return UsingDbContextAsync(AbpSession.TenantId, action);
123123
}
@@ -145,14 +145,14 @@ protected void UsingDbContext(int? tenantId, Action<AbpProjectNameDbContext> act
145145
}
146146
}
147147

148-
protected async Task UsingDbContextAsync(int? tenantId, Action<AbpProjectNameDbContext> action)
148+
protected async Task UsingDbContextAsync(int? tenantId, Func<AbpProjectNameDbContext, Task> action)
149149
{
150150
using (UsingTenantId(tenantId))
151151
{
152152
using (var context = LocalIocManager.Resolve<AbpProjectNameDbContext>())
153153
{
154154
context.DisableAllFilters();
155-
action(context);
155+
await action(context);
156156
await context.SaveChangesAsync();
157157
}
158158
}

test/AbpCompanyName.AbpProjectName.Tests/AbpProjectNameTestModule.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public override void PreInitialize()
2020
{
2121
Configuration.UnitOfWork.Timeout = TimeSpan.FromMinutes(30);
2222

23+
Configuration.BackgroundJobs.IsJobExecutionEnabled = false;
24+
2325
//Use database for language management
2426
Configuration.Modules.Zero().LanguageManagement.EnableDbLocalization();
2527

test/AbpCompanyName.AbpProjectName.Tests/TestDatas/TestDataBuilder.cs

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)