Commit 12b488dc authored by 樊国敬's avatar 樊国敬

edit

parent 8fedda00
...@@ -20,7 +20,7 @@ namespace HYH.Registry.Services.Encryption ...@@ -20,7 +20,7 @@ namespace HYH.Registry.Services.Encryption
public class EncryptionService : ApplicationService public class EncryptionService : ApplicationService
{ {
private readonly ICurrentUser _currentUser; private readonly ICurrentUser _currentUser;
private readonly RegistryDbContext _dbContext; // private readonly RegistryDbContext _dbContext;
private readonly DbContext<Tenant> _dbTenant; private readonly DbContext<Tenant> _dbTenant;
private readonly IRepository<Tenant, int> _repTenant; private readonly IRepository<Tenant, int> _repTenant;
private readonly IRepository<MaterialPowder, int> _repMaterialPowder; private readonly IRepository<MaterialPowder, int> _repMaterialPowder;
...@@ -30,7 +30,7 @@ namespace HYH.Registry.Services.Encryption ...@@ -30,7 +30,7 @@ namespace HYH.Registry.Services.Encryption
///</summary> ///</summary>
public EncryptionService( public EncryptionService(
ICurrentUser currentUser, ICurrentUser currentUser,
RegistryDbContext dbContext, // RegistryDbContext dbContext,
DbContext<Tenant> dbTenant, DbContext<Tenant> dbTenant,
IRepository<MaterialPowder, int> repMaterialPowder, IRepository<MaterialPowder, int> repMaterialPowder,
IRepository<Tenant, int> repTenant IRepository<Tenant, int> repTenant
...@@ -38,7 +38,7 @@ namespace HYH.Registry.Services.Encryption ...@@ -38,7 +38,7 @@ namespace HYH.Registry.Services.Encryption
{ {
_repMaterialPowder = repMaterialPowder; _repMaterialPowder = repMaterialPowder;
_currentUser = currentUser; _currentUser = currentUser;
_dbContext = dbContext; //_dbContext = dbContext;
// _dbTenant = dbTenant; // _dbTenant = dbTenant;
_repTenant = repTenant; _repTenant = repTenant;
...@@ -54,8 +54,8 @@ namespace HYH.Registry.Services.Encryption ...@@ -54,8 +54,8 @@ namespace HYH.Registry.Services.Encryption
{ {
//var dfsff = _dbContext.Database.GetDbConnection().ConnectionString //var dfsff = _dbContext.Database.GetDbConnection().ConnectionString
string code = _currentUser.TenantCode; string code = _currentUser.TenantCode;
//var tenant = _repTenant.FirstOrDefault(q => q.Code == code); var tenant = _repTenant.FirstOrDefault(q => q.Code == code);
var ddf = _dbContext.Tenants.ToList(); var ddf = _repTenant.GetAll().ToList();
string netCardMACAddress = ComputerInfoHelper.GetNetCardMACAddress(); string netCardMACAddress = ComputerInfoHelper.GetNetCardMACAddress();
return netCardMACAddress; return netCardMACAddress;
} }
......
...@@ -5,12 +5,12 @@ namespace HYH.Registry.EntityFrameworkCore ...@@ -5,12 +5,12 @@ namespace HYH.Registry.EntityFrameworkCore
{ {
public static class DbContextOptionsConfigurer public static class DbContextOptionsConfigurer
{ {
public static void Configure(DbContextOptionsBuilder<RegistryDbContext> builder, string connectionString) public static void Configure(DbContextOptionsBuilder<PlatformDbContext> builder, string connectionString)
{ {
builder.UseMySql(connectionString); builder.UseMySql(connectionString);
} }
public static void Configure(DbContextOptionsBuilder<RegistryDbContext> builder, DbConnection connection) public static void Configure(DbContextOptionsBuilder<PlatformDbContext> builder, DbConnection connection)
{ {
builder.UseMySql(connection); builder.UseMySql(connection);
} }
......
...@@ -7,14 +7,14 @@ using Microsoft.EntityFrameworkCore; ...@@ -7,14 +7,14 @@ using Microsoft.EntityFrameworkCore;
namespace HYH.Registry.EntityFrameworkCore namespace HYH.Registry.EntityFrameworkCore
{ {
public class RegistryDbContext : AbpDbContext public class PlatformDbContext : AbpDbContext
{ {
public DbSet<Node> Nodes { get; set; } public DbSet<Node> Nodes { get; set; }
public DbSet<MaterialPowder> MaterialPowders { get; set; } public DbSet<MaterialPowder> MaterialPowders { get; set; }
public DbSet<Tenant> Tenants { get; set; } public DbSet<Tenant> Tenants { get; set; }
public RegistryDbContext(DbContextOptions<RegistryDbContext> options) public PlatformDbContext(DbContextOptions<PlatformDbContext> options)
: base(options) : base(options)
{ {
} }
......
...@@ -7,11 +7,11 @@ using Microsoft.Extensions.Configuration; ...@@ -7,11 +7,11 @@ using Microsoft.Extensions.Configuration;
namespace HYH.Registry.EntityFrameworkCore namespace HYH.Registry.EntityFrameworkCore
{ {
/* This class is needed to run EF Core PMC commands. Not used anywhere else */ /* This class is needed to run EF Core PMC commands. Not used anywhere else */
public class RegistryDbContextFactory : IDesignTimeDbContextFactory<RegistryDbContext> public class RegistryDbContextFactory : IDesignTimeDbContextFactory<PlatformDbContext>
{ {
public RegistryDbContext CreateDbContext(string[] args) public PlatformDbContext CreateDbContext(string[] args)
{ {
var builder = new DbContextOptionsBuilder<RegistryDbContext>(); var builder = new DbContextOptionsBuilder<PlatformDbContext>();
var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder()); var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());
DbContextOptionsConfigurer.Configure( DbContextOptionsConfigurer.Configure(
...@@ -19,7 +19,7 @@ namespace HYH.Registry.EntityFrameworkCore ...@@ -19,7 +19,7 @@ namespace HYH.Registry.EntityFrameworkCore
configuration.GetConnectionString(RegistryConsts.ConnectionStringName) configuration.GetConnectionString(RegistryConsts.ConnectionStringName)
); );
return new RegistryDbContext(builder.Options); return new PlatformDbContext(builder.Options);
} }
} }
} }
\ No newline at end of file
...@@ -19,7 +19,7 @@ namespace HYH.Registry.EntityFrameworkCore ...@@ -19,7 +19,7 @@ namespace HYH.Registry.EntityFrameworkCore
Configuration.ReplaceService<IConnectionStringResolver, ConnectionStringResolver>(); Configuration.ReplaceService<IConnectionStringResolver, ConnectionStringResolver>();
// Configure first DbContext // Configure first DbContext
Configuration.Modules.AbpEfCore().AddDbContext<RegistryDbContext>(options => Configuration.Modules.AbpEfCore().AddDbContext<PlatformDbContext>(options =>
{ {
if (options.ExistingConnection != null) if (options.ExistingConnection != null)
{ {
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
</summary> </summary>
</member> </member>
<member name="M:HYH.Registry.Services.Encryption.EncryptionService.#ctor(HYH.AspNetCore.ICurrentUser,Abp.Domain.Repositories.IRepository{HYH.Core.DbModels.Tenant,System.Int32})"> <member name="M:HYH.Registry.Services.Encryption.EncryptionService.#ctor(HYH.AspNetCore.ICurrentUser,HYH.SqlSugarCore.DbContext{HYH.Core.DbModels.Tenant},Abp.Domain.Repositories.IRepository{HYH.Registry.DbModels.MaterialPowder,System.Int32},Abp.Domain.Repositories.IRepository{HYH.Core.DbModels.Tenant,System.Int32})">
<summary> <summary>
构造函数 构造函数
</summary> </summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment