Podpiecie kontekstu bazy do projektu serwera
This commit is contained in:
parent
ac4ca1488b
commit
aabfa3b501
12
Trunk/Components/Forum.DataAccessLayer.Models/Answer.cs
Normal file
12
Trunk/Components/Forum.DataAccessLayer.Models/Answer.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Forum.DataAccessLayer.Models
|
||||||
|
{
|
||||||
|
class Answer
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
17
Trunk/Components/Forum.DataAccessLayer.Models/App.config
Normal file
17
Trunk/Components/Forum.DataAccessLayer.Models/App.config
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<configSections>
|
||||||
|
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||||
|
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||||
|
</configSections>
|
||||||
|
<entityFramework>
|
||||||
|
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
|
||||||
|
<parameters>
|
||||||
|
<parameter value="mssqllocaldb" />
|
||||||
|
</parameters>
|
||||||
|
</defaultConnectionFactory>
|
||||||
|
<providers>
|
||||||
|
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
|
||||||
|
</providers>
|
||||||
|
</entityFramework>
|
||||||
|
</configuration>
|
12
Trunk/Components/Forum.DataAccessLayer.Models/Category.cs
Normal file
12
Trunk/Components/Forum.DataAccessLayer.Models/Category.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Forum.DataAccessLayer.Models
|
||||||
|
{
|
||||||
|
class Category
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" 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>{9F24444B-F36F-4965-BC49-C5BF885278EE}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Forum.DataAccessLayer.Models</RootNamespace>
|
||||||
|
<AssemblyName>Forum.DataAccessLayer.Models</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<Deterministic>true</Deterministic>
|
||||||
|
</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="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\Server\Forum\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\Server\Forum\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.AspNet.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\Server\Forum\packages\Microsoft.AspNet.Identity.Core.2.2.2\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.AspNet.Identity.EntityFramework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\Server\Forum\packages\Microsoft.AspNet.Identity.EntityFramework.2.2.2\lib\net45\Microsoft.AspNet.Identity.EntityFramework.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Answer.cs" />
|
||||||
|
<Compile Include="Category.cs" />
|
||||||
|
<Compile Include="ProfessionalUser.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Question.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Security.Claims;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNet.Identity;
|
||||||
|
using Microsoft.AspNet.Identity.EntityFramework;
|
||||||
|
|
||||||
|
namespace Forum.DataAccessLayer.Models
|
||||||
|
{
|
||||||
|
public class ProfessionalUser : IdentityUser
|
||||||
|
{
|
||||||
|
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ProfessionalUser> manager)
|
||||||
|
{
|
||||||
|
// Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
|
||||||
|
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
|
||||||
|
// Add custom user claims here
|
||||||
|
return userIdentity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("Forum.DataAccessLayer.Models")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Forum.DataAccessLayer.Models")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("9f24444b-f36f-4965-bc49-c5bf885278ee")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
12
Trunk/Components/Forum.DataAccessLayer.Models/Question.cs
Normal file
12
Trunk/Components/Forum.DataAccessLayer.Models/Question.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Forum.DataAccessLayer.Models
|
||||||
|
{
|
||||||
|
class Question
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="EntityFramework" version="6.2.0" targetFramework="net461" />
|
||||||
|
<package id="Microsoft.AspNet.Identity.Core" version="2.2.2" targetFramework="net461" />
|
||||||
|
<package id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.2" targetFramework="net461" />
|
||||||
|
</packages>
|
41
Trunk/Server/Forum/Forum.DataAccessLayer/App.config
Normal file
41
Trunk/Server/Forum/Forum.DataAccessLayer/App.config
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<configSections>
|
||||||
|
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||||
|
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||||
|
</configSections>
|
||||||
|
<entityFramework>
|
||||||
|
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
|
||||||
|
<parameters>
|
||||||
|
<parameter value="mssqllocaldb" />
|
||||||
|
</parameters>
|
||||||
|
</defaultConnectionFactory>
|
||||||
|
<providers>
|
||||||
|
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
|
||||||
|
</providers>
|
||||||
|
</entityFramework>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
|
</configuration>
|
@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Forum.DataAccessLayer.Models;
|
||||||
|
using Microsoft.AspNet.Identity.EntityFramework;
|
||||||
|
|
||||||
|
namespace Forum.DataAccessLayer
|
||||||
|
{
|
||||||
|
public class ApplicationDbContext : IdentityDbContext<ProfessionalUser>
|
||||||
|
{
|
||||||
|
public ApplicationDbContext()
|
||||||
|
: base("DefaultConnection", throwIfV1Schema: false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ApplicationDbContext Create()
|
||||||
|
{
|
||||||
|
return new ApplicationDbContext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,109 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" 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>{AF3E6195-741F-46E7-BAA6-F67CD91D285A}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Forum.DataAccessLayer</RootNamespace>
|
||||||
|
<AssemblyName>Forum.DataAccessLayer</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<Deterministic>true</Deterministic>
|
||||||
|
</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="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.AspNet.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.AspNet.Identity.Core.2.2.2\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.AspNet.Identity.EntityFramework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.AspNet.Identity.EntityFramework.2.2.2\lib\net45\Microsoft.AspNet.Identity.EntityFramework.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.AspNet.Identity.Owin, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.AspNet.Identity.Owin.2.2.2\lib\net45\Microsoft.AspNet.Identity.Owin.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Owin, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Owin.4.0.0\lib\net451\Microsoft.Owin.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Owin.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Owin.Security.4.0.0\lib\net451\Microsoft.Owin.Security.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Owin.Security.Cookies, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Owin.Security.Cookies.4.0.0\lib\net451\Microsoft.Owin.Security.Cookies.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Owin.Security.OAuth, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Owin.Security.OAuth.4.0.0\lib\net451\Microsoft.Owin.Security.OAuth.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Newtonsoft.Json.11.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="ContextProviders\ApplicationDbContext.cs" />
|
||||||
|
<Compile Include="Managers\ApplicationSignInManager.cs" />
|
||||||
|
<Compile Include="Managers\ApplicationUserManager.cs" />
|
||||||
|
<Compile Include="Migrations\201812012107132_Db init.cs" />
|
||||||
|
<Compile Include="Migrations\201812012107132_Db init.Designer.cs">
|
||||||
|
<DependentUpon>201812012107132_Db init.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Migrations\Configuration.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Services\MailService.cs" />
|
||||||
|
<Compile Include="Services\SmsService.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<WCFMetadata Include="Connected Services\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\..\Components\Forum.DataAccessLayer.Models\Forum.DataAccessLayer.Models.csproj">
|
||||||
|
<Project>{9f24444b-f36f-4965-bc49-c5bf885278ee}</Project>
|
||||||
|
<Name>Forum.DataAccessLayer.Models</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Migrations\201812012107132_Db init.resx">
|
||||||
|
<DependentUpon>201812012107132_Db init.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Security.Claims;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Forum.DataAccessLayer.Models;
|
||||||
|
using Microsoft.AspNet.Identity.Owin;
|
||||||
|
using Microsoft.Owin;
|
||||||
|
using Microsoft.Owin.Security;
|
||||||
|
|
||||||
|
namespace Forum.DataAccessLayer.Managers
|
||||||
|
{
|
||||||
|
public class ApplicationSignInManager : SignInManager<ProfessionalUser, string>
|
||||||
|
{
|
||||||
|
public ApplicationSignInManager(ApplicationUserManager userManager, IAuthenticationManager authenticationManager)
|
||||||
|
: base(userManager, authenticationManager)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Task<ClaimsIdentity> CreateUserIdentityAsync(ProfessionalUser user)
|
||||||
|
{
|
||||||
|
return user.GenerateUserIdentityAsync((ApplicationUserManager)UserManager);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ApplicationSignInManager Create(IdentityFactoryOptions<ApplicationSignInManager> options, IOwinContext context)
|
||||||
|
{
|
||||||
|
return new ApplicationSignInManager(context.GetUserManager<ApplicationUserManager>(), context.Authentication);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Forum.DataAccessLayer.Models;
|
||||||
|
using Forum.DataAccessLayer.Services;
|
||||||
|
using Microsoft.AspNet.Identity;
|
||||||
|
using Microsoft.AspNet.Identity.EntityFramework;
|
||||||
|
using Microsoft.AspNet.Identity.Owin;
|
||||||
|
using Microsoft.Owin;
|
||||||
|
|
||||||
|
namespace Forum.DataAccessLayer.Managers
|
||||||
|
{
|
||||||
|
public class ApplicationUserManager : UserManager<ProfessionalUser>
|
||||||
|
{
|
||||||
|
public ApplicationUserManager(IUserStore<ProfessionalUser> store)
|
||||||
|
: base(store)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ApplicationUserManager Create(IdentityFactoryOptions<ApplicationUserManager> options, IOwinContext context)
|
||||||
|
{
|
||||||
|
var manager = new ApplicationUserManager(new UserStore<ProfessionalUser>(context.Get<ApplicationDbContext>()));
|
||||||
|
// Configure validation logic for usernames
|
||||||
|
manager.UserValidator = new UserValidator<ProfessionalUser>(manager)
|
||||||
|
{
|
||||||
|
AllowOnlyAlphanumericUserNames = false,
|
||||||
|
RequireUniqueEmail = true
|
||||||
|
};
|
||||||
|
|
||||||
|
// Configure validation logic for passwords
|
||||||
|
manager.PasswordValidator = new PasswordValidator
|
||||||
|
{
|
||||||
|
RequiredLength = 6,
|
||||||
|
RequireNonLetterOrDigit = true,
|
||||||
|
RequireDigit = true,
|
||||||
|
RequireLowercase = true,
|
||||||
|
RequireUppercase = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Configure user lockout defaults
|
||||||
|
manager.UserLockoutEnabledByDefault = true;
|
||||||
|
manager.DefaultAccountLockoutTimeSpan = TimeSpan.FromMinutes(5);
|
||||||
|
manager.MaxFailedAccessAttemptsBeforeLockout = 5;
|
||||||
|
|
||||||
|
// Register two factor authentication providers. This application uses Phone and Emails as a step of receiving a code for verifying the user
|
||||||
|
// You can write your own provider and plug it in here.
|
||||||
|
manager.RegisterTwoFactorProvider("Phone Code", new PhoneNumberTokenProvider<ProfessionalUser>
|
||||||
|
{
|
||||||
|
MessageFormat = "Your security code is {0}"
|
||||||
|
});
|
||||||
|
manager.RegisterTwoFactorProvider("Email Code", new EmailTokenProvider<ProfessionalUser>
|
||||||
|
{
|
||||||
|
Subject = "Security Code",
|
||||||
|
BodyFormat = "Your security code is {0}"
|
||||||
|
});
|
||||||
|
manager.EmailService = new EmailService();
|
||||||
|
manager.SmsService = new SmsService();
|
||||||
|
var dataProtectionProvider = options.DataProtectionProvider;
|
||||||
|
if (dataProtectionProvider != null)
|
||||||
|
{
|
||||||
|
manager.UserTokenProvider =
|
||||||
|
new DataProtectorTokenProvider<ProfessionalUser>(dataProtectionProvider.Create("ASP.NET Identity"));
|
||||||
|
}
|
||||||
|
return manager;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
29
Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/201812012107132_Db init.Designer.cs
generated
Normal file
29
Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/201812012107132_Db init.Designer.cs
generated
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
namespace Forum.DataAccessLayer.Migrations
|
||||||
|
{
|
||||||
|
using System.CodeDom.Compiler;
|
||||||
|
using System.Data.Entity.Migrations;
|
||||||
|
using System.Data.Entity.Migrations.Infrastructure;
|
||||||
|
using System.Resources;
|
||||||
|
|
||||||
|
[GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")]
|
||||||
|
public sealed partial class Dbinit : IMigrationMetadata
|
||||||
|
{
|
||||||
|
private readonly ResourceManager Resources = new ResourceManager(typeof(Dbinit));
|
||||||
|
|
||||||
|
string IMigrationMetadata.Id
|
||||||
|
{
|
||||||
|
get { return "201812012107132_Db init"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
string IMigrationMetadata.Source
|
||||||
|
{
|
||||||
|
get { return null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
string IMigrationMetadata.Target
|
||||||
|
{
|
||||||
|
get { return Resources.GetString("Target"); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,99 @@
|
|||||||
|
namespace Forum.DataAccessLayer.Migrations
|
||||||
|
{
|
||||||
|
using System;
|
||||||
|
using System.Data.Entity.Migrations;
|
||||||
|
|
||||||
|
public partial class Dbinit : DbMigration
|
||||||
|
{
|
||||||
|
public override void Up()
|
||||||
|
{
|
||||||
|
CreateTable(
|
||||||
|
"dbo.AspNetRoles",
|
||||||
|
c => new
|
||||||
|
{
|
||||||
|
Id = c.String(nullable: false, maxLength: 128),
|
||||||
|
Name = c.String(nullable: false, maxLength: 256),
|
||||||
|
})
|
||||||
|
.PrimaryKey(t => t.Id)
|
||||||
|
.Index(t => t.Name, unique: true, name: "RoleNameIndex");
|
||||||
|
|
||||||
|
CreateTable(
|
||||||
|
"dbo.AspNetUserRoles",
|
||||||
|
c => new
|
||||||
|
{
|
||||||
|
UserId = c.String(nullable: false, maxLength: 128),
|
||||||
|
RoleId = c.String(nullable: false, maxLength: 128),
|
||||||
|
})
|
||||||
|
.PrimaryKey(t => new { t.UserId, t.RoleId })
|
||||||
|
.ForeignKey("dbo.AspNetRoles", t => t.RoleId, cascadeDelete: true)
|
||||||
|
.ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true)
|
||||||
|
.Index(t => t.UserId)
|
||||||
|
.Index(t => t.RoleId);
|
||||||
|
|
||||||
|
CreateTable(
|
||||||
|
"dbo.AspNetUsers",
|
||||||
|
c => new
|
||||||
|
{
|
||||||
|
Id = c.String(nullable: false, maxLength: 128),
|
||||||
|
Email = c.String(maxLength: 256),
|
||||||
|
EmailConfirmed = c.Boolean(nullable: false),
|
||||||
|
PasswordHash = c.String(),
|
||||||
|
SecurityStamp = c.String(),
|
||||||
|
PhoneNumber = c.String(),
|
||||||
|
PhoneNumberConfirmed = c.Boolean(nullable: false),
|
||||||
|
TwoFactorEnabled = c.Boolean(nullable: false),
|
||||||
|
LockoutEndDateUtc = c.DateTime(),
|
||||||
|
LockoutEnabled = c.Boolean(nullable: false),
|
||||||
|
AccessFailedCount = c.Int(nullable: false),
|
||||||
|
UserName = c.String(nullable: false, maxLength: 256),
|
||||||
|
})
|
||||||
|
.PrimaryKey(t => t.Id)
|
||||||
|
.Index(t => t.UserName, unique: true, name: "UserNameIndex");
|
||||||
|
|
||||||
|
CreateTable(
|
||||||
|
"dbo.AspNetUserClaims",
|
||||||
|
c => new
|
||||||
|
{
|
||||||
|
Id = c.Int(nullable: false, identity: true),
|
||||||
|
UserId = c.String(nullable: false, maxLength: 128),
|
||||||
|
ClaimType = c.String(),
|
||||||
|
ClaimValue = c.String(),
|
||||||
|
})
|
||||||
|
.PrimaryKey(t => t.Id)
|
||||||
|
.ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true)
|
||||||
|
.Index(t => t.UserId);
|
||||||
|
|
||||||
|
CreateTable(
|
||||||
|
"dbo.AspNetUserLogins",
|
||||||
|
c => new
|
||||||
|
{
|
||||||
|
LoginProvider = c.String(nullable: false, maxLength: 128),
|
||||||
|
ProviderKey = c.String(nullable: false, maxLength: 128),
|
||||||
|
UserId = c.String(nullable: false, maxLength: 128),
|
||||||
|
})
|
||||||
|
.PrimaryKey(t => new { t.LoginProvider, t.ProviderKey, t.UserId })
|
||||||
|
.ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true)
|
||||||
|
.Index(t => t.UserId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Down()
|
||||||
|
{
|
||||||
|
DropForeignKey("dbo.AspNetUserRoles", "UserId", "dbo.AspNetUsers");
|
||||||
|
DropForeignKey("dbo.AspNetUserLogins", "UserId", "dbo.AspNetUsers");
|
||||||
|
DropForeignKey("dbo.AspNetUserClaims", "UserId", "dbo.AspNetUsers");
|
||||||
|
DropForeignKey("dbo.AspNetUserRoles", "RoleId", "dbo.AspNetRoles");
|
||||||
|
DropIndex("dbo.AspNetUserLogins", new[] { "UserId" });
|
||||||
|
DropIndex("dbo.AspNetUserClaims", new[] { "UserId" });
|
||||||
|
DropIndex("dbo.AspNetUsers", "UserNameIndex");
|
||||||
|
DropIndex("dbo.AspNetUserRoles", new[] { "RoleId" });
|
||||||
|
DropIndex("dbo.AspNetUserRoles", new[] { "UserId" });
|
||||||
|
DropIndex("dbo.AspNetRoles", "RoleNameIndex");
|
||||||
|
DropTable("dbo.AspNetUserLogins");
|
||||||
|
DropTable("dbo.AspNetUserClaims");
|
||||||
|
DropTable("dbo.AspNetUsers");
|
||||||
|
DropTable("dbo.AspNetUserRoles");
|
||||||
|
DropTable("dbo.AspNetRoles");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,126 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<data name="Target" xml:space="preserve">
|
||||||
|
<value>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</value>
|
||||||
|
</data>
|
||||||
|
<data name="DefaultSchema" xml:space="preserve">
|
||||||
|
<value>dbo</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
@ -0,0 +1,23 @@
|
|||||||
|
namespace Forum.DataAccessLayer.Migrations
|
||||||
|
{
|
||||||
|
using System;
|
||||||
|
using System.Data.Entity;
|
||||||
|
using System.Data.Entity.Migrations;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
internal sealed class Configuration : DbMigrationsConfiguration<Forum.DataAccessLayer.ApplicationDbContext>
|
||||||
|
{
|
||||||
|
public Configuration()
|
||||||
|
{
|
||||||
|
AutomaticMigrationsEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Seed(Forum.DataAccessLayer.ApplicationDbContext context)
|
||||||
|
{
|
||||||
|
// This method will be called after migrating to the latest version.
|
||||||
|
|
||||||
|
// You can use the DbSet<T>.AddOrUpdate() helper extension method
|
||||||
|
// to avoid creating duplicate seed data.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("Forum.DataAccessLayer")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Forum.DataAccessLayer")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("af3e6195-741f-46e7-baa6-f67cd91d285a")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNet.Identity;
|
||||||
|
|
||||||
|
namespace Forum.DataAccessLayer.Services
|
||||||
|
{
|
||||||
|
public class EmailService : IIdentityMessageService
|
||||||
|
{
|
||||||
|
public Task SendAsync(IdentityMessage message)
|
||||||
|
{
|
||||||
|
// Plug in your email service here to send an email.
|
||||||
|
return Task.FromResult(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNet.Identity;
|
||||||
|
|
||||||
|
namespace Forum.DataAccessLayer.Services
|
||||||
|
{
|
||||||
|
public class SmsService : IIdentityMessageService
|
||||||
|
{
|
||||||
|
public Task SendAsync(IdentityMessage message)
|
||||||
|
{
|
||||||
|
// Plug in your SMS service here to send a text message.
|
||||||
|
return Task.FromResult(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
13
Trunk/Server/Forum/Forum.DataAccessLayer/packages.config
Normal file
13
Trunk/Server/Forum/Forum.DataAccessLayer/packages.config
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="EntityFramework" version="6.2.0" targetFramework="net461" />
|
||||||
|
<package id="Microsoft.AspNet.Identity.Core" version="2.2.2" targetFramework="net461" />
|
||||||
|
<package id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.2" targetFramework="net461" />
|
||||||
|
<package id="Microsoft.AspNet.Identity.Owin" version="2.2.2" targetFramework="net461" />
|
||||||
|
<package id="Microsoft.Owin" version="4.0.0" targetFramework="net461" />
|
||||||
|
<package id="Microsoft.Owin.Security" version="4.0.0" targetFramework="net461" />
|
||||||
|
<package id="Microsoft.Owin.Security.Cookies" version="4.0.0" targetFramework="net461" />
|
||||||
|
<package id="Microsoft.Owin.Security.OAuth" version="4.0.0" targetFramework="net461" />
|
||||||
|
<package id="Newtonsoft.Json" version="11.0.1" targetFramework="net461" />
|
||||||
|
<package id="Owin" version="1.0" targetFramework="net461" />
|
||||||
|
</packages>
|
@ -5,6 +5,12 @@ VisualStudioVersion = 15.0.28307.136
|
|||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Forum", "Forum\Forum.csproj", "{E3C0D1F3-C4CC-4D3D-9960-F20179C60269}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Forum", "Forum\Forum.csproj", "{E3C0D1F3-C4CC-4D3D-9960-F20179C60269}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Forum.DataAccessLayer.Models", "..\..\Components\Forum.DataAccessLayer.Models\Forum.DataAccessLayer.Models.csproj", "{9F24444B-F36F-4965-BC49-C5BF885278EE}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Data Access Layer", "Data Access Layer", "{380457AD-9C28-43E7-B606-2C55E1D5D26B}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Forum.DataAccessLayer", "Forum.DataAccessLayer\Forum.DataAccessLayer.csproj", "{AF3E6195-741F-46E7-BAA6-F67CD91D285A}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -15,10 +21,22 @@ Global
|
|||||||
{E3C0D1F3-C4CC-4D3D-9960-F20179C60269}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{E3C0D1F3-C4CC-4D3D-9960-F20179C60269}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{E3C0D1F3-C4CC-4D3D-9960-F20179C60269}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{E3C0D1F3-C4CC-4D3D-9960-F20179C60269}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{E3C0D1F3-C4CC-4D3D-9960-F20179C60269}.Release|Any CPU.Build.0 = Release|Any CPU
|
{E3C0D1F3-C4CC-4D3D-9960-F20179C60269}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{9F24444B-F36F-4965-BC49-C5BF885278EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{9F24444B-F36F-4965-BC49-C5BF885278EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{9F24444B-F36F-4965-BC49-C5BF885278EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{9F24444B-F36F-4965-BC49-C5BF885278EE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{AF3E6195-741F-46E7-BAA6-F67CD91D285A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{AF3E6195-741F-46E7-BAA6-F67CD91D285A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{AF3E6195-741F-46E7-BAA6-F67CD91D285A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{AF3E6195-741F-46E7-BAA6-F67CD91D285A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
GlobalSection(NestedProjects) = preSolution
|
||||||
|
{9F24444B-F36F-4965-BC49-C5BF885278EE} = {380457AD-9C28-43E7-B606-2C55E1D5D26B}
|
||||||
|
{AF3E6195-741F-46E7-BAA6-F67CD91D285A} = {380457AD-9C28-43E7-B606-2C55E1D5D26B}
|
||||||
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {341ABE52-6FD4-4A2C-8A64-7CAA19241B68}
|
SolutionGuid = {341ABE52-6FD4-4A2C-8A64-7CAA19241B68}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
@ -14,96 +14,13 @@ using Forum.Models;
|
|||||||
|
|
||||||
namespace Forum
|
namespace Forum
|
||||||
{
|
{
|
||||||
public class EmailService : IIdentityMessageService
|
|
||||||
{
|
|
||||||
public Task SendAsync(IdentityMessage message)
|
|
||||||
{
|
|
||||||
// Plug in your email service here to send an email.
|
|
||||||
return Task.FromResult(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class SmsService : IIdentityMessageService
|
|
||||||
{
|
|
||||||
public Task SendAsync(IdentityMessage message)
|
|
||||||
{
|
|
||||||
// Plug in your SMS service here to send a text message.
|
|
||||||
return Task.FromResult(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Configure the application user manager used in this application. UserManager is defined in ASP.NET Identity and is used by the application.
|
// Configure the application user manager used in this application. UserManager is defined in ASP.NET Identity and is used by the application.
|
||||||
public class ApplicationUserManager : UserManager<ApplicationUser>
|
|
||||||
{
|
|
||||||
public ApplicationUserManager(IUserStore<ApplicationUser> store)
|
|
||||||
: base(store)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ApplicationUserManager Create(IdentityFactoryOptions<ApplicationUserManager> options, IOwinContext context)
|
|
||||||
{
|
|
||||||
var manager = new ApplicationUserManager(new UserStore<ApplicationUser>(context.Get<ApplicationDbContext>()));
|
|
||||||
// Configure validation logic for usernames
|
|
||||||
manager.UserValidator = new UserValidator<ApplicationUser>(manager)
|
|
||||||
{
|
|
||||||
AllowOnlyAlphanumericUserNames = false,
|
|
||||||
RequireUniqueEmail = true
|
|
||||||
};
|
|
||||||
|
|
||||||
// Configure validation logic for passwords
|
|
||||||
manager.PasswordValidator = new PasswordValidator
|
|
||||||
{
|
|
||||||
RequiredLength = 6,
|
|
||||||
RequireNonLetterOrDigit = true,
|
|
||||||
RequireDigit = true,
|
|
||||||
RequireLowercase = true,
|
|
||||||
RequireUppercase = true,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Configure user lockout defaults
|
|
||||||
manager.UserLockoutEnabledByDefault = true;
|
|
||||||
manager.DefaultAccountLockoutTimeSpan = TimeSpan.FromMinutes(5);
|
|
||||||
manager.MaxFailedAccessAttemptsBeforeLockout = 5;
|
|
||||||
|
|
||||||
// Register two factor authentication providers. This application uses Phone and Emails as a step of receiving a code for verifying the user
|
|
||||||
// You can write your own provider and plug it in here.
|
|
||||||
manager.RegisterTwoFactorProvider("Phone Code", new PhoneNumberTokenProvider<ApplicationUser>
|
|
||||||
{
|
|
||||||
MessageFormat = "Your security code is {0}"
|
|
||||||
});
|
|
||||||
manager.RegisterTwoFactorProvider("Email Code", new EmailTokenProvider<ApplicationUser>
|
|
||||||
{
|
|
||||||
Subject = "Security Code",
|
|
||||||
BodyFormat = "Your security code is {0}"
|
|
||||||
});
|
|
||||||
manager.EmailService = new EmailService();
|
|
||||||
manager.SmsService = new SmsService();
|
|
||||||
var dataProtectionProvider = options.DataProtectionProvider;
|
|
||||||
if (dataProtectionProvider != null)
|
|
||||||
{
|
|
||||||
manager.UserTokenProvider =
|
|
||||||
new DataProtectorTokenProvider<ApplicationUser>(dataProtectionProvider.Create("ASP.NET Identity"));
|
|
||||||
}
|
|
||||||
return manager;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Configure the application sign-in manager which is used in this application.
|
// Configure the application sign-in manager which is used in this application.
|
||||||
public class ApplicationSignInManager : SignInManager<ApplicationUser, string>
|
|
||||||
{
|
|
||||||
public ApplicationSignInManager(ApplicationUserManager userManager, IAuthenticationManager authenticationManager)
|
|
||||||
: base(userManager, authenticationManager)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Task<ClaimsIdentity> CreateUserIdentityAsync(ApplicationUser user)
|
|
||||||
{
|
|
||||||
return user.GenerateUserIdentityAsync((ApplicationUserManager)UserManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ApplicationSignInManager Create(IdentityFactoryOptions<ApplicationSignInManager> options, IOwinContext context)
|
|
||||||
{
|
|
||||||
return new ApplicationSignInManager(context.GetUserManager<ApplicationUserManager>(), context.Authentication);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using Forum.DataAccessLayer;
|
||||||
|
using Forum.DataAccessLayer.Managers;
|
||||||
|
using Forum.DataAccessLayer.Models;
|
||||||
using Microsoft.AspNet.Identity;
|
using Microsoft.AspNet.Identity;
|
||||||
using Microsoft.AspNet.Identity.Owin;
|
using Microsoft.AspNet.Identity.Owin;
|
||||||
using Microsoft.Owin;
|
using Microsoft.Owin;
|
||||||
@ -30,7 +33,7 @@ namespace Forum
|
|||||||
{
|
{
|
||||||
// Enables the application to validate the security stamp when the user logs in.
|
// Enables the application to validate the security stamp when the user logs in.
|
||||||
// This is a security feature which is used when you change a password or add an external login to your account.
|
// This is a security feature which is used when you change a password or add an external login to your account.
|
||||||
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
|
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ProfessionalUser>(
|
||||||
validateInterval: TimeSpan.FromMinutes(30),
|
validateInterval: TimeSpan.FromMinutes(30),
|
||||||
regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
|
regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ 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 Forum.DataAccessLayer.Managers;
|
||||||
|
using Forum.DataAccessLayer.Models;
|
||||||
using Microsoft.AspNet.Identity;
|
using Microsoft.AspNet.Identity;
|
||||||
using Microsoft.AspNet.Identity.Owin;
|
using Microsoft.AspNet.Identity.Owin;
|
||||||
using Microsoft.Owin.Security;
|
using Microsoft.Owin.Security;
|
||||||
@ -151,7 +153,7 @@ namespace Forum.Controllers
|
|||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
|
var user = new ProfessionalUser() { UserName = model.Email, Email = model.Email };
|
||||||
var result = await UserManager.CreateAsync(user, model.Password);
|
var result = await UserManager.CreateAsync(user, model.Password);
|
||||||
if (result.Succeeded)
|
if (result.Succeeded)
|
||||||
{
|
{
|
||||||
@ -367,7 +369,7 @@ namespace Forum.Controllers
|
|||||||
{
|
{
|
||||||
return View("ExternalLoginFailure");
|
return View("ExternalLoginFailure");
|
||||||
}
|
}
|
||||||
var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
|
var user = new ProfessionalUser() { UserName = model.Email, Email = model.Email };
|
||||||
var result = await UserManager.CreateAsync(user);
|
var result = await UserManager.CreateAsync(user);
|
||||||
if (result.Succeeded)
|
if (result.Succeeded)
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
using Forum.DataAccessLayer.Managers;
|
||||||
using Microsoft.AspNet.Identity;
|
using Microsoft.AspNet.Identity;
|
||||||
using Microsoft.AspNet.Identity.Owin;
|
using Microsoft.AspNet.Identity.Owin;
|
||||||
using Microsoft.Owin.Security;
|
using Microsoft.Owin.Security;
|
||||||
|
@ -180,7 +180,6 @@
|
|||||||
<DependentUpon>Global.asax</DependentUpon>
|
<DependentUpon>Global.asax</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Models\AccountViewModels.cs" />
|
<Compile Include="Models\AccountViewModels.cs" />
|
||||||
<Compile Include="Models\IdentityModels.cs" />
|
|
||||||
<Compile Include="Models\ManageViewModels.cs" />
|
<Compile Include="Models\ManageViewModels.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Startup.cs" />
|
<Compile Include="Startup.cs" />
|
||||||
@ -258,6 +257,16 @@
|
|||||||
<Content Include="Scripts\jquery-3.3.1.slim.min.map" />
|
<Content Include="Scripts\jquery-3.3.1.slim.min.map" />
|
||||||
<Content Include="Scripts\jquery-3.3.1.min.map" />
|
<Content Include="Scripts\jquery-3.3.1.min.map" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\..\Components\Forum.DataAccessLayer.Models\Forum.DataAccessLayer.Models.csproj">
|
||||||
|
<Project>{9F24444B-F36F-4965-BC49-C5BF885278EE}</Project>
|
||||||
|
<Name>Forum.DataAccessLayer.Models</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Forum.DataAccessLayer\Forum.DataAccessLayer.csproj">
|
||||||
|
<Project>{af3e6195-741f-46e7-baa6-f67cd91d285a}</Project>
|
||||||
|
<Name>Forum.DataAccessLayer</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
using System.Data.Entity;
|
|
||||||
using System.Security.Claims;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNet.Identity;
|
|
||||||
using Microsoft.AspNet.Identity.EntityFramework;
|
|
||||||
|
|
||||||
namespace Forum.Models
|
|
||||||
{
|
|
||||||
// You can add profile data for the user by adding more properties to your ApplicationUser class, please visit https://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
|
|
||||||
public class ApplicationUser : IdentityUser
|
|
||||||
{
|
|
||||||
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
|
|
||||||
{
|
|
||||||
// Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
|
|
||||||
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
|
|
||||||
// Add custom user claims here
|
|
||||||
return userIdentity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
|
|
||||||
{
|
|
||||||
public ApplicationDbContext()
|
|
||||||
: base("DefaultConnection", throwIfV1Schema: false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ApplicationDbContext Create()
|
|
||||||
{
|
|
||||||
return new ApplicationDbContext();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!--
|
||||||
For more information on how to configure your ASP.NET application, please visit
|
For more information on how to configure your ASP.NET application, please visit
|
||||||
https://go.microsoft.com/fwlink/?LinkId=301880
|
https://go.microsoft.com/fwlink/?LinkId=301880
|
||||||
@ -6,104 +6,95 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<configSections>
|
<configSections>
|
||||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||||
<section name="entityFramework"
|
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||||
type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
|
||||||
requirePermission="false"/>
|
|
||||||
</configSections>
|
</configSections>
|
||||||
<connectionStrings>
|
<connectionStrings>
|
||||||
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-Forum-20181201091908.mdf;Initial Catalog=aspnet-Forum-20181201091908;Integrated Security=True"
|
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\ForumInzyneria.mdf;Initial Catalog=ForumInzyneria;Integrated Security=True" providerName="System.Data.SqlClient" />
|
||||||
providerName="System.Data.SqlClient" />
|
|
||||||
</connectionStrings>
|
</connectionStrings>
|
||||||
<appSettings>
|
<appSettings>
|
||||||
<add key="webpages:Version" value="3.0.0.0"/>
|
<add key="webpages:Version" value="3.0.0.0" />
|
||||||
<add key="webpages:Enabled" value="false"/>
|
<add key="webpages:Enabled" value="false" />
|
||||||
<add key="ClientValidationEnabled" value="true"/>
|
<add key="ClientValidationEnabled" value="true" />
|
||||||
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
|
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
|
||||||
</appSettings>
|
</appSettings>
|
||||||
<system.web>
|
<system.web>
|
||||||
<authentication mode="None"/>
|
<authentication mode="None" />
|
||||||
<compilation debug="true" targetFramework="4.6.1"/>
|
<compilation debug="true" targetFramework="4.6.1" />
|
||||||
<httpRuntime targetFramework="4.6.1"/>
|
<httpRuntime targetFramework="4.6.1" />
|
||||||
</system.web>
|
</system.web>
|
||||||
<system.webServer>
|
<system.webServer>
|
||||||
<modules>
|
<modules>
|
||||||
<remove name="FormsAuthentication"/>
|
<remove name="FormsAuthentication" />
|
||||||
<remove name="TelemetryCorrelationHttpModule"/>
|
<remove name="TelemetryCorrelationHttpModule" />
|
||||||
<add name="TelemetryCorrelationHttpModule"
|
<add name="TelemetryCorrelationHttpModule" type="Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule, Microsoft.AspNet.TelemetryCorrelation" preCondition="integratedMode,managedHandler" />
|
||||||
type="Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule, Microsoft.AspNet.TelemetryCorrelation"
|
|
||||||
preCondition="integratedMode,managedHandler"/>
|
|
||||||
</modules>
|
</modules>
|
||||||
</system.webServer>
|
</system.webServer>
|
||||||
<runtime>
|
<runtime>
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35"/>
|
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
|
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35"/>
|
<assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
|
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35"/>
|
<assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
|
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35"/>
|
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
|
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f"/>
|
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2"/>
|
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51"/>
|
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.1" newVersion="4.0.2.1"/>
|
<bindingRedirect oldVersion="0.0.0.0-4.0.2.1" newVersion="4.0.2.1" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35"/>
|
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-1.1.0.0" newVersion="1.1.0.0"/>
|
<bindingRedirect oldVersion="0.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35"/>
|
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930"/>
|
<bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed"/>
|
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0"/>
|
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
|
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
|
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
|
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-5.2.4.0" newVersion="5.2.4.0"/>
|
<bindingRedirect oldVersion="0.0.0.0-5.2.4.0" newVersion="5.2.4.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
|
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
|
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
<entityFramework>
|
<entityFramework>
|
||||||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
|
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
|
||||||
<parameters>
|
<parameters>
|
||||||
<parameter value="mssqllocaldb"/>
|
<parameter value="mssqllocaldb" />
|
||||||
</parameters>
|
</parameters>
|
||||||
</defaultConnectionFactory>
|
</defaultConnectionFactory>
|
||||||
<providers>
|
<providers>
|
||||||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
|
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
|
||||||
</providers>
|
</providers>
|
||||||
</entityFramework>
|
</entityFramework>
|
||||||
<system.codedom>
|
<system.codedom>
|
||||||
<compilers>
|
<compilers>
|
||||||
<compiler language="c#;cs;csharp" extension=".cs"
|
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
|
||||||
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
|
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
|
||||||
warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701"/>
|
|
||||||
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
|
|
||||||
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
|
|
||||||
warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+"/>
|
|
||||||
</compilers>
|
</compilers>
|
||||||
</system.codedom>
|
</system.codedom>
|
||||||
</configuration>
|
</configuration>
|
Loading…
Reference in New Issue
Block a user