统一命名空间

This commit is contained in:
大石头 2018-08-19 12:31:04 +08:00
parent 63c5a05d50
commit 35cf3ae122
38 changed files with 89 additions and 101 deletions

View File

@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Mvc;
using NewLife.Cube;
using NewLife.Cube.Admin;
namespace NewLife.CubeNC.Areas.Admin.Base
namespace NewLife.Cube.Areas.Admin.Base
{
[AdminArea]
public class AdminBaseController : Controller

View File

@ -7,7 +7,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.IdentityModel.Protocols;
using NewLife.CubeNC.Com;
using NewLife.Cube.Com;
using NewLife.Reflection;
using NewLife.Web;
using XCode.DataAccessLayer;

View File

@ -5,8 +5,8 @@ using System.IO;
using System.Linq;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using NewLife.CubeNC.Com;
using NewLife.CubeNC.Extensions;
using NewLife.Cube.Com;
using NewLife.Cube.Extensions;
using XCode.Membership;
namespace NewLife.Cube.Admin.Controllers

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using Microsoft.AspNetCore.Mvc;
using NewLife.Common;
using NewLife.CubeNC.Com;
using NewLife.Cube.Com;
using NewLife.Web;
using XCode.Membership;
using XLog = XCode.Membership.Log;

View File

@ -3,8 +3,8 @@ using System.Collections.Generic;
using System.ComponentModel;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using NewLife.CubeNC.Com;
using NewLife.CubeNC.Extensions;
using NewLife.Cube.Com;
using NewLife.Cube.Extensions;
using NewLife.Web;
using XCode;
using XCode.Membership;

View File

@ -12,9 +12,9 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using NewLife.Cube.Entity;
using NewLife.CubeNC.Com;
using NewLife.CubeNC.Extensions;
using NewLife.CubeNC.Membership;
using NewLife.Cube.Com;
using NewLife.Cube.Extensions;
using NewLife.Cube.Membership;
using NewLife.Web;
using XCode;
using XCode.Membership;

View File

@ -4,7 +4,7 @@
//using System.Reflection;
//using Microsoft.AspNetCore.Mvc;
//using NewLife.Common;
//using NewLife.CubeNC.Com;
//using NewLife.Cube.Com;
//using NewLife.Web;
//using XCode;
//using XCode.Membership;

View File

@ -4,7 +4,7 @@
//using System.Reflection;
//using Microsoft.AspNetCore.Mvc;
//using NewLife.Common;
//using NewLife.CubeNC.Com;
//using NewLife.Cube.Com;
//using NewLife.Web;
//using XCode;
//using XCode.Membership;
@ -25,11 +25,11 @@ using System.IO;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.AspNetCore.Mvc;
using NewLife.CubeNC.Com;
using NewLife.CubeNC.Extensions;
using ManagerProviderHelper = NewLife.CubeNC.Membership.ManagerProviderHelper;
using NewLife.Cube.Com;
using NewLife.Cube.Extensions;
using ManagerProviderHelper = NewLife.Cube.Membership.ManagerProviderHelper;
using NewLife.Model;
using NewLife.CubeNC.ViewModels;
using NewLife.Cube.ViewModels;
namespace NewLife.Cube.Admin.Controllers
{

View File

@ -3,7 +3,7 @@
@using System.Reflection;
@using System.Runtime.Versioning;
@using NewLife.Common;
@using NewLife.CubeNC.Extensions
@using NewLife.Cube.Extensions
@{
Layout = NewLife.Cube.Setting.Current.Layout;

View File

@ -1,5 +1,5 @@
@using NewLife.Model;
@using NewLife.CubeNC.ViewModels;
@using NewLife.Cube.ViewModels;
@{
String[] icos = new String[] { "fa-tachometer", "fa-desktop", "fa-list", "fa-pencil-square-o", "fa-list-alt", "fa-calendar", "fa-picture-o", "fa-tag", "fa-file-o" };
Int32 _idx = 0;

View File

@ -1,6 +1,6 @@
@using NewLife.Model;
@using XCode.Membership;
@using NewLife.CubeNC.ViewModels;
@using NewLife.Cube.ViewModels;
@{
var item = Model as MenuTree;
var childs = item.Children ?? new List<MenuTree>();

View File

@ -1,4 +1,4 @@
@using NewLife.CubeNC.Extensions
@using NewLife.Cube.Extensions
<div class="form-group">
@Html.ActionLink("访问统计", "Index", "VisitStat", null, new { @class = "btn btn-success btn-sm" })
<label for="category" class="control-label">类别:</label>

View File

@ -1,5 +1,5 @@
@using NewLife.CubeNC
@*@using NewLife.CubeNC.Models*@
@using NewLife.Cube
@*@using NewLife.Cube.Models*@
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@using NewLife
@using NewLife.Cube

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace NewLife.CubeNC.Areas.Test.Controllers
namespace NewLife.Cube.Areas.Test.Controllers
{
public class DefaultController : Controller
{

View File

@ -4,7 +4,7 @@ using System.Reflection;
using System.Text;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NewLife.CubeNC.Com;
using NewLife.Cube.Com;
using NewLife.Reflection;
using NewLife.Serialization;
using XCode.Membership;

View File

@ -6,7 +6,7 @@ using System.Web;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using NewLife.Common;
using NewLife.CubeNC.WebMiddleware;
using NewLife.Cube.WebMiddleware;
using NewLife.Log;
using XCode.DataAccessLayer;

View File

@ -16,9 +16,9 @@ using NewLife.Reflection;
using NewLife.Web;
using XCode;
using XCode.Membership;
using ManagerProviderHelper = NewLife.CubeNC.Membership.ManagerProviderHelper;
using ManagerProviderHelper = NewLife.Cube.Membership.ManagerProviderHelper;
namespace NewLife.CubeNC.Com
namespace NewLife.Cube.Com
{
/// <summary>实体授权特性</summary>
public class EntityAuthorizeAttribute: Attribute,IAuthorizationFilter

View File

@ -11,8 +11,8 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using NewLife.Common;
using NewLife.Cube.Entity;
using NewLife.CubeNC.Com;
using NewLife.CubeNC.Extensions;
using NewLife.Cube.Com;
using NewLife.Cube.Extensions;
using NewLife.Serialization;
using NewLife.Web;
using NewLife.Xml;

View File

@ -10,13 +10,13 @@ using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NewLife.CubeNC.Extensions;
using NewLife.Cube.Extensions;
using NewLife.Log;
using NewLife.Reflection;
using XCode;
using HttpContext = NewLife.Web.HttpContext;
namespace NewLife.CubeNC.Com
namespace NewLife.Cube.Com
{
public class EntityModelBinder : ComplexTypeModelBinder
{

View File

@ -3,7 +3,7 @@ using System.ComponentModel;
using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Mvc;
using NewLife.CubeNC.Com;
using NewLife.Cube.Com;
using NewLife.Reflection;
using NewLife.Web;
using XCode;

View File

@ -8,10 +8,10 @@ using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using NewLife.Cube;
using NewLife.CubeNC.Extensions;
using NewLife.Cube.Extensions;
using NewLife.Log;
namespace NewLife.CubeNC.Com
namespace NewLife.Cube.Com
{
/// <summary>拦截MVC流程错误的特性</summary>
public class MvcHandleErrorAttribute : ExceptionFilterAttribute

View File

@ -5,8 +5,8 @@ using System.Reflection;
using System.Text;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using NewLife.CubeNC.Com;
using NewLife.CubeNC.Extensions;
using NewLife.Cube.Com;
using NewLife.Cube.Extensions;
using NewLife.Reflection;
using XCode.Membership;

View File

@ -8,7 +8,7 @@ using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;
namespace NewLife.CubeNC.Extensions
namespace NewLife.Cube.Extensions
{
internal class DefaultUIConfigureOptions : IPostConfigureOptions<StaticFileOptions>
{

View File

@ -7,7 +7,7 @@ using System.Threading.Tasks;
using NewLife.Serialization;
using NewLife.Web;
namespace NewLife.CubeNC.Extensions
namespace NewLife.Cube.Extensions
{
/// <summary>
/// 对象助手

View File

@ -5,7 +5,7 @@ using System.Threading.Tasks;
using NewLife.Collections;
using NewLife.Web;
namespace NewLife.CubeNC.Extensions
namespace NewLife.Cube.Extensions
{
public static class PagerHelper
{

View File

@ -5,7 +5,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Primitives;
namespace NewLife.CubeNC.Extensions
namespace NewLife.Cube.Extensions
{
public static class RequestHelper
{

View File

@ -9,7 +9,7 @@ using NewLife.Reflection;
using XCode;
using XCode.Membership;
namespace NewLife.CubeNC.Extensions
namespace NewLife.Cube.Extensions
{
public static class ScanControllerExtensions
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
namespace NewLife.CubeNC.Extensions
namespace NewLife.Cube.Extensions
{
public static class SessionExtensions
{

View File

@ -8,13 +8,13 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection.Extensions;
using NewLife.Common;
using NewLife.CubeNC.Extensions;
using NewLife.Cube.Extensions;
using NewLife.Log;
using NewLife.Model;
using XCode.Membership;
using IServiceCollection = Microsoft.Extensions.DependencyInjection.IServiceCollection;
namespace NewLife.CubeNC.Membership
namespace NewLife.Cube.Membership
{
/// <inheritdoc />
public class DefaultManageProviderForCore : ManageProvider<UserX>

View File

@ -2,7 +2,7 @@
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
namespace NewLife.CubeNC
namespace NewLife.Cube
{
/// <summary>应用程序</summary>
public class Program

View File

@ -15,7 +15,7 @@
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"NewLife.CubeNC": {
"NewLife.Cube": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",

View File

@ -12,13 +12,12 @@ using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using NewLife.Cube;
using NewLife.CubeNC.Com;
using NewLife.CubeNC.Membership;
using NewLife.CubeNC.WebMiddleware;
using NewLife.Cube.Com;
using NewLife.Cube.Membership;
using NewLife.Cube.WebMiddleware;
using NewLife.Web;
namespace NewLife.CubeNC
namespace NewLife.Cube
{
/// <summary>魔方初始化</summary>
public class Startup
@ -43,7 +42,6 @@ namespace NewLife.CubeNC
/// <param name="services"></param>
public virtual void ConfigureServices(IServiceCollection services)
{
var env = HostingEnvironment;
// 配置Cookie策略
services.Configure<CookiePolicyOptions>(options =>
{
@ -69,26 +67,25 @@ namespace NewLife.CubeNC
opt.Filters.Add<MvcHandleErrorAttribute>();
})
.SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
//视图文件查找选项设置
.AddRazorOptions(opt =>
{
opt.ViewLocationFormats.Clear();
opt.AreaViewLocationFormats.Clear();
opt.ViewLocationFormats.Add("~/Views/{1}/{0}.cshtml");
opt.ViewLocationFormats.Add("~/Views/Shared/{0}.cshtml");
opt.AreaViewLocationFormats.Add("~/Areas/{2}/Views/{1}/{0}.cshtml");
opt.AreaViewLocationFormats.Add("~/Areas/{2}/Views/Shared/{0}.cshtml");
opt.AreaViewLocationFormats.Add("~/Views/{1}/{0}.cshtml");
opt.AreaViewLocationFormats.Add("~/Views/Shared/{0}.cshtml");
})
.AddViewOptions(opt =>
{
//opt.ViewEngines.Clear();
//var item = services.
//opt.ViewEngines.Add(new CompositePrecompiledMvcEngine());
})
;
.SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
// 视图文件查找选项设置
.AddRazorOptions(opt =>
{
opt.ViewLocationFormats.Clear();
opt.AreaViewLocationFormats.Clear();
opt.ViewLocationFormats.Add("~/Views/{1}/{0}.cshtml");
opt.ViewLocationFormats.Add("~/Views/Shared/{0}.cshtml");
opt.AreaViewLocationFormats.Add("~/Areas/{2}/Views/{1}/{0}.cshtml");
opt.AreaViewLocationFormats.Add("~/Areas/{2}/Views/Shared/{0}.cshtml");
opt.AreaViewLocationFormats.Add("~/Views/{1}/{0}.cshtml");
opt.AreaViewLocationFormats.Add("~/Views/Shared/{0}.cshtml");
})
.AddViewOptions(opt =>
{
//opt.ViewEngines.Clear();
//var item = services.
//opt.ViewEngines.Add(new CompositePrecompiledMvcEngine());
});
AddCustomApplicationParts(services);
@ -101,17 +98,9 @@ namespace NewLife.CubeNC
// 添加魔方模块
// 添加管理提供者
services.AddManageProvider();
// 添加Http上下文访问器
StaticHttpContextExtensions.AddHttpContextAccessor(services);
//if (env.IsDevelopment())
//{
//}
//else
//{
// services.AddCubeDefaultUI();
//}
}
/// <summary>添加自定义应用部分即添加外部引用的控制器、视图的Assemly作为本应用的一部分</summary>
@ -173,13 +162,16 @@ namespace NewLife.CubeNC
//app.UseHsts();
}
var set = NewLife.Cube.Setting.Current;
// 添加自定义中间件
// 注册错误处理模块中间件
app.UseErrorModule();
// 注册请求执行时间中间件
app.UseDbRunTimeModule();
app.UseHttpsRedirection();
if (set.ForceSSL) app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseCookiePolicy();
app.UseSession();
@ -187,23 +179,19 @@ namespace NewLife.CubeNC
app.UseMvc(routes =>
{
{
// 为魔方注册默认首页启动魔方站点时能自动跳入后台同时为Home预留默认过度视图页面
routes.MapRoute(
name: "Cube",
template: "{controller=CubeHome}/{action=Index}/{id?}"
);
}
// 为魔方注册默认首页启动魔方站点时能自动跳入后台同时为Home预留默认过度视图页面
routes.MapRoute(
name: "Cube",
template: "{controller=CubeHome}/{action=Index}/{id?}"
);
});
// 配置魔方的MVC选项
app.UseRouter(routes =>
{
if (routes.DefaultHandler == null)
{
routes.DefaultHandler = app.ApplicationServices.GetRequiredService<MvcRouteHandler>();
}
//区域路由注册
if (routes.DefaultHandler == null) routes.DefaultHandler = app.ApplicationServices.GetRequiredService<MvcRouteHandler>();
// 区域路由注册
routes.MapRoute(
name: "CubeAreas",
template: "{area=Admin}/{controller=Index}/{action=Index}/{id?}"

View File

@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace NewLife.CubeNC.ViewModels
namespace NewLife.Cube.ViewModels
{
/// <summary>
/// 菜单树

View File

@ -1,6 +1,6 @@
@using NewLife;
@using NewLife.Cube
@using NewLife.CubeNC.Extensions
@using NewLife.Cube.Extensions
@using NewLife.Web;
@using XCode;
@using XCode.Membership

View File

@ -1,4 +1,4 @@
@using NewLife.CubeNC.Extensions
@using NewLife.Cube.Extensions
<div class="input-group">
<span class="input-group-addon">
<i class="ace-icon fa fa-check"></i>

View File

@ -1,5 +1,5 @@
@using NewLife.CubeNC
@using NewLife.Cube
@using NewLife.Web
@using XCode.Membership;
@*@using NewLife.CubeNC.Models*@
@*@using NewLife.Cube.Models*@
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

View File

@ -13,7 +13,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace NewLife.CubeNC.ViewsPreComplied
namespace NewLife.Cube.ViewsPreComplied
{
public class CompositePrecompiledMvcEngine: RazorViewEngine, IRazorViewEngine
{

View File

@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using System.Threading.Tasks;
namespace NewLife.CubeNC.WebMiddleware
namespace NewLife.Cube.WebMiddleware
{
public class ErrorModuleMiddleware
{