- Remove redundant PointsRule repositories (use single PointsRuleRepository) - Clean up Member migrations and consolidate to single Init migration - Update Console frontend API and components for Tenant - Add H5LinkService for member H5 integration
27 lines
1.2 KiB
C#
27 lines
1.2 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Design;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace Fengling.Member.Infrastructure;
|
|
|
|
public class DesignTimeApplicationDbContextFactory: IDesignTimeDbContextFactory<ApplicationDbContext>
|
|
{
|
|
public ApplicationDbContext CreateDbContext(string[] args)
|
|
{
|
|
IServiceCollection services = new ServiceCollection();
|
|
services.AddMediatR(c =>
|
|
c.RegisterServicesFromAssemblies(typeof(DesignTimeApplicationDbContextFactory).Assembly));
|
|
services.AddDbContext<ApplicationDbContext>(options =>
|
|
{
|
|
// change connectionstring if you want to run command “dotnet ef database update”
|
|
options.UseNpgsql("Host=192.168.100.10;Database=fengling_member;Username=movingsam;Password=sl52788542",
|
|
b =>
|
|
{
|
|
b.MigrationsAssembly(typeof(DesignTimeApplicationDbContextFactory).Assembly.FullName);
|
|
});
|
|
});
|
|
var provider = services.BuildServiceProvider();
|
|
var dbContext = provider.CreateScope().ServiceProvider.GetRequiredService<ApplicationDbContext>();
|
|
return dbContext;
|
|
}
|
|
} |