mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-08-23 13:06:48 +08:00
去掉Owin的一些代码
This commit is contained in:
parent
2f9b41b96d
commit
2a5cdd453f
72
Infrastructure/Helper/CookieHelper.cs
Normal file
72
Infrastructure/Helper/CookieHelper.cs
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
// ***********************************************************************
|
||||||
|
// Assembly : Infrastructure
|
||||||
|
// Author : Administrator
|
||||||
|
// Created : 09-22-2015
|
||||||
|
//
|
||||||
|
// ***********************************************************************
|
||||||
|
// <copyright file="CookieHelper.cs" company="">
|
||||||
|
// Copyright (c) . All rights reserved.
|
||||||
|
// </copyright>
|
||||||
|
// <summary>Cookie辅助</summary>
|
||||||
|
// ***********************************************************************
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Web;
|
||||||
|
|
||||||
|
namespace Infrastructure.Helper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Cookie帮助类
|
||||||
|
/// </summary>
|
||||||
|
public class CookieHelper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 写cookie值
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="strName">名称</param>
|
||||||
|
/// <param name="strValue">值</param>
|
||||||
|
public static void WriteCookie(string strName, string strValue)
|
||||||
|
{
|
||||||
|
HttpCookie cookie = HttpContext.Current.Request.Cookies[strName];
|
||||||
|
if (cookie == null)
|
||||||
|
{
|
||||||
|
cookie = new HttpCookie(strName);
|
||||||
|
}
|
||||||
|
cookie.Value = strValue;
|
||||||
|
HttpContext.Current.Response.AppendCookie(cookie);
|
||||||
|
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 写cookie值
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="strName">名称</param>
|
||||||
|
/// <param name="strValue">值</param>
|
||||||
|
/// <param name="strValue">过期时间(分钟)</param>
|
||||||
|
public static void WriteCookie(string strName, string strValue, int expires)
|
||||||
|
{
|
||||||
|
HttpCookie cookie = HttpContext.Current.Request.Cookies[strName];
|
||||||
|
if (cookie == null)
|
||||||
|
{
|
||||||
|
cookie = new HttpCookie(strName);
|
||||||
|
}
|
||||||
|
cookie.Value = strValue;
|
||||||
|
cookie.Expires = DateTime.Now.AddMinutes(expires);
|
||||||
|
HttpContext.Current.Response.AppendCookie(cookie);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读cookie值
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="strName">名称</param>
|
||||||
|
/// <returns>cookie值</returns>
|
||||||
|
public static string GetCookie(string strName)
|
||||||
|
{
|
||||||
|
if (HttpContext.Current.Request.Cookies[strName] != null)
|
||||||
|
{
|
||||||
|
return HttpContext.Current.Request.Cookies[strName].Value.ToString();
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
55
Infrastructure/Infrastructure.csproj
Normal file
55
Infrastructure/Infrastructure.csproj
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{5FEAEC9A-4F1E-4EE7-B377-9DB1B0870DAC}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Infrastructure</RootNamespace>
|
||||||
|
<AssemblyName>Infrastructure</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Web" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Helper\CookieHelper.cs" />
|
||||||
|
<Compile Include="Helper\SessionHelper.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
36
Infrastructure/Properties/AssemblyInfo.cs
Normal file
36
Infrastructure/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// 有关程序集的常规信息通过以下
|
||||||
|
// 特性集控制。更改这些特性值可修改
|
||||||
|
// 与程序集关联的信息。
|
||||||
|
[assembly: AssemblyTitle("Infrastructure")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Infrastructure")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// 将 ComVisible 设置为 false 使此程序集中的类型
|
||||||
|
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
|
||||||
|
// 则将该类型上的 ComVisible 特性设置为 true。
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||||
|
[assembly: Guid("e953a7ce-9f0c-4aec-973c-de31e38e10e6")]
|
||||||
|
|
||||||
|
// 程序集的版本信息由下面四个值组成:
|
||||||
|
//
|
||||||
|
// 主版本
|
||||||
|
// 次版本
|
||||||
|
// 生成号
|
||||||
|
// 修订号
|
||||||
|
//
|
||||||
|
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||||
|
// 方法是按如下所示使用“*”:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
@ -1,29 +1,28 @@
|
|||||||
using System;
|
using System;
|
||||||
using OpenAuth.Domain.Interface;
|
using OpenAuth.Domain.Interface;
|
||||||
|
|
||||||
namespace OpenAuth.App
|
namespace OpenAuth.App
|
||||||
{
|
{
|
||||||
public class LoginApp
|
public class LoginApp
|
||||||
{
|
{
|
||||||
private IUserRepository _repository;
|
private IUserRepository _repository;
|
||||||
|
|
||||||
public LoginApp(IUserRepository repository)
|
public LoginApp(IUserRepository repository)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Login(string userName, string password)
|
public void Login(string userName, string password)
|
||||||
{
|
{
|
||||||
var user = _repository.FindByAccount(userName);
|
var user = _repository.FindByAccount(userName);
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
throw new Exception("Óû§ÕʺŲ»´æÔÚ");
|
throw new Exception("Óû§ÕʺŲ»´æÔÚ");
|
||||||
}
|
}
|
||||||
|
|
||||||
user.CheckLogin(password);
|
user.CheckLogin(password);
|
||||||
|
|
||||||
LoginCacheApp.SetLogin(user);
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,25 +0,0 @@
|
|||||||
using System.Web;
|
|
||||||
using OpenAuth.Domain;
|
|
||||||
|
|
||||||
namespace OpenAuth.App
|
|
||||||
{
|
|
||||||
public class LoginCacheApp
|
|
||||||
{
|
|
||||||
public static User GetLogin()
|
|
||||||
{
|
|
||||||
var session = HttpContext.Current.Session;
|
|
||||||
return session["Login"] as User;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SetLogin(User loginresp)
|
|
||||||
{
|
|
||||||
var session = HttpContext.Current.Session;
|
|
||||||
var login = session["Login"] as User;
|
|
||||||
if (login != null && login.UserId == loginresp.UserId)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
session["Login"] = loginresp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,65 +1,64 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>{0BBF2D65-FFFD-4272-B138-8EA4FB6FEC48}</ProjectGuid>
|
<ProjectGuid>{0BBF2D65-FFFD-4272-B138-8EA4FB6FEC48}</ProjectGuid>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>OpenAuth.App</RootNamespace>
|
<RootNamespace>OpenAuth.App</RootNamespace>
|
||||||
<AssemblyName>OpenAuth.App</AssemblyName>
|
<AssemblyName>OpenAuth.App</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Web" />
|
<Reference Include="System.Web" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="LoginApp.cs" />
|
<Compile Include="LoginApp.cs" />
|
||||||
<Compile Include="LoginCacheApp.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
</ItemGroup>
|
||||||
</ItemGroup>
|
<ItemGroup>
|
||||||
<ItemGroup>
|
<ProjectReference Include="..\OpenAuth.Domain\OpenAuth.Domain.csproj">
|
||||||
<ProjectReference Include="..\OpenAuth.Domain\OpenAuth.Domain.csproj">
|
<Project>{6108da8e-92a1-4abe-b9f5-26d64d55ca2c}</Project>
|
||||||
<Project>{6108da8e-92a1-4abe-b9f5-26d64d55ca2c}</Project>
|
<Name>OpenAuth.Domain</Name>
|
||||||
<Name>OpenAuth.Domain</Name>
|
</ProjectReference>
|
||||||
</ProjectReference>
|
<ProjectReference Include="..\OpenAuth.Repository\OpenAuth.Repository.csproj">
|
||||||
<ProjectReference Include="..\OpenAuth.Repository\OpenAuth.Repository.csproj">
|
<Project>{e8df8dea-e2cf-4bdb-8f4f-3f8205b0e03a}</Project>
|
||||||
<Project>{e8df8dea-e2cf-4bdb-8f4f-3f8205b0e03a}</Project>
|
<Name>OpenAuth.Repository</Name>
|
||||||
<Name>OpenAuth.Repository</Name>
|
</ProjectReference>
|
||||||
</ProjectReference>
|
</ItemGroup>
|
||||||
</ItemGroup>
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
<Target Name="BeforeBuild">
|
||||||
<Target Name="BeforeBuild">
|
</Target>
|
||||||
</Target>
|
<Target Name="AfterBuild">
|
||||||
<Target Name="AfterBuild">
|
</Target>
|
||||||
</Target>
|
-->
|
||||||
-->
|
|
||||||
</Project>
|
</Project>
|
@ -1,38 +0,0 @@
|
|||||||
using Microsoft.AspNet.Identity;
|
|
||||||
using Microsoft.Owin;
|
|
||||||
using Microsoft.Owin.Security.Cookies;
|
|
||||||
using Owin;
|
|
||||||
|
|
||||||
namespace OpenAuth.Mvc
|
|
||||||
{
|
|
||||||
public partial class Startup
|
|
||||||
{
|
|
||||||
// 有关配置身份验证的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkId=301864
|
|
||||||
public void ConfigureAuth(IAppBuilder app)
|
|
||||||
{
|
|
||||||
// 使应用程序可以使用 Cookie 来存储已登录用户的信息
|
|
||||||
app.UseCookieAuthentication(new CookieAuthenticationOptions
|
|
||||||
{
|
|
||||||
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
|
|
||||||
LoginPath = new PathString("/Account/Login")
|
|
||||||
});
|
|
||||||
// Use a cookie to temporarily store information about a user logging in with a third party login provider
|
|
||||||
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
|
|
||||||
|
|
||||||
// 取消注释以下行可允许使用第三方登录提供程序登录
|
|
||||||
//app.UseMicrosoftAccountAuthentication(
|
|
||||||
// clientId: "",
|
|
||||||
// clientSecret: "");
|
|
||||||
|
|
||||||
//app.UseTwitterAuthentication(
|
|
||||||
// consumerKey: "",
|
|
||||||
// consumerSecret: "");
|
|
||||||
|
|
||||||
//app.UseFacebookAuthentication(
|
|
||||||
// appId: "",
|
|
||||||
// appSecret: "");
|
|
||||||
|
|
||||||
//app.UseGoogleAuthentication();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,122 +1,95 @@
|
|||||||
using Microsoft.AspNet.Identity;
|
using Microsoft.AspNet.Identity;
|
||||||
using Microsoft.Owin.Security;
|
using Microsoft.Owin.Security;
|
||||||
using OpenAuth.Mvc.Models;
|
using OpenAuth.Mvc.Models;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Newtonsoft.Json;
|
using Infrastructure.Helper;
|
||||||
using OpenAuth.App;
|
using Newtonsoft.Json;
|
||||||
using OpenAuth.Domain;
|
using OpenAuth.App;
|
||||||
using OpenAuth.Domain.Interface;
|
using OpenAuth.Domain;
|
||||||
|
using OpenAuth.Domain.Interface;
|
||||||
namespace OpenAuth.Mvc.Controllers
|
|
||||||
{
|
namespace OpenAuth.Mvc.Controllers
|
||||||
[Authorize]
|
{
|
||||||
public class AccountController : Controller
|
[Authorize]
|
||||||
{
|
public class AccountController : Controller
|
||||||
private IUserRepository _userRepository;
|
{
|
||||||
|
private LoginApp _loginApp;
|
||||||
public AccountController(IUserRepository repository)
|
private IUserRepository _userRepository;
|
||||||
{
|
|
||||||
_userRepository = repository;
|
public AccountController(IUserRepository repository)
|
||||||
}
|
{
|
||||||
//
|
_userRepository = repository;
|
||||||
// GET: /Account/Login
|
_loginApp = new LoginApp(_userRepository);
|
||||||
[AllowAnonymous]
|
}
|
||||||
public ActionResult Login(string returnUrl)
|
//
|
||||||
{
|
// GET: /Account/Login
|
||||||
ViewBag.ReturnUrl = returnUrl;
|
[AllowAnonymous]
|
||||||
return View();
|
public ActionResult Login(string returnUrl)
|
||||||
}
|
{
|
||||||
|
ViewBag.ReturnUrl = returnUrl;
|
||||||
//
|
return View();
|
||||||
// POST: /Account/Login
|
}
|
||||||
[HttpPost]
|
|
||||||
[AllowAnonymous]
|
//
|
||||||
[ValidateAntiForgeryToken]
|
// POST: /Account/Login
|
||||||
public async Task<ActionResult> Login(LoginViewModel model, string returnUrl)
|
[HttpPost]
|
||||||
{
|
[AllowAnonymous]
|
||||||
if (ModelState.IsValid)
|
[ValidateAntiForgeryToken]
|
||||||
{
|
public async Task<ActionResult> Login(LoginViewModel model, string returnUrl)
|
||||||
//直接生成登陆用户,在实际的项目中采用数据库形式
|
{
|
||||||
var user = new User {Account = "admin"};
|
if (ModelState.IsValid)
|
||||||
if (user != null)
|
{
|
||||||
{
|
//直接生成登陆用户,在实际的项目中采用数据库形式
|
||||||
await SignInAsync(user, model.RememberMe);
|
var user = new User {Account = "admin"};
|
||||||
return RedirectToLocal(returnUrl);
|
if (user != null)
|
||||||
}
|
{
|
||||||
else
|
|
||||||
{
|
return RedirectToLocal(returnUrl);
|
||||||
ModelState.AddModelError("", "Invalid username or password.");
|
}
|
||||||
}
|
else
|
||||||
}
|
{
|
||||||
|
ModelState.AddModelError("", "Invalid username or password.");
|
||||||
// 如果我们进行到这一步时某个地方出错,则重新显示表单
|
}
|
||||||
return View(model);
|
}
|
||||||
}
|
|
||||||
|
// 如果我们进行到这一步时某个地方出错,则重新显示表单
|
||||||
//
|
return View(model);
|
||||||
// POST: /Account/LogOff
|
}
|
||||||
public ActionResult LogOff()
|
|
||||||
{
|
//
|
||||||
AuthenticationManager.SignOut();
|
// POST: /Account/LogOff
|
||||||
return RedirectToAction("Login", "Account");
|
public ActionResult LogOff()
|
||||||
}
|
{
|
||||||
|
SessionHelper.Clear();
|
||||||
public ActionResult List()
|
return RedirectToAction("Login", "Account");
|
||||||
{
|
}
|
||||||
return View();
|
|
||||||
}
|
public ActionResult List()
|
||||||
public string LoadUsers()
|
{
|
||||||
{
|
return View();
|
||||||
return JsonConvert.SerializeObject(_userRepository.LoadUsers());
|
}
|
||||||
}
|
public string LoadUsers()
|
||||||
|
{
|
||||||
#region 帮助程序
|
return JsonConvert.SerializeObject(_userRepository.LoadUsers());
|
||||||
|
}
|
||||||
private IAuthenticationManager AuthenticationManager
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
private ActionResult RedirectToLocal(string returnUrl)
|
||||||
return HttpContext.GetOwinContext().Authentication;
|
{
|
||||||
}
|
if (Url.IsLocalUrl(returnUrl))
|
||||||
}
|
{
|
||||||
|
return Redirect(returnUrl);
|
||||||
/// <summary>
|
}
|
||||||
/// sign information as an asynchronous operation.
|
else
|
||||||
/// </summary>
|
{
|
||||||
/// <param name="user">用户</param>
|
return RedirectToAction("Index", "Home");
|
||||||
/// <param name="isPersistent">Remember me?</param>
|
}
|
||||||
/// <returns>Task.</returns>
|
}
|
||||||
private async Task SignInAsync(User user, bool isPersistent)
|
|
||||||
{
|
}
|
||||||
AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
|
|
||||||
var claims = new List<Claim>
|
|
||||||
{
|
|
||||||
new Claim(ClaimTypes.Name, user.Account),
|
|
||||||
new Claim(ClaimTypes.Role, "Administrator"),
|
|
||||||
new Claim(ClaimTypes.NameIdentifier, "7c301fe4-099e-46f9-bdb8-e922d73a8031"),
|
|
||||||
new Claim("http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider",
|
|
||||||
"ASP.NET Identity")
|
|
||||||
};
|
|
||||||
var identity = new ClaimsIdentity(claims, DefaultAuthenticationTypes.ApplicationCookie);
|
|
||||||
AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent }, identity);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ActionResult RedirectToLocal(string returnUrl)
|
|
||||||
{
|
|
||||||
if (Url.IsLocalUrl(returnUrl))
|
|
||||||
{
|
|
||||||
return Redirect(returnUrl);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return RedirectToAction("Index", "Home");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion 帮助程序
|
|
||||||
}
|
|
||||||
}
|
}
|
35
OpenAuth.Mvc/Controllers/BaseController.cs
Normal file
35
OpenAuth.Mvc/Controllers/BaseController.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// ***********************************************************************
|
||||||
|
// Assembly : OpenAuth.Mvc
|
||||||
|
// Author : Administrator
|
||||||
|
// Created : 09-22-2015
|
||||||
|
//
|
||||||
|
// Last Modified By : Administrator
|
||||||
|
// Last Modified On : 09-22-2015
|
||||||
|
// ***********************************************************************
|
||||||
|
// <copyright file="BaseController.cs" company="">
|
||||||
|
// Copyright (c) . All rights reserved.
|
||||||
|
// </copyright>
|
||||||
|
// <summary>基础控制器,设置权限</summary>
|
||||||
|
// ***********************************************************************
|
||||||
|
|
||||||
|
using System.Web.Mvc;
|
||||||
|
using Infrastructure.Helper;
|
||||||
|
using OpenAuth.Domain;
|
||||||
|
|
||||||
|
namespace OpenAuth.Mvc.Controllers
|
||||||
|
{
|
||||||
|
public class BaseController : Controller
|
||||||
|
{
|
||||||
|
protected override void OnActionExecuting(ActionExecutingContext filterContext)
|
||||||
|
{
|
||||||
|
base.OnActionExecuting(filterContext);
|
||||||
|
|
||||||
|
#region 当Session过期自动跳出登录画面
|
||||||
|
if (SessionHelper.GetSessionUser<User>() == null)
|
||||||
|
{
|
||||||
|
Response.Redirect("~/Account/Login");
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,17 +1,17 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
|
||||||
namespace OpenAuth.Mvc.Controllers
|
namespace OpenAuth.Mvc.Controllers
|
||||||
{
|
{
|
||||||
public class HomeController : Controller
|
public class HomeController : BaseController
|
||||||
{
|
{
|
||||||
public ActionResult Index()
|
public ActionResult Index()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,327 +1,331 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProductVersion>
|
<ProductVersion>
|
||||||
</ProductVersion>
|
</ProductVersion>
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
<ProjectGuid>{2A9D9687-1822-41CF-B7DF-819BFC0F8FE9}</ProjectGuid>
|
<ProjectGuid>{2A9D9687-1822-41CF-B7DF-819BFC0F8FE9}</ProjectGuid>
|
||||||
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>OpenAuth.Mvc</RootNamespace>
|
<RootNamespace>OpenAuth.Mvc</RootNamespace>
|
||||||
<AssemblyName>OpenAuth.Mvc</AssemblyName>
|
<AssemblyName>OpenAuth.Mvc</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
<MvcBuildViews>false</MvcBuildViews>
|
<MvcBuildViews>false</MvcBuildViews>
|
||||||
<UseIISExpress>true</UseIISExpress>
|
<UseIISExpress>true</UseIISExpress>
|
||||||
<IISExpressSSLPort />
|
<IISExpressSSLPort />
|
||||||
<IISExpressAnonymousAuthentication />
|
<IISExpressAnonymousAuthentication />
|
||||||
<IISExpressWindowsAuthentication />
|
<IISExpressWindowsAuthentication />
|
||||||
<IISExpressUseClassicPipelineMode />
|
<IISExpressUseClassicPipelineMode />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>bin\</OutputPath>
|
<OutputPath>bin\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>bin\</OutputPath>
|
<OutputPath>bin\</OutputPath>
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Autofac">
|
<Reference Include="Autofac">
|
||||||
<HintPath>..\packages\Autofac.3.5.2\lib\net40\Autofac.dll</HintPath>
|
<HintPath>..\packages\Autofac.3.5.2\lib\net40\Autofac.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Autofac.Integration.Mvc">
|
<Reference Include="Autofac.Integration.Mvc">
|
||||||
<HintPath>..\packages\Autofac.Mvc5.3.3.4\lib\net45\Autofac.Integration.Mvc.dll</HintPath>
|
<HintPath>..\packages\Autofac.Mvc5.3.3.4\lib\net45\Autofac.Integration.Mvc.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Web.DynamicData" />
|
<Reference Include="System.Web.DynamicData" />
|
||||||
<Reference Include="System.Web.Entity" />
|
<Reference Include="System.Web.Entity" />
|
||||||
<Reference Include="System.Web.ApplicationServices" />
|
<Reference Include="System.Web.ApplicationServices" />
|
||||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.1.2\lib\net45\System.Web.Helpers.dll</HintPath>
|
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.1.2\lib\net45\System.Web.Helpers.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.1.3\lib\net45\System.Web.Mvc.dll</HintPath>
|
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.1.3\lib\net45\System.Web.Mvc.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\Microsoft.AspNet.Razor.3.1.2\lib\net45\System.Web.Razor.dll</HintPath>
|
<HintPath>..\packages\Microsoft.AspNet.Razor.3.1.2\lib\net45\System.Web.Razor.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.1.2\lib\net45\System.Web.WebPages.dll</HintPath>
|
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.1.2\lib\net45\System.Web.WebPages.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.1.2\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
|
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.1.2\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.1.2\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
|
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.1.2\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Web" />
|
<Reference Include="System.Web" />
|
||||||
<Reference Include="System.Web.Extensions" />
|
<Reference Include="System.Web.Extensions" />
|
||||||
<Reference Include="System.Web.Abstractions" />
|
<Reference Include="System.Web.Abstractions" />
|
||||||
<Reference Include="System.Web.Routing" />
|
<Reference Include="System.Web.Routing" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Web.Services" />
|
<Reference Include="System.Web.Services" />
|
||||||
<Reference Include="System.EnterpriseServices" />
|
<Reference Include="System.EnterpriseServices" />
|
||||||
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Net.Http">
|
<Reference Include="System.Net.Http">
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Net.Http.WebRequest">
|
<Reference Include="System.Net.Http.WebRequest">
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Web.Optimization">
|
<Reference Include="System.Web.Optimization">
|
||||||
<HintPath>..\packages\Microsoft.AspNet.Web.Optimization.1.1.1\lib\net40\System.Web.Optimization.dll</HintPath>
|
<HintPath>..\packages\Microsoft.AspNet.Web.Optimization.1.1.1\lib\net40\System.Web.Optimization.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="WebGrease">
|
<Reference Include="WebGrease">
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
<HintPath>..\packages\WebGrease.1.5.2\lib\WebGrease.dll</HintPath>
|
<HintPath>..\packages\WebGrease.1.5.2\lib\WebGrease.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Antlr3.Runtime">
|
<Reference Include="Antlr3.Runtime">
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
<HintPath>..\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll</HintPath>
|
<HintPath>..\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="EntityFramework">
|
<Reference Include="EntityFramework">
|
||||||
<HintPath>..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll</HintPath>
|
<HintPath>..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="EntityFramework.SqlServer">
|
<Reference Include="EntityFramework.SqlServer">
|
||||||
<HintPath>..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
|
<HintPath>..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.AspNet.Identity.Core">
|
<Reference Include="Microsoft.AspNet.Identity.Core">
|
||||||
<HintPath>..\packages\Microsoft.AspNet.Identity.Core.1.0.0\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
|
<HintPath>..\packages\Microsoft.AspNet.Identity.Core.1.0.0\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.AspNet.Identity.Owin">
|
<Reference Include="Microsoft.AspNet.Identity.Owin">
|
||||||
<HintPath>..\packages\Microsoft.AspNet.Identity.Owin.1.0.0\lib\net45\Microsoft.AspNet.Identity.Owin.dll</HintPath>
|
<HintPath>..\packages\Microsoft.AspNet.Identity.Owin.1.0.0\lib\net45\Microsoft.AspNet.Identity.Owin.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.AspNet.Identity.EntityFramework">
|
<Reference Include="Microsoft.AspNet.Identity.EntityFramework">
|
||||||
<HintPath>..\packages\Microsoft.AspNet.Identity.EntityFramework.1.0.0\lib\net45\Microsoft.AspNet.Identity.EntityFramework.dll</HintPath>
|
<HintPath>..\packages\Microsoft.AspNet.Identity.EntityFramework.1.0.0\lib\net45\Microsoft.AspNet.Identity.EntityFramework.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Owin">
|
<Reference Include="Owin">
|
||||||
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Owin">
|
<Reference Include="Microsoft.Owin">
|
||||||
<HintPath>..\packages\Microsoft.Owin.2.0.0\lib\net45\Microsoft.Owin.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Owin.2.0.0\lib\net45\Microsoft.Owin.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Owin.Host.SystemWeb">
|
<Reference Include="Microsoft.Owin.Host.SystemWeb">
|
||||||
<HintPath>..\packages\Microsoft.Owin.Host.SystemWeb.2.0.0\lib\net45\Microsoft.Owin.Host.SystemWeb.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Owin.Host.SystemWeb.2.0.0\lib\net45\Microsoft.Owin.Host.SystemWeb.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Owin.Security">
|
<Reference Include="Microsoft.Owin.Security">
|
||||||
<HintPath>..\packages\Microsoft.Owin.Security.2.0.0\lib\net45\Microsoft.Owin.Security.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Owin.Security.2.0.0\lib\net45\Microsoft.Owin.Security.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Owin.Security.Facebook">
|
<Reference Include="Microsoft.Owin.Security.Facebook">
|
||||||
<HintPath>..\packages\Microsoft.Owin.Security.Facebook.2.0.0\lib\net45\Microsoft.Owin.Security.Facebook.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Owin.Security.Facebook.2.0.0\lib\net45\Microsoft.Owin.Security.Facebook.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Owin.Security.Cookies">
|
<Reference Include="Microsoft.Owin.Security.Cookies">
|
||||||
<HintPath>..\packages\Microsoft.Owin.Security.Cookies.2.0.0\lib\net45\Microsoft.Owin.Security.Cookies.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Owin.Security.Cookies.2.0.0\lib\net45\Microsoft.Owin.Security.Cookies.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Owin.Security.OAuth">
|
<Reference Include="Microsoft.Owin.Security.OAuth">
|
||||||
<HintPath>..\packages\Microsoft.Owin.Security.OAuth.2.0.0\lib\net45\Microsoft.Owin.Security.OAuth.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Owin.Security.OAuth.2.0.0\lib\net45\Microsoft.Owin.Security.OAuth.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Owin.Security.Google">
|
<Reference Include="Microsoft.Owin.Security.Google">
|
||||||
<HintPath>..\packages\Microsoft.Owin.Security.Google.2.0.0\lib\net45\Microsoft.Owin.Security.Google.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Owin.Security.Google.2.0.0\lib\net45\Microsoft.Owin.Security.Google.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Owin.Security.Twitter">
|
<Reference Include="Microsoft.Owin.Security.Twitter">
|
||||||
<HintPath>..\packages\Microsoft.Owin.Security.Twitter.2.0.0\lib\net45\Microsoft.Owin.Security.Twitter.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Owin.Security.Twitter.2.0.0\lib\net45\Microsoft.Owin.Security.Twitter.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Owin.Security.MicrosoftAccount">
|
<Reference Include="Microsoft.Owin.Security.MicrosoftAccount">
|
||||||
<HintPath>..\packages\Microsoft.Owin.Security.MicrosoftAccount.2.0.0\lib\net45\Microsoft.Owin.Security.MicrosoftAccount.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Owin.Security.MicrosoftAccount.2.0.0\lib\net45\Microsoft.Owin.Security.MicrosoftAccount.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="App_Start\BundleConfig.cs" />
|
<Compile Include="App_Start\BundleConfig.cs" />
|
||||||
<Compile Include="App_Start\FilterConfig.cs" />
|
<Compile Include="App_Start\FilterConfig.cs" />
|
||||||
<Compile Include="App_Start\RouteConfig.cs" />
|
<Compile Include="App_Start\RouteConfig.cs" />
|
||||||
<Compile Include="App_Start\Startup.Auth.cs" />
|
<Compile Include="Controllers\AccountController.cs" />
|
||||||
<Compile Include="Controllers\AccountController.cs" />
|
<Compile Include="Controllers\BaseController.cs" />
|
||||||
<Compile Include="Controllers\HomeController.cs" />
|
<Compile Include="Controllers\HomeController.cs" />
|
||||||
<Compile Include="Global.asax.cs">
|
<Compile Include="Global.asax.cs">
|
||||||
<DependentUpon>Global.asax</DependentUpon>
|
<DependentUpon>Global.asax</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Models\AccountViewModels.cs" />
|
<Compile Include="Models\AccountViewModels.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Startup.cs" />
|
</ItemGroup>
|
||||||
</ItemGroup>
|
<ItemGroup>
|
||||||
<ItemGroup>
|
<Content Include="assets\avatars\avatar.png" />
|
||||||
<Content Include="assets\avatars\avatar.png" />
|
<Content Include="assets\avatars\profile-pic.jpg" />
|
||||||
<Content Include="assets\avatars\profile-pic.jpg" />
|
<Content Include="assets\avatars\user.jpg" />
|
||||||
<Content Include="assets\avatars\user.jpg" />
|
<Content Include="assets\css\ace-ie.min.css" />
|
||||||
<Content Include="assets\css\ace-ie.min.css" />
|
<Content Include="assets\css\ace-rtl.min.css" />
|
||||||
<Content Include="assets\css\ace-rtl.min.css" />
|
<Content Include="assets\css\ace-skins.min.css" />
|
||||||
<Content Include="assets\css\ace-skins.min.css" />
|
<Content Include="assets\css\ace.min.css" />
|
||||||
<Content Include="assets\css\ace.min.css" />
|
<Content Include="assets\css\bootstrap-editable.css" />
|
||||||
<Content Include="assets\css\bootstrap-editable.css" />
|
<Content Include="assets\css\bootstrap-timepicker.css" />
|
||||||
<Content Include="assets\css\bootstrap-timepicker.css" />
|
<Content Include="assets\css\bootstrap.min.css" />
|
||||||
<Content Include="assets\css\bootstrap.min.css" />
|
<Content Include="assets\css\chosen.css" />
|
||||||
<Content Include="assets\css\chosen.css" />
|
<Content Include="assets\css\colorbox.css" />
|
||||||
<Content Include="assets\css\colorbox.css" />
|
<Content Include="assets\css\colorpicker.css" />
|
||||||
<Content Include="assets\css\colorpicker.css" />
|
<Content Include="assets\css\datepicker.css" />
|
||||||
<Content Include="assets\css\datepicker.css" />
|
<Content Include="assets\css\daterangepicker.css" />
|
||||||
<Content Include="assets\css\daterangepicker.css" />
|
<Content Include="assets\css\dropzone.css" />
|
||||||
<Content Include="assets\css\dropzone.css" />
|
<Content Include="assets\css\font-awesome-ie7.min.css" />
|
||||||
<Content Include="assets\css\font-awesome-ie7.min.css" />
|
<Content Include="assets\css\font-awesome.min.css" />
|
||||||
<Content Include="assets\css\font-awesome.min.css" />
|
<Content Include="assets\css\fullcalendar.css" />
|
||||||
<Content Include="assets\css\fullcalendar.css" />
|
<Content Include="assets\css\images\loading.gif" />
|
||||||
<Content Include="assets\css\images\loading.gif" />
|
<Content Include="assets\css\jquery-ui-1.10.3.custom.min.css" />
|
||||||
<Content Include="assets\css\jquery-ui-1.10.3.custom.min.css" />
|
<Content Include="assets\css\jquery-ui-1.10.3.full.min.css" />
|
||||||
<Content Include="assets\css\jquery-ui-1.10.3.full.min.css" />
|
<Content Include="assets\css\jquery.gritter.css" />
|
||||||
<Content Include="assets\css\jquery.gritter.css" />
|
<Content Include="assets\css\select2.css" />
|
||||||
<Content Include="assets\css\select2.css" />
|
<Content Include="assets\css\ui.jqgrid.css" />
|
||||||
<Content Include="assets\css\ui.jqgrid.css" />
|
<Content Include="assets\js\ace-elements.min.js" />
|
||||||
<Content Include="assets\js\ace-elements.min.js" />
|
<Content Include="assets\js\ace-extra.min.js" />
|
||||||
<Content Include="assets\js\ace-extra.min.js" />
|
<Content Include="assets\js\ace.min.js" />
|
||||||
<Content Include="assets\js\ace.min.js" />
|
<Content Include="assets\js\additional-methods.min.js" />
|
||||||
<Content Include="assets\js\additional-methods.min.js" />
|
<Content Include="assets\js\bootbox.min.js" />
|
||||||
<Content Include="assets\js\bootbox.min.js" />
|
<Content Include="assets\js\bootstrap-colorpicker.min.js" />
|
||||||
<Content Include="assets\js\bootstrap-colorpicker.min.js" />
|
<Content Include="assets\js\bootstrap-tag.min.js" />
|
||||||
<Content Include="assets\js\bootstrap-tag.min.js" />
|
<Content Include="assets\js\bootstrap-wysiwyg.min.js" />
|
||||||
<Content Include="assets\js\bootstrap-wysiwyg.min.js" />
|
<Content Include="assets\js\bootstrap.min.js" />
|
||||||
<Content Include="assets\js\bootstrap.min.js" />
|
<Content Include="assets\js\chosen.jquery.min.js" />
|
||||||
<Content Include="assets\js\chosen.jquery.min.js" />
|
<Content Include="assets\js\date-time\bootstrap-datepicker.min.js" />
|
||||||
<Content Include="assets\js\date-time\bootstrap-datepicker.min.js" />
|
<Content Include="assets\js\date-time\bootstrap-timepicker.min.js" />
|
||||||
<Content Include="assets\js\date-time\bootstrap-timepicker.min.js" />
|
<Content Include="assets\js\date-time\daterangepicker.min.js" />
|
||||||
<Content Include="assets\js\date-time\daterangepicker.min.js" />
|
<Content Include="assets\js\date-time\moment.min.js" />
|
||||||
<Content Include="assets\js\date-time\moment.min.js" />
|
<Content Include="assets\js\dropzone.min.js" />
|
||||||
<Content Include="assets\js\dropzone.min.js" />
|
<Content Include="assets\js\excanvas.min.js" />
|
||||||
<Content Include="assets\js\excanvas.min.js" />
|
<Content Include="assets\js\flot\jquery.flot.min.js" />
|
||||||
<Content Include="assets\js\flot\jquery.flot.min.js" />
|
<Content Include="assets\js\flot\jquery.flot.pie.min.js" />
|
||||||
<Content Include="assets\js\flot\jquery.flot.pie.min.js" />
|
<Content Include="assets\js\flot\jquery.flot.resize.min.js" />
|
||||||
<Content Include="assets\js\flot\jquery.flot.resize.min.js" />
|
<Content Include="assets\js\fuelux\data\fuelux.tree-sampledata.js" />
|
||||||
<Content Include="assets\js\fuelux\data\fuelux.tree-sampledata.js" />
|
<Content Include="assets\js\fuelux\fuelux.spinner.min.js" />
|
||||||
<Content Include="assets\js\fuelux\fuelux.spinner.min.js" />
|
<Content Include="assets\js\fuelux\fuelux.tree.min.js" />
|
||||||
<Content Include="assets\js\fuelux\fuelux.tree.min.js" />
|
<Content Include="assets\js\fuelux\fuelux.wizard.min.js" />
|
||||||
<Content Include="assets\js\fuelux\fuelux.wizard.min.js" />
|
<Content Include="assets\js\fullcalendar.min.js" />
|
||||||
<Content Include="assets\js\fullcalendar.min.js" />
|
<Content Include="assets\js\html5shiv.js" />
|
||||||
<Content Include="assets\js\html5shiv.js" />
|
<Content Include="assets\js\jqGrid\i18n\grid.locale-en.js" />
|
||||||
<Content Include="assets\js\jqGrid\i18n\grid.locale-en.js" />
|
<Content Include="assets\js\jqGrid\jquery.jqGrid.min.js" />
|
||||||
<Content Include="assets\js\jqGrid\jquery.jqGrid.min.js" />
|
<Content Include="assets\js\jquery-1.10.2.min.js" />
|
||||||
<Content Include="assets\js\jquery-1.10.2.min.js" />
|
<Content Include="assets\js\jquery-2.0.3.min.js" />
|
||||||
<Content Include="assets\js\jquery-2.0.3.min.js" />
|
<Content Include="assets\js\jquery-ui-1.10.3.custom.min.js" />
|
||||||
<Content Include="assets\js\jquery-ui-1.10.3.custom.min.js" />
|
<Content Include="assets\js\jquery-ui-1.10.3.full.min.js" />
|
||||||
<Content Include="assets\js\jquery-ui-1.10.3.full.min.js" />
|
<Content Include="assets\js\jquery.autosize.min.js" />
|
||||||
<Content Include="assets\js\jquery.autosize.min.js" />
|
<Content Include="assets\js\jquery.colorbox-min.js" />
|
||||||
<Content Include="assets\js\jquery.colorbox-min.js" />
|
<Content Include="assets\js\jquery.dataTables.bootstrap.js" />
|
||||||
<Content Include="assets\js\jquery.dataTables.bootstrap.js" />
|
<Content Include="assets\js\jquery.dataTables.min.js" />
|
||||||
<Content Include="assets\js\jquery.dataTables.min.js" />
|
<Content Include="assets\js\jquery.easy-pie-chart.min.js" />
|
||||||
<Content Include="assets\js\jquery.easy-pie-chart.min.js" />
|
<Content Include="assets\js\jquery.gritter.min.js" />
|
||||||
<Content Include="assets\js\jquery.gritter.min.js" />
|
<Content Include="assets\js\jquery.hotkeys.min.js" />
|
||||||
<Content Include="assets\js\jquery.hotkeys.min.js" />
|
<Content Include="assets\js\jquery.inputlimiter.1.3.1.min.js" />
|
||||||
<Content Include="assets\js\jquery.inputlimiter.1.3.1.min.js" />
|
<Content Include="assets\js\jquery.knob.min.js" />
|
||||||
<Content Include="assets\js\jquery.knob.min.js" />
|
<Content Include="assets\js\jquery.maskedinput.min.js" />
|
||||||
<Content Include="assets\js\jquery.maskedinput.min.js" />
|
<Content Include="assets\js\jquery.mobile.custom.min.js" />
|
||||||
<Content Include="assets\js\jquery.mobile.custom.min.js" />
|
<Content Include="assets\js\jquery.nestable.min.js" />
|
||||||
<Content Include="assets\js\jquery.nestable.min.js" />
|
<Content Include="assets\js\jquery.slimscroll.min.js" />
|
||||||
<Content Include="assets\js\jquery.slimscroll.min.js" />
|
<Content Include="assets\js\jquery.sparkline.min.js" />
|
||||||
<Content Include="assets\js\jquery.sparkline.min.js" />
|
<Content Include="assets\js\jquery.ui.touch-punch.min.js" />
|
||||||
<Content Include="assets\js\jquery.ui.touch-punch.min.js" />
|
<Content Include="assets\js\jquery.validate.min.js" />
|
||||||
<Content Include="assets\js\jquery.validate.min.js" />
|
<Content Include="assets\js\markdown\bootstrap-markdown.min.js" />
|
||||||
<Content Include="assets\js\markdown\bootstrap-markdown.min.js" />
|
<Content Include="assets\js\markdown\markdown.min.js" />
|
||||||
<Content Include="assets\js\markdown\markdown.min.js" />
|
<Content Include="assets\js\respond.min.js" />
|
||||||
<Content Include="assets\js\respond.min.js" />
|
<Content Include="assets\js\select2.min.js" />
|
||||||
<Content Include="assets\js\select2.min.js" />
|
<Content Include="assets\js\typeahead-bs2.min.js" />
|
||||||
<Content Include="assets\js\typeahead-bs2.min.js" />
|
<Content Include="assets\js\x-editable\ace-editable.min.js" />
|
||||||
<Content Include="assets\js\x-editable\ace-editable.min.js" />
|
<Content Include="assets\js\x-editable\bootstrap-editable.min.js" />
|
||||||
<Content Include="assets\js\x-editable\bootstrap-editable.min.js" />
|
<Content Include="favicon.ico" />
|
||||||
<Content Include="favicon.ico" />
|
<Content Include="Global.asax" />
|
||||||
<Content Include="Global.asax" />
|
<Content Include="assets\font\fontawesome-webfont.woff" />
|
||||||
<Content Include="assets\font\fontawesome-webfont.woff" />
|
<Content Include="Web.config" />
|
||||||
<Content Include="Web.config" />
|
<Content Include="Web.Debug.config">
|
||||||
<Content Include="Web.Debug.config">
|
<DependentUpon>Web.config</DependentUpon>
|
||||||
<DependentUpon>Web.config</DependentUpon>
|
</Content>
|
||||||
</Content>
|
<Content Include="Web.Release.config">
|
||||||
<Content Include="Web.Release.config">
|
<DependentUpon>Web.config</DependentUpon>
|
||||||
<DependentUpon>Web.config</DependentUpon>
|
</Content>
|
||||||
</Content>
|
<Content Include="Views\Web.config" />
|
||||||
<Content Include="Views\Web.config" />
|
<Content Include="Views\_ViewStart.cshtml" />
|
||||||
<Content Include="Views\_ViewStart.cshtml" />
|
<Content Include="Views\Shared\_Layout.cshtml" />
|
||||||
<Content Include="Views\Shared\_Layout.cshtml" />
|
<Content Include="Views\Home\Index.cshtml" />
|
||||||
<Content Include="Views\Home\Index.cshtml" />
|
<Content Include="Views\Account\Login.cshtml" />
|
||||||
<Content Include="Views\Account\Login.cshtml" />
|
<Content Include="Views\Account\List.cshtml" />
|
||||||
<Content Include="Views\Account\List.cshtml" />
|
</ItemGroup>
|
||||||
</ItemGroup>
|
<ItemGroup>
|
||||||
<ItemGroup>
|
<Folder Include="App_Data\" />
|
||||||
<Folder Include="App_Data\" />
|
<Folder Include="Views\Base\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="packages.config" />
|
<Content Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenAuth.App\OpenAuth.App.csproj">
|
<ProjectReference Include="..\Infrastructure\Infrastructure.csproj">
|
||||||
<Project>{0bbf2d65-fffd-4272-b138-8ea4fb6fec48}</Project>
|
<Project>{5feaec9a-4f1e-4ee7-b377-9db1b0870dac}</Project>
|
||||||
<Name>OpenAuth.App</Name>
|
<Name>Infrastructure</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\OpenAuth.Domain\OpenAuth.Domain.csproj">
|
<ProjectReference Include="..\OpenAuth.App\OpenAuth.App.csproj">
|
||||||
<Project>{6108da8e-92a1-4abe-b9f5-26d64d55ca2c}</Project>
|
<Project>{0bbf2d65-fffd-4272-b138-8ea4fb6fec48}</Project>
|
||||||
<Name>OpenAuth.Domain</Name>
|
<Name>OpenAuth.App</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\OpenAuth.Repository\OpenAuth.Repository.csproj">
|
<ProjectReference Include="..\OpenAuth.Domain\OpenAuth.Domain.csproj">
|
||||||
<Project>{e8df8dea-e2cf-4bdb-8f4f-3f8205b0e03a}</Project>
|
<Project>{6108da8e-92a1-4abe-b9f5-26d64d55ca2c}</Project>
|
||||||
<Name>OpenAuth.Repository</Name>
|
<Name>OpenAuth.Domain</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
<ProjectReference Include="..\OpenAuth.Repository\OpenAuth.Repository.csproj">
|
||||||
<PropertyGroup>
|
<Project>{e8df8dea-e2cf-4bdb-8f4f-3f8205b0e03a}</Project>
|
||||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
<Name>OpenAuth.Repository</Name>
|
||||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
</ProjectReference>
|
||||||
</PropertyGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<PropertyGroup>
|
||||||
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
|
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||||
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
|
</PropertyGroup>
|
||||||
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
</Target>
|
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||||
<ProjectExtensions>
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
|
||||||
<VisualStudio>
|
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
|
||||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
|
||||||
<WebProjectProperties>
|
</Target>
|
||||||
<UseIIS>True</UseIIS>
|
<ProjectExtensions>
|
||||||
<AutoAssignPort>True</AutoAssignPort>
|
<VisualStudio>
|
||||||
<DevelopmentServerPort>56813</DevelopmentServerPort>
|
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
||||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
<WebProjectProperties>
|
||||||
<IISUrl>http://localhost:56813/</IISUrl>
|
<UseIIS>True</UseIIS>
|
||||||
<NTLMAuthentication>False</NTLMAuthentication>
|
<AutoAssignPort>True</AutoAssignPort>
|
||||||
<UseCustomServer>False</UseCustomServer>
|
<DevelopmentServerPort>56813</DevelopmentServerPort>
|
||||||
<CustomServerUrl>
|
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||||
</CustomServerUrl>
|
<IISUrl>http://localhost:56813/</IISUrl>
|
||||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
<NTLMAuthentication>False</NTLMAuthentication>
|
||||||
</WebProjectProperties>
|
<UseCustomServer>False</UseCustomServer>
|
||||||
</FlavorProperties>
|
<CustomServerUrl>
|
||||||
</VisualStudio>
|
</CustomServerUrl>
|
||||||
</ProjectExtensions>
|
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
</WebProjectProperties>
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
</FlavorProperties>
|
||||||
<Target Name="BeforeBuild">
|
</VisualStudio>
|
||||||
</Target>
|
</ProjectExtensions>
|
||||||
<Target Name="AfterBuild">
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
</Target> -->
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target> -->
|
||||||
</Project>
|
</Project>
|
@ -1,14 +0,0 @@
|
|||||||
using Microsoft.Owin;
|
|
||||||
using Owin;
|
|
||||||
|
|
||||||
[assembly: OwinStartupAttribute(typeof(OpenAuth.Mvc.Startup))]
|
|
||||||
namespace OpenAuth.Mvc
|
|
||||||
{
|
|
||||||
public partial class Startup
|
|
||||||
{
|
|
||||||
public void Configuration(IAppBuilder app)
|
|
||||||
{
|
|
||||||
ConfigureAuth(app);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
30
OpenAuth.Mvc/Web.Debug.config
Normal file
30
OpenAuth.Mvc/Web.Debug.config
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<!-- 有关使用 Web.config 转换的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkId=301874 -->
|
||||||
|
|
||||||
|
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||||
|
<!--
|
||||||
|
在以下示例中, "SetAttributes" 转换将 "connectionString"
|
||||||
|
的值更改为仅在 "Match" 定位器找到具有值 "MyDB" 的
|
||||||
|
属性 "name" 时使用 "ReleaseSQLServer"。
|
||||||
|
|
||||||
|
<connectionStrings>
|
||||||
|
<add name="MyDB"
|
||||||
|
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
|
||||||
|
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
|
||||||
|
</connectionStrings>
|
||||||
|
-->
|
||||||
|
<system.web>
|
||||||
|
<!--
|
||||||
|
在以下示例中,"Replace" 转换将替换 Web.config 文件的
|
||||||
|
整个 <customErrors> 节。
|
||||||
|
请注意,由于在 <system.web> 节点下只有一个
|
||||||
|
customErrors 节,因此无需使用 "xdt:Locator" 属性。
|
||||||
|
|
||||||
|
<customErrors defaultRedirect="GenericError.htm"
|
||||||
|
mode="RemoteOnly" xdt:Transform="Replace">
|
||||||
|
<error statusCode="500" redirect="InternalError.htm"/>
|
||||||
|
</customErrors>
|
||||||
|
-->
|
||||||
|
</system.web>
|
||||||
|
</configuration>
|
31
OpenAuth.Mvc/Web.Release.config
Normal file
31
OpenAuth.Mvc/Web.Release.config
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<!-- 有关使用 Web.config 转换的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkId=301874 -->
|
||||||
|
|
||||||
|
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||||
|
<!--
|
||||||
|
在以下示例中, "SetAttributes" 转换将 "connectionString"
|
||||||
|
的值更改为仅在 "Match" 定位器找到具有值 "MyDB" 的
|
||||||
|
属性 "name" 时使用 "ReleaseSQLServer"。
|
||||||
|
|
||||||
|
<connectionStrings>
|
||||||
|
<add name="MyDB"
|
||||||
|
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
|
||||||
|
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
|
||||||
|
</connectionStrings>
|
||||||
|
-->
|
||||||
|
<system.web>
|
||||||
|
<compilation xdt:Transform="RemoveAttributes(debug)" />
|
||||||
|
<!--
|
||||||
|
在以下示例中,"Replace" 转换将替换 Web.config 文件的
|
||||||
|
整个 <customErrors> 节。
|
||||||
|
请注意,由于在 <system.web> 节点下只有一个
|
||||||
|
customErrors 节,因此无需使用 "xdt:Locator" 属性。
|
||||||
|
|
||||||
|
<customErrors defaultRedirect="GenericError.htm"
|
||||||
|
mode="RemoteOnly" xdt:Transform="Replace">
|
||||||
|
<error statusCode="500" redirect="InternalError.htm"/>
|
||||||
|
</customErrors>
|
||||||
|
-->
|
||||||
|
</system.web>
|
||||||
|
</configuration>
|
@ -0,0 +1,48 @@
|
|||||||
|
<#@ template hostspecific="true" language="C#" #>
|
||||||
|
<#@ include file="EF.Utility.CS.ttinclude" #><#@
|
||||||
|
output extension=".cs" #><#
|
||||||
|
|
||||||
|
var efHost = (EfTextTemplateHost)Host;
|
||||||
|
var code = new CodeGenerationTools(this);
|
||||||
|
#>
|
||||||
|
using System.Data.Entity;
|
||||||
|
using System.Data.Entity.Infrastructure;
|
||||||
|
using OpenAuth.Domain;
|
||||||
|
using <#= code.EscapeNamespace(efHost.MappingNamespace) #>;
|
||||||
|
|
||||||
|
namespace <#= code.EscapeNamespace(efHost.Namespace) #>
|
||||||
|
{
|
||||||
|
public partial class <#= efHost.EntityContainer.Name #> : DbContext
|
||||||
|
{
|
||||||
|
static <#= efHost.EntityContainer.Name #>()
|
||||||
|
{
|
||||||
|
Database.SetInitializer<<#= efHost.EntityContainer.Name #>>(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <#= efHost.EntityContainer.Name #>()
|
||||||
|
: base("Name=<#= efHost.EntityContainer.Name #>")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
foreach (var set in efHost.EntityContainer.BaseEntitySets.OfType<EntitySet>())
|
||||||
|
{
|
||||||
|
#>
|
||||||
|
public DbSet<<#= set.ElementType.Name #>> <#= set.Name #> { get; set; }
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
#>
|
||||||
|
|
||||||
|
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
<#
|
||||||
|
foreach (var set in efHost.EntityContainer.BaseEntitySets.OfType<EntitySet>())
|
||||||
|
{
|
||||||
|
#>
|
||||||
|
modelBuilder.Configurations.Add(new <#= set.ElementType.Name #>Map());
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
#>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,75 @@
|
|||||||
|
<#@ template hostspecific="true" language="C#" #>
|
||||||
|
<#@ include file="EF.Utility.CS.ttinclude" #><#@
|
||||||
|
output extension=".cs" #><#
|
||||||
|
|
||||||
|
var efHost = (EfTextTemplateHost)Host;
|
||||||
|
var code = new CodeGenerationTools(this);
|
||||||
|
#>
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace OpenAuth.Domain
|
||||||
|
{
|
||||||
|
public partial class <#= efHost.EntityType.Name #>
|
||||||
|
{
|
||||||
|
<#
|
||||||
|
var collectionNavigations = efHost.EntityType.NavigationProperties.Where(
|
||||||
|
np => np.DeclaringType == efHost.EntityType
|
||||||
|
&& np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
|
||||||
|
|
||||||
|
// Add a ctor to initialize any collections
|
||||||
|
if (collectionNavigations.Any())
|
||||||
|
{
|
||||||
|
#>
|
||||||
|
public <#= code.Escape(efHost.EntityType) #>()
|
||||||
|
{
|
||||||
|
<#
|
||||||
|
foreach (var navProperty in collectionNavigations)
|
||||||
|
{
|
||||||
|
#>
|
||||||
|
this.<#= code.Escape(navProperty) #> = new List<<#= code.Escape(navProperty.ToEndMember.GetEntityType()) #>>();
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
#>
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var property in efHost.EntityType.Properties)
|
||||||
|
{
|
||||||
|
var typeUsage = code.Escape(property.TypeUsage);
|
||||||
|
|
||||||
|
// Fix-up spatial types for EF6
|
||||||
|
if (efHost.EntityFrameworkVersion >= new Version(6, 0)
|
||||||
|
&& typeUsage.StartsWith("System.Data.Spatial."))
|
||||||
|
{
|
||||||
|
typeUsage = typeUsage.Replace(
|
||||||
|
"System.Data.Spatial.",
|
||||||
|
"System.Data.Entity.Spatial.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#>
|
||||||
|
<#= Accessibility.ForProperty(property) #> <#= typeUsage #> <#= code.Escape(property) #> { get; set; }
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var navProperty in efHost.EntityType.NavigationProperties.Where(np => np.DeclaringType == efHost.EntityType))
|
||||||
|
{
|
||||||
|
if (navProperty.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many)
|
||||||
|
{
|
||||||
|
#>
|
||||||
|
public virtual ICollection<<#= code.Escape(navProperty.ToEndMember.GetEntityType()) #>> <#= code.Escape(navProperty) #> { get; set; }
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#>
|
||||||
|
public virtual <#= code.Escape(navProperty.ToEndMember.GetEntityType()) #> <#= code.Escape(navProperty) #> { get; set; }
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#>
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,269 @@
|
|||||||
|
<#
|
||||||
|
// Simplifying assumptions based on reverse engineer rules
|
||||||
|
// - No complex types
|
||||||
|
// - One entity container
|
||||||
|
// - No inheritance
|
||||||
|
// - Always have two navigation properties
|
||||||
|
// - All associations expose FKs (except many:many)
|
||||||
|
#>
|
||||||
|
<#@ template hostspecific="true" language="C#" #>
|
||||||
|
<#@ include file="EF.Utility.CS.ttinclude" #><#@
|
||||||
|
output extension=".cs" #><#
|
||||||
|
|
||||||
|
var efHost = (EfTextTemplateHost)Host;
|
||||||
|
var code = new CodeGenerationTools(this);
|
||||||
|
|
||||||
|
if (efHost.EntityFrameworkVersion >= new Version(4, 4))
|
||||||
|
{
|
||||||
|
#>
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#>
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
#>
|
||||||
|
using System.Data.Entity.ModelConfiguration;
|
||||||
|
using OpenAuth.Domain;
|
||||||
|
|
||||||
|
namespace <#= code.EscapeNamespace(efHost.Namespace) #>
|
||||||
|
{
|
||||||
|
public class <#= efHost.EntityType.Name #>Map : EntityTypeConfiguration<<#= efHost.EntityType.Name #>>
|
||||||
|
{
|
||||||
|
public <#= efHost.EntityType.Name #>Map()
|
||||||
|
{
|
||||||
|
// Primary Key
|
||||||
|
<#
|
||||||
|
if (efHost.EntityType.KeyMembers.Count() == 1)
|
||||||
|
{
|
||||||
|
#>
|
||||||
|
this.HasKey(t => t.<#= efHost.EntityType.KeyMembers.Single().Name #>);
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#>
|
||||||
|
this.HasKey(t => new { <#= string.Join(", ", efHost.EntityType.KeyMembers.Select(m => "t." + m.Name)) #> });
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
#>
|
||||||
|
|
||||||
|
// Properties
|
||||||
|
<#
|
||||||
|
foreach (var prop in efHost.EntityType.Properties)
|
||||||
|
{
|
||||||
|
var type = (PrimitiveType)prop.TypeUsage.EdmType;
|
||||||
|
var isKey = efHost.EntityType.KeyMembers.Contains(prop);
|
||||||
|
var storeProp = efHost.PropertyToColumnMappings[prop];
|
||||||
|
var sgpFacet = storeProp.TypeUsage.Facets.SingleOrDefault(f => f.Name == "StoreGeneratedPattern");
|
||||||
|
var storeGeneratedPattern = sgpFacet == null
|
||||||
|
? StoreGeneratedPattern.None
|
||||||
|
: (StoreGeneratedPattern)sgpFacet.Value;
|
||||||
|
|
||||||
|
var configLines = new List<string>();
|
||||||
|
|
||||||
|
if (type.ClrEquivalentType == typeof(int)
|
||||||
|
|| type.ClrEquivalentType == typeof(decimal)
|
||||||
|
|| type.ClrEquivalentType == typeof(short)
|
||||||
|
|| type.ClrEquivalentType == typeof(long))
|
||||||
|
{
|
||||||
|
if (isKey && storeGeneratedPattern != StoreGeneratedPattern.Identity)
|
||||||
|
{
|
||||||
|
configLines.Add(".HasDatabaseGeneratedOption(DatabaseGeneratedOption.None)");
|
||||||
|
}
|
||||||
|
else if ((!isKey || efHost.EntityType.KeyMembers.Count > 1) && storeGeneratedPattern == StoreGeneratedPattern.Identity)
|
||||||
|
{
|
||||||
|
configLines.Add(".HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type.ClrEquivalentType == typeof(string)
|
||||||
|
|| type.ClrEquivalentType == typeof(byte[]))
|
||||||
|
{
|
||||||
|
if (!prop.Nullable)
|
||||||
|
{
|
||||||
|
configLines.Add(".IsRequired()");
|
||||||
|
}
|
||||||
|
|
||||||
|
var unicodeFacet = (Facet)prop.TypeUsage.Facets.SingleOrDefault(f => f.Name == "IsUnicode");
|
||||||
|
if(unicodeFacet != null && !(bool)unicodeFacet.Value)
|
||||||
|
{
|
||||||
|
configLines.Add(".IsUnicode(false)");
|
||||||
|
}
|
||||||
|
|
||||||
|
var fixedLengthFacet = (Facet)prop.TypeUsage.Facets.SingleOrDefault(f => f.Name == "FixedLength");
|
||||||
|
if (fixedLengthFacet != null && (bool)fixedLengthFacet.Value)
|
||||||
|
{
|
||||||
|
configLines.Add(".IsFixedLength()");
|
||||||
|
}
|
||||||
|
|
||||||
|
var maxLengthFacet = (Facet)prop.TypeUsage.Facets.SingleOrDefault(f => f.Name == "MaxLength");
|
||||||
|
if (maxLengthFacet != null && !maxLengthFacet.IsUnbounded)
|
||||||
|
{
|
||||||
|
configLines.Add(string.Format(".HasMaxLength({0})", maxLengthFacet.Value));
|
||||||
|
|
||||||
|
if (storeGeneratedPattern == StoreGeneratedPattern.Computed
|
||||||
|
&& type.ClrEquivalentType == typeof(byte[])
|
||||||
|
&& (int)maxLengthFacet.Value == 8)
|
||||||
|
{
|
||||||
|
configLines.Add(".IsRowVersion()");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(configLines.Any())
|
||||||
|
{
|
||||||
|
#>
|
||||||
|
this.Property(t => t.<#= prop.Name #>)
|
||||||
|
<#= string.Join("\r\n ", configLines) #>;
|
||||||
|
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var tableSet = efHost.TableSet;
|
||||||
|
var tableName = (string)tableSet.MetadataProperties["Table"].Value
|
||||||
|
?? tableSet.Name;
|
||||||
|
var schemaName = (string)tableSet.MetadataProperties["Schema"].Value;
|
||||||
|
#>
|
||||||
|
// Table & Column Mappings
|
||||||
|
<#
|
||||||
|
if (schemaName == "dbo" || string.IsNullOrWhiteSpace(schemaName))
|
||||||
|
{
|
||||||
|
#>
|
||||||
|
this.ToTable("<#= tableName #>");
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#>
|
||||||
|
this.ToTable("<#= tableName #>", "<#= schemaName #>");
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var property in efHost.EntityType.Properties)
|
||||||
|
{
|
||||||
|
#>
|
||||||
|
this.Property(t => t.<#= property.Name #>).HasColumnName("<#= efHost.PropertyToColumnMappings[property].Name #>");
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find m:m relationshipsto configure
|
||||||
|
var manyManyRelationships = efHost.EntityType.NavigationProperties
|
||||||
|
.Where(np => np.DeclaringType == efHost.EntityType
|
||||||
|
&& np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many
|
||||||
|
&& np.FromEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many
|
||||||
|
&& np.RelationshipType.RelationshipEndMembers.First() == np.FromEndMember); // <- ensures we only configure from one end
|
||||||
|
|
||||||
|
// Find FK relationships that this entity is the dependent of
|
||||||
|
var fkRelationships = efHost.EntityType.NavigationProperties
|
||||||
|
.Where(np => np.DeclaringType == efHost.EntityType
|
||||||
|
&& ((AssociationType)np.RelationshipType).IsForeignKey
|
||||||
|
&& ((AssociationType)np.RelationshipType).ReferentialConstraints.Single().ToRole == np.FromEndMember);
|
||||||
|
|
||||||
|
if(manyManyRelationships.Any() || fkRelationships.Any())
|
||||||
|
{
|
||||||
|
#>
|
||||||
|
|
||||||
|
// Relationships
|
||||||
|
<#
|
||||||
|
foreach (var navProperty in manyManyRelationships)
|
||||||
|
{
|
||||||
|
var otherNavProperty = navProperty.ToEndMember.GetEntityType().NavigationProperties.Where(n => n.RelationshipType == navProperty.RelationshipType && n != navProperty).Single();
|
||||||
|
var association = (AssociationType)navProperty.RelationshipType;
|
||||||
|
var mapping = efHost.ManyToManyMappings[association];
|
||||||
|
var item1 = mapping.Item1;
|
||||||
|
var mappingTableName = (string)mapping.Item1.MetadataProperties["Table"].Value
|
||||||
|
?? item1.Name;
|
||||||
|
var mappingSchemaName = (string)item1.MetadataProperties["Schema"].Value;
|
||||||
|
|
||||||
|
// Need to ensure that FKs are decalred in the same order as the PK properties on each principal type
|
||||||
|
var leftType = (EntityType)navProperty.DeclaringType;
|
||||||
|
var leftKeyMappings = mapping.Item2[navProperty.FromEndMember];
|
||||||
|
var leftColumns = string.Join(", ", leftType.KeyMembers.Select(m => "\"" + leftKeyMappings[m] + "\""));
|
||||||
|
var rightType = (EntityType)otherNavProperty.DeclaringType;
|
||||||
|
var rightKeyMappings = mapping.Item2[otherNavProperty.FromEndMember];
|
||||||
|
var rightColumns = string.Join(", ", rightType.KeyMembers.Select(m => "\"" + rightKeyMappings[m] + "\""));
|
||||||
|
#>
|
||||||
|
this.HasMany(t => t.<#= code.Escape(navProperty) #>)
|
||||||
|
.WithMany(t => t.<#= code.Escape(otherNavProperty) #>)
|
||||||
|
.Map(m =>
|
||||||
|
{
|
||||||
|
<#
|
||||||
|
if (mappingSchemaName == "dbo" || string.IsNullOrWhiteSpace(mappingSchemaName))
|
||||||
|
{
|
||||||
|
#>
|
||||||
|
m.ToTable("<#= mappingTableName #>");
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#>
|
||||||
|
m.ToTable("<#= mappingTableName #>", "<#= mappingSchemaName #>");
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
#>
|
||||||
|
m.MapLeftKey(<#= leftColumns #>);
|
||||||
|
m.MapRightKey(<#= rightColumns #>);
|
||||||
|
});
|
||||||
|
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var navProperty in fkRelationships)
|
||||||
|
{
|
||||||
|
var otherNavProperty = navProperty.ToEndMember.GetEntityType().NavigationProperties.Where(n => n.RelationshipType == navProperty.RelationshipType && n != navProperty).Single();
|
||||||
|
var association = (AssociationType)navProperty.RelationshipType;
|
||||||
|
|
||||||
|
if (navProperty.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.One)
|
||||||
|
{
|
||||||
|
#>
|
||||||
|
this.HasRequired(t => t.<#= code.Escape(navProperty) #>)
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#>
|
||||||
|
this.HasOptional(t => t.<#= code.Escape(navProperty) #>)
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
|
||||||
|
if(navProperty.FromEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many)
|
||||||
|
{
|
||||||
|
#>
|
||||||
|
.WithMany(t => t.<#= code.Escape(otherNavProperty) #>)
|
||||||
|
<#
|
||||||
|
if(association.ReferentialConstraints.Single().ToProperties.Count == 1)
|
||||||
|
{
|
||||||
|
#>
|
||||||
|
.HasForeignKey(d => d.<#= association.ReferentialConstraints.Single().ToProperties.Single().Name #>);
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#>
|
||||||
|
.HasForeignKey(d => new { <#= string.Join(", ", association.ReferentialConstraints.Single().ToProperties.Select(p => "d." + p.Name)) #> });
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// NOTE: We can assume that this is a required:optional relationship
|
||||||
|
// as EDMGen will never create an optional:optional relationship
|
||||||
|
// because everything is one:many except PK-PK relationships which must be required
|
||||||
|
#>
|
||||||
|
.WithOptional(t => t.<#= code.Escape(otherNavProperty) #>);
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#>
|
||||||
|
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
#>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
139
OpenAuth.sln
139
OpenAuth.sln
@ -1,66 +1,73 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 2013
|
# Visual Studio 2013
|
||||||
VisualStudioVersion = 12.0.21005.1
|
VisualStudioVersion = 12.0.21005.1
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "1 Presentation(用户UI)", "1 Presentation(用户UI)", "{57649E80-38FC-421D-82E1-BE71A786F762}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "1 Presentation(用户UI)", "1 Presentation(用户UI)", "{57649E80-38FC-421D-82E1-BE71A786F762}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "2 Application(应用层)", "2 Application(应用层)", "{757BB00A-46B6-4B9B-9331-D6B60BE92E05}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "2 Application(应用层)", "2 Application(应用层)", "{757BB00A-46B6-4B9B-9331-D6B60BE92E05}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3 Domain(领域层)", "3 Domain(领域层)", "{7618C0B1-D556-40C2-B2DD-CCECDC4E46B6}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3 Domain(领域层)", "3 Domain(领域层)", "{7618C0B1-D556-40C2-B2DD-CCECDC4E46B6}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "6 Test(测试)", "6 Test(测试)", "{C59DF46D-7815-462B-9FFF-750B2120B75B}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "6 Test(测试)", "6 Test(测试)", "{C59DF46D-7815-462B-9FFF-750B2120B75B}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAuth.App", "OpenAuth.App\OpenAuth.App.csproj", "{0BBF2D65-FFFD-4272-B138-8EA4FB6FEC48}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAuth.App", "OpenAuth.App\OpenAuth.App.csproj", "{0BBF2D65-FFFD-4272-B138-8EA4FB6FEC48}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAuth.Domain", "OpenAuth.Domain\OpenAuth.Domain.csproj", "{6108DA8E-92A1-4ABE-B9F5-26D64D55CA2C}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAuth.Domain", "OpenAuth.Domain\OpenAuth.Domain.csproj", "{6108DA8E-92A1-4ABE-B9F5-26D64D55CA2C}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAuth.UnitTest", "OpenAuth.UnitTest\OpenAuth.UnitTest.csproj", "{2E6B5B73-7757-43F0-8AC8-3030F7C191B8}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAuth.UnitTest", "OpenAuth.UnitTest\OpenAuth.UnitTest.csproj", "{2E6B5B73-7757-43F0-8AC8-3030F7C191B8}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "4 Repository(仓储)", "4 Repository(仓储)", "{7A38939E-FC9B-44A9-BD3D-E0CE438624E6}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "4 功能适配层", "4 功能适配层", "{7A38939E-FC9B-44A9-BD3D-E0CE438624E6}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAuth.Repository", "OpenAuth.Repository\OpenAuth.Repository.csproj", "{E8DF8DEA-E2CF-4BDB-8F4F-3F8205B0E03A}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAuth.Repository", "OpenAuth.Repository\OpenAuth.Repository.csproj", "{E8DF8DEA-E2CF-4BDB-8F4F-3F8205B0E03A}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAuth.Mvc", "OpenAuth.Mvc\OpenAuth.Mvc.csproj", "{2A9D9687-1822-41CF-B7DF-819BFC0F8FE9}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAuth.Mvc", "OpenAuth.Mvc\OpenAuth.Mvc.csproj", "{2A9D9687-1822-41CF-B7DF-819BFC0F8FE9}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Infrastructure", "Infrastructure\Infrastructure.csproj", "{5FEAEC9A-4F1E-4EE7-B377-9DB1B0870DAC}"
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
EndProject
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Global
|
||||||
Release|Any CPU = Release|Any CPU
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
EndGlobalSection
|
Debug|Any CPU = Debug|Any CPU
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
Release|Any CPU = Release|Any CPU
|
||||||
{0BBF2D65-FFFD-4272-B138-8EA4FB6FEC48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
EndGlobalSection
|
||||||
{0BBF2D65-FFFD-4272-B138-8EA4FB6FEC48}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{0BBF2D65-FFFD-4272-B138-8EA4FB6FEC48}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{0BBF2D65-FFFD-4272-B138-8EA4FB6FEC48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{0BBF2D65-FFFD-4272-B138-8EA4FB6FEC48}.Release|Any CPU.Build.0 = Release|Any CPU
|
{0BBF2D65-FFFD-4272-B138-8EA4FB6FEC48}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{6108DA8E-92A1-4ABE-B9F5-26D64D55CA2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{0BBF2D65-FFFD-4272-B138-8EA4FB6FEC48}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{6108DA8E-92A1-4ABE-B9F5-26D64D55CA2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{0BBF2D65-FFFD-4272-B138-8EA4FB6FEC48}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{6108DA8E-92A1-4ABE-B9F5-26D64D55CA2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{6108DA8E-92A1-4ABE-B9F5-26D64D55CA2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{6108DA8E-92A1-4ABE-B9F5-26D64D55CA2C}.Release|Any CPU.Build.0 = Release|Any CPU
|
{6108DA8E-92A1-4ABE-B9F5-26D64D55CA2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{2E6B5B73-7757-43F0-8AC8-3030F7C191B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{6108DA8E-92A1-4ABE-B9F5-26D64D55CA2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{2E6B5B73-7757-43F0-8AC8-3030F7C191B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{6108DA8E-92A1-4ABE-B9F5-26D64D55CA2C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{2E6B5B73-7757-43F0-8AC8-3030F7C191B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{2E6B5B73-7757-43F0-8AC8-3030F7C191B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{2E6B5B73-7757-43F0-8AC8-3030F7C191B8}.Release|Any CPU.Build.0 = Release|Any CPU
|
{2E6B5B73-7757-43F0-8AC8-3030F7C191B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{E8DF8DEA-E2CF-4BDB-8F4F-3F8205B0E03A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{2E6B5B73-7757-43F0-8AC8-3030F7C191B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{E8DF8DEA-E2CF-4BDB-8F4F-3F8205B0E03A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{2E6B5B73-7757-43F0-8AC8-3030F7C191B8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{E8DF8DEA-E2CF-4BDB-8F4F-3F8205B0E03A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{E8DF8DEA-E2CF-4BDB-8F4F-3F8205B0E03A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{E8DF8DEA-E2CF-4BDB-8F4F-3F8205B0E03A}.Release|Any CPU.Build.0 = Release|Any CPU
|
{E8DF8DEA-E2CF-4BDB-8F4F-3F8205B0E03A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{2A9D9687-1822-41CF-B7DF-819BFC0F8FE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{E8DF8DEA-E2CF-4BDB-8F4F-3F8205B0E03A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{2A9D9687-1822-41CF-B7DF-819BFC0F8FE9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{E8DF8DEA-E2CF-4BDB-8F4F-3F8205B0E03A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{2A9D9687-1822-41CF-B7DF-819BFC0F8FE9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{2A9D9687-1822-41CF-B7DF-819BFC0F8FE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{2A9D9687-1822-41CF-B7DF-819BFC0F8FE9}.Release|Any CPU.Build.0 = Release|Any CPU
|
{2A9D9687-1822-41CF-B7DF-819BFC0F8FE9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
EndGlobalSection
|
{2A9D9687-1822-41CF-B7DF-819BFC0F8FE9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
{2A9D9687-1822-41CF-B7DF-819BFC0F8FE9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
HideSolutionNode = FALSE
|
{5FEAEC9A-4F1E-4EE7-B377-9DB1B0870DAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
EndGlobalSection
|
{5FEAEC9A-4F1E-4EE7-B377-9DB1B0870DAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
GlobalSection(NestedProjects) = preSolution
|
{5FEAEC9A-4F1E-4EE7-B377-9DB1B0870DAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{2A9D9687-1822-41CF-B7DF-819BFC0F8FE9} = {57649E80-38FC-421D-82E1-BE71A786F762}
|
{5FEAEC9A-4F1E-4EE7-B377-9DB1B0870DAC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{0BBF2D65-FFFD-4272-B138-8EA4FB6FEC48} = {757BB00A-46B6-4B9B-9331-D6B60BE92E05}
|
EndGlobalSection
|
||||||
{6108DA8E-92A1-4ABE-B9F5-26D64D55CA2C} = {7618C0B1-D556-40C2-B2DD-CCECDC4E46B6}
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
{2E6B5B73-7757-43F0-8AC8-3030F7C191B8} = {C59DF46D-7815-462B-9FFF-750B2120B75B}
|
HideSolutionNode = FALSE
|
||||||
{E8DF8DEA-E2CF-4BDB-8F4F-3F8205B0E03A} = {7A38939E-FC9B-44A9-BD3D-E0CE438624E6}
|
EndGlobalSection
|
||||||
EndGlobalSection
|
GlobalSection(NestedProjects) = preSolution
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
{2A9D9687-1822-41CF-B7DF-819BFC0F8FE9} = {57649E80-38FC-421D-82E1-BE71A786F762}
|
||||||
EnterpriseLibraryConfigurationToolBinariesPath = packages\Unity.2.1.505.2\lib\NET35
|
{0BBF2D65-FFFD-4272-B138-8EA4FB6FEC48} = {757BB00A-46B6-4B9B-9331-D6B60BE92E05}
|
||||||
EndGlobalSection
|
{6108DA8E-92A1-4ABE-B9F5-26D64D55CA2C} = {7618C0B1-D556-40C2-B2DD-CCECDC4E46B6}
|
||||||
EndGlobal
|
{2E6B5B73-7757-43F0-8AC8-3030F7C191B8} = {C59DF46D-7815-462B-9FFF-750B2120B75B}
|
||||||
|
{E8DF8DEA-E2CF-4BDB-8F4F-3F8205B0E03A} = {7A38939E-FC9B-44A9-BD3D-E0CE438624E6}
|
||||||
|
{5FEAEC9A-4F1E-4EE7-B377-9DB1B0870DAC} = {7A38939E-FC9B-44A9-BD3D-E0CE438624E6}
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
EnterpriseLibraryConfigurationToolBinariesPath = packages\Unity.2.1.505.2\lib\NET35
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
|
Loading…
Reference in New Issue
Block a user