Skip to content

Commit 68f33dc

Browse files
committed
Revert to SQLServer for write blog
1 parent 739a3e4 commit 68f33dc

File tree

4 files changed

+27
-36
lines changed

4 files changed

+27
-36
lines changed

Mystique.Core.Mvc/Infrastructure/MystiqueStartup.cs

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static void MystiqueSetup(this IServiceCollection services, IConfiguratio
4848

4949
services.AddSingleton<IMvcModuleSetup, MvcModuleSetup>();
5050
services.AddScoped<IPluginManager, PluginManager>();
51-
services.AddScoped<IUnitOfWork, Repository.MySql.UnitOfWork>();
51+
services.AddScoped<IUnitOfWork, Repositories.UnitOfWork>();
5252
services.AddSingleton<INotificationRegister, NotificationRegister>();
5353
services.AddSingleton<IActionDescriptorChangeProvider>(MystiqueActionDescriptorChangeProvider.Instance);
5454
services.AddSingleton<IReferenceContainer, DefaultReferenceContainer>();
@@ -120,21 +120,21 @@ public static void MystiqueSetup(this IServiceCollection services, IConfiguratio
120120
AdditionalReferencePathHolder.AdditionalReferencePaths = o.AdditionalReferencePaths;
121121
});
122122

123-
AssemblyLoadContext.Default.Resolving += (context, assembly) =>
124-
{
125-
Func<CollectibleAssemblyLoadContext, bool> filter = p => p.Assemblies.Any(p => p.GetName().Name == assembly.Name
126-
&& p.GetName().Version == assembly.Version);
123+
//AssemblyLoadContext.Default.Resolving += (context, assembly) =>
124+
//{
125+
// Func<CollectibleAssemblyLoadContext, bool> filter = p => p.Assemblies.Any(p => p.GetName().Name == assembly.Name
126+
// && p.GetName().Version == assembly.Version);
127127

128-
if (PluginsLoadContexts.All().Any(filter))
129-
{
130-
var ass = PluginsLoadContexts.All().First(filter)
131-
.Assemblies.First(p => p.GetName().Name == assembly.Name
132-
&& p.GetName().Version == assembly.Version);
133-
return ass;
134-
}
128+
// if (PluginsLoadContexts.All().Any(filter))
129+
// {
130+
// var ass = PluginsLoadContexts.All().First(filter)
131+
// .Assemblies.First(p => p.GetName().Name == assembly.Name
132+
// && p.GetName().Version == assembly.Version);
133+
// return ass;
134+
// }
135135

136-
return null;
137-
};
136+
// return null;
137+
//};
138138

139139
services.Configure<RazorViewEngineOptions>(o =>
140140
{
@@ -173,11 +173,8 @@ public RazorPageFactoryResult CreateFactory(string relativePath)
173173
relativePath = relativePath.Substring(1);
174174
}
175175

176-
177176
var compileTask = Compiler.CompileAsync(relativePath);
178177

179-
180-
181178
var viewDescriptor = compileTask.GetAwaiter().GetResult();
182179

183180
var viewType = viewDescriptor.Type;

Mystique/Mystique.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
<ItemGroup>
2424
<ProjectReference Include="..\Mystique.Core.Mvc\Mystique.Core.Mvc.csproj" />
2525
<ProjectReference Include="..\Mystique.Core\Mystique.Core.csproj" />
26-
<ProjectReference Include="..\Mystique.Core.Repository.MySql\Mystique.Core.Repository.MySql.csproj" />
2726
</ItemGroup>
2827

2928
<ItemGroup>

Mystique/Startup.cs

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,23 @@ public Startup(IConfiguration configuration)
2424
// This method gets called by the runtime. Use this method to add services to the container.
2525
public void ConfigureServices(IServiceCollection services)
2626
{
27-
using (var scope = CreateServices().CreateScope())
28-
{
29-
var runner = scope.ServiceProvider.GetRequiredService<IMigrationRunner>();
30-
runner.MigrateUp();
31-
}
3227

3328
services.MystiqueSetup(Configuration);
3429

3530

3631
}
3732

38-
private static IServiceProvider CreateServices()
39-
{
40-
return new ServiceCollection().AddFluentMigratorCore().ConfigureRunner(rb =>
41-
rb.AddMySql5()
42-
.WithGlobalConnectionString("server=localhost;port=3306;Database=pluginDB;UID=root;PWD=123456")
43-
.ScanIn(typeof(InitialDB).Assembly)
44-
.For
45-
.Migrations())
46-
.AddLogging(lb => lb.AddFluentMigratorConsole())
47-
.BuildServiceProvider(false);
48-
}
33+
//private static IServiceProvider CreateServices()
34+
//{
35+
// return new ServiceCollection().AddFluentMigratorCore().ConfigureRunner(rb =>
36+
// rb.AddMySql5()
37+
// .WithGlobalConnectionString("server=localhost;port=3306;Database=pluginDB;UID=root;PWD=123456")
38+
// .ScanIn(typeof(InitialDB).Assembly)
39+
// .For
40+
// .Migrations())
41+
// .AddLogging(lb => lb.AddFluentMigratorConsole())
42+
// .BuildServiceProvider(false);
43+
//}
4944

5045
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
5146
{

Mystique/appsettings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
},
77
"AllowedHosts": "*",
88
"ConnectionStringSetting": {
9-
"ConnectionString": "server=localhost;port=3306;Database=pluginDB;UID=root;PWD=123456"
9+
"ConnectionString": "Server=.;Database=LamondTest;Integrated Security=SSPI"
1010
},
1111
"SiteSetings": {
12-
"MySQLConnection": "server=localhost;port=3306;Database=pluginDB;UID=root;PWD=123456"
12+
"MySQLConnection": "server=.;port=3306;Database=pluginDB;UID=root;PWD=123456"
1313
}
1414
}

0 commit comments

Comments
 (0)