diff --git a/WorkData/WorkData.Apollo/WorkData.Apollo.csproj b/WorkData/WorkData.Apollo/WorkData.Apollo.csproj
new file mode 100644
index 0000000..f958c07
--- /dev/null
+++ b/WorkData/WorkData.Apollo/WorkData.Apollo.csproj
@@ -0,0 +1,11 @@
+
+
+
+ netstandard2.0
+
+
+
+
+
+
+
diff --git a/WorkData/WorkData.ApolloWeb/ApiController/ValuesController.cs b/WorkData/WorkData.ApolloWeb/ApiController/ValuesController.cs
new file mode 100644
index 0000000..7ec2903
--- /dev/null
+++ b/WorkData/WorkData.ApolloWeb/ApiController/ValuesController.cs
@@ -0,0 +1,21 @@
+using Microsoft.AspNetCore.Mvc;
+using WorkData.Code.JwtSecurityTokens;
+using WorkData.Dependency;
+using Newtonsoft.Json;
+using System;
+using WorkData.EntityFramework;
+
+namespace WorkData.ApolloWeb.ApiController
+{
+ [ApiController]
+ [Route("api/Values")]
+ public class ValuesController : Controller
+ {
+ [HttpGet]
+ public IActionResult Get(string key)
+ {
+ var data = IocManager.Instance.ResolveServiceValue(key);
+ return Json(data);
+ }
+ }
+}
\ No newline at end of file
diff --git a/WorkData/WorkData.ApolloWeb/Config/hosting.json b/WorkData/WorkData.ApolloWeb/Config/hosting.json
new file mode 100644
index 0000000..2c7b5f0
--- /dev/null
+++ b/WorkData/WorkData.ApolloWeb/Config/hosting.json
@@ -0,0 +1,3 @@
+{
+ "server.urls": "http://+:8100"
+}
\ No newline at end of file
diff --git a/WorkData/WorkData.ApolloWeb/Config/moduleConfig.json b/WorkData/WorkData.ApolloWeb/Config/moduleConfig.json
new file mode 100644
index 0000000..729195c
--- /dev/null
+++ b/WorkData/WorkData.ApolloWeb/Config/moduleConfig.json
@@ -0,0 +1,7 @@
+{
+ "modules": [
+ {
+ "type": "WorkData.ApolloWeb.WorkDataApolloWebModule,WorkData.ApolloWeb"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/WorkData/WorkData.ApolloWeb/Program.cs b/WorkData/WorkData.ApolloWeb/Program.cs
new file mode 100644
index 0000000..ed32d8f
--- /dev/null
+++ b/WorkData/WorkData.ApolloWeb/Program.cs
@@ -0,0 +1,34 @@
+using Autofac.Extensions.DependencyInjection;
+using Com.Ctrip.Framework.Apollo;
+using Microsoft.AspNetCore;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.Hosting;
+using System.IO;
+using WorkData.EntityFramework;
+
+namespace WorkData.ApolloWeb
+{
+ public class Program
+ {
+ public static void Main(string[] args)
+ {
+ var host = BuildWebHost(args);
+ host.Run();
+ }
+
+ public static IWebHost BuildWebHost(string[] args) =>
+ WebHost.CreateDefaultBuilder(args)
+
+ .ConfigureAppConfiguration((hostingContext, webBuilder) =>
+ {
+ webBuilder
+ .AddApollo(webBuilder.Build().GetSection("apollo"))
+ .AddDefault();
+ })
+ .ConfigureServices(services => services.AddAutofac())
+ .UseContentRoot(Directory.GetCurrentDirectory())
+ .UseStartup()
+ .Build();
+ }
+}
\ No newline at end of file
diff --git a/WorkData/WorkData.ApolloWeb/Properties/launchSettings.json b/WorkData/WorkData.ApolloWeb/Properties/launchSettings.json
new file mode 100644
index 0000000..2dc0956
--- /dev/null
+++ b/WorkData/WorkData.ApolloWeb/Properties/launchSettings.json
@@ -0,0 +1,27 @@
+{
+ "iisSettings": {
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
+ "iisExpress": {
+ "applicationUrl": "http://localhost:55504",
+ "sslPort": 0
+ }
+ },
+ "profiles": {
+ "IIS Express": {
+ "commandName": "IISExpress",
+ "launchBrowser": true,
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Production"
+ }
+ },
+ "WorkData.ApolloWeb": {
+ "commandName": "Project",
+ "launchBrowser": true,
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ },
+ "applicationUrl": "http://localhost:5000"
+ }
+ }
+}
\ No newline at end of file
diff --git a/WorkData/WorkData.ApolloWeb/Startup.cs b/WorkData/WorkData.ApolloWeb/Startup.cs
new file mode 100644
index 0000000..80bc252
--- /dev/null
+++ b/WorkData/WorkData.ApolloWeb/Startup.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Security.Principal;
+using System.Threading.Tasks;
+using Autofac.Extensions.DependencyInjection;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Configuration;
+using Com.Ctrip.Framework.Apollo;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Options;
+using WorkData.Code.JwtSecurityTokens;
+using WorkData.BaseWeb;
+
+namespace WorkData.ApolloWeb
+{
+ public class Startup:BaseStartup
+ {
+ public Startup(IHostingEnvironment env, IConfiguration configuration) : base(env, configuration)
+ {
+ }
+
+ public IServiceProvider ConfigureServices(IServiceCollection services)
+ {
+ //services.Configure(Configuration.GetSection("WorkDataBaseJwt"));
+ services.AddMvc();
+ #region Autofac
+ BootstrapWarpper.InitiateConfig(new List { "Config/moduleConfig.json" }, services);
+ #endregion
+ return new AutofacServiceProvider
+ (BootstrapWarpper.IocManager.IocContainer);
+ }
+
+
+ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
+ {
+ if (env.IsDevelopment()) app.UseDeveloperExceptionPage();
+ //静态资源
+ app.UseStaticFiles();
+ //MVC
+ app.UseMvc(routes =>
+ {
+ routes.MapRoute(
+ "default",
+ "{controller=Home}/{action=Index}/{id?}");
+ });
+ }
+ }
+}
diff --git a/WorkData/WorkData.ApolloWeb/WorkData.ApolloWeb.csproj b/WorkData/WorkData.ApolloWeb/WorkData.ApolloWeb.csproj
new file mode 100644
index 0000000..46b97bd
--- /dev/null
+++ b/WorkData/WorkData.ApolloWeb/WorkData.ApolloWeb.csproj
@@ -0,0 +1,43 @@
+
+
+
+ netcoreapp2.1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+
+
diff --git a/WorkData/WorkData.ApolloWeb/WorkDataApolloWebModule.cs b/WorkData/WorkData.ApolloWeb/WorkDataApolloWebModule.cs
new file mode 100644
index 0000000..a6e5b94
--- /dev/null
+++ b/WorkData/WorkData.ApolloWeb/WorkDataApolloWebModule.cs
@@ -0,0 +1,25 @@
+// ------------------------------------------------------------------------------
+// Copyright 吴来伟个人 版权所有。
+// 项目名:WorkData.Web
+// 文件名:WorkDataWebModule.cs
+// 创建标识:吴来伟 2018-06-11 10:40
+// 创建描述:
+//
+// 修改标识:吴来伟2018-06-11 10:40
+// 修改描述:
+// ------------------------------------------------------------------------------
+
+using Autofac;
+using Microsoft.AspNetCore.Identity;
+using WorkData.Extensions.Modules;
+
+namespace WorkData.ApolloWeb
+{
+ public class WorkDataApolloWebModule : WorkDataBaseModule
+ {
+ protected override void Load(ContainerBuilder builder)
+ {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/WorkData/WorkData.ApolloWeb/appsettings.Development.json b/WorkData/WorkData.ApolloWeb/appsettings.Development.json
new file mode 100644
index 0000000..fc64a00
--- /dev/null
+++ b/WorkData/WorkData.ApolloWeb/appsettings.Development.json
@@ -0,0 +1,7 @@
+{
+ "apollo": {
+ "AppId": "workdata",
+ "Env": "dev",
+ "MetaServer": "http://127.0.0.1:31001"
+ }
+}
\ No newline at end of file
diff --git a/WorkData/WorkData.ApolloWeb/appsettings.Production.json b/WorkData/WorkData.ApolloWeb/appsettings.Production.json
new file mode 100644
index 0000000..9027bab
--- /dev/null
+++ b/WorkData/WorkData.ApolloWeb/appsettings.Production.json
@@ -0,0 +1,7 @@
+{
+ "apollo": {
+ "AppId": "workdata",
+ "Env": "pro",
+ "MetaServer": "http://127.0.0.1:31001"
+ }
+}
\ No newline at end of file
diff --git a/WorkData/WorkData.ApolloWeb/appsettings.json b/WorkData/WorkData.ApolloWeb/appsettings.json
new file mode 100644
index 0000000..fc64a00
--- /dev/null
+++ b/WorkData/WorkData.ApolloWeb/appsettings.json
@@ -0,0 +1,7 @@
+{
+ "apollo": {
+ "AppId": "workdata",
+ "Env": "dev",
+ "MetaServer": "http://127.0.0.1:31001"
+ }
+}
\ No newline at end of file
diff --git a/WorkData/WorkData.AutofacServiceLocator/AutofacServiceLocator.cs b/WorkData/WorkData.AutofacServiceLocator/AutofacServiceLocator.cs
new file mode 100644
index 0000000..abac0ad
--- /dev/null
+++ b/WorkData/WorkData.AutofacServiceLocator/AutofacServiceLocator.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using Autofac;
+using CommonServiceLocator;
+
+namespace WorkData.AutofacServiceLocator
+{
+ ///
+ /// Autofac implementation of the Microsoft CommonServiceLocator.
+ ///
+ public class AutofacServiceLocator : ServiceLocatorImplBase
+ {
+ ///
+ /// The from which services
+ /// should be located.
+ ///
+ private readonly IComponentContext _container;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ /// The from which services
+ /// should be located.
+ ///
+ ///
+ /// Thrown if is .
+ ///
+ public AutofacServiceLocator(IComponentContext container)
+ {
+ _container = container ?? throw new ArgumentNullException(nameof(container));
+ }
+
+ ///
+ /// Resolves the requested service instance.
+ ///
+ /// Type of instance requested.
+ /// Name of registered service you want. May be .
+ /// The requested service instance.
+ ///
+ /// Thrown if is .
+ ///
+ protected override object DoGetInstance(Type serviceType, string key)
+ {
+ if (serviceType == null)
+ {
+ throw new ArgumentNullException(nameof(serviceType));
+ }
+
+ return key != null ? _container.ResolveNamed(key, serviceType) : _container.Resolve(serviceType);
+ }
+
+ ///
+ /// Resolves all requested service instances.
+ ///
+ /// Type of instance requested.
+ /// Sequence of service instance objects.
+ ///
+ /// Thrown if is .
+ ///
+ protected override IEnumerable