Skip to content

Commit

Permalink
Merge pull request #5 from arichika/develop
Browse files Browse the repository at this point in the history
develop 2  master
  • Loading branch information
arichika committed Sep 15, 2015
2 parents 1f55ae9 + eb01789 commit 6e95af2
Show file tree
Hide file tree
Showing 11 changed files with 1,096 additions and 922 deletions.
58 changes: 54 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ forked from AspNet.Identity.MySQL provided at codeplex.

https://aspnet.codeplex.com/SourceControl/latest#Samples/Identity/AspNet.Identity.MySQL/AspNet.Identity.MySQL.csproj

AspNet.Identity.Oracle is not depend on the "Entity Framework", It is by design.
In other words, it is not possible to use the "Code First".

How To Use
==========
(from ReadMe.txt)

This is an example to implement a OracleDatabase store for ASP.NET Identity 2.0

Expand All @@ -19,11 +21,59 @@ Steps to run project
- In the solution, add a new one ASP.NET project with MVC and Individual Authentication
- Uninstall Microsoft.AspNet.Identity.EntityFramework package from the web application
- Update connection string to use the OracleDatabase database as needed
- In the IdentityModel.cs, let ApplicationUser class extend from Identity user in AspNet.Identity.Oracle
- Make the file "MyConnectionStrings.config" into the project SampleWebSite's root folder
- e.g.
```
<?xml version="1.0" encoding="utf-8"?>
<connectionStrings>
<add name="DefaultConnection"
connectionString="Data Source=OracleDbTnsName; User Id=scott;Password=tiger;"
providerName="Oracle.DataAccess.Client" />
</connectionStrings>
```
- In the IdentityModel.cs (in the SampleWebProject),
let ApplicationUser class extend from Identity user in AspNet.Identity.Oracle
- e.g
```
using AspNet.Identity.Oracle;
// using Microsoft.AspNet.Identity.EntityFramework;
```
- ApplicationDbContext extend from OracleDatabase and the contructor take a single parameter with the connectionstring name
- In the ApplicationManager.Create method, replace instantiating UserManager as shown below

```
public class ApplicationDbContext : OracleDatabase
{
public ApplicationDbContext()
: base("DefaultConnection")
{
}
~
}
```
- In the ApplicationUserManager.Create method (in the IdentityConfig.cs), replace instantiating UserManager as shown below
```
var manager = new ApplicationUserManager(new UserStore<ApplicationUser>(context.Get<ApplicationDbContext>() as OracleDatabase));
```
- In the ApplicationRoleManager.Create method (in the IdentityConfig.cs), replace instantiating UserManager as shown below
```
var manager = new ApplicationRoleManager(new RoleStore<IdentityRole>(context.Get<ApplicationDbContext>() as OracleDatabase));
```
- If you want to create initial Administrator account or modify tables,
you can write some code block at the InitializeDb method or InitializeIdentity method
in the ApplicationDbInitializer class (in the IdentityConfig.cs)
- This SampleWebSite project enabled initial admin account as shoen below
```
const string name = "[email protected]";
const string password = "Admin@123456";
const string roleName = "Admin";
```
- Before you do debugging, you must create the tables in the database.
Please run DDL Script, "OracleIdentity.sql.txt" in the AspNet.Identity.Oracle project.

- If you have an error appears at the start of debugging, please try the following below.
- To start the Visual Studio by "Run as Administrator".
- Debugging on the "Local IIS" not "IIS Express".
- Check build platform Win32 or x64, this project and installed ODP.NET.


Notice
======
Expand Down
80 changes: 45 additions & 35 deletions Src/AspNet.Identity.Oracle.sln
Original file line number Diff line number Diff line change
@@ -1,35 +1,45 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleWebSite", "SampleWebSite\SampleWebSite.csproj", "{DA7762F8-1A8B-452E-A20F-0F4BB5E072EC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AspNet.Identity.Oracle", "AspNet.Identity.Oracle\AspNet.Identity.Oracle.csproj", "{26F6ECF9-4369-417B-8CF2-54FA92DF3660}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{D62A2A25-E163-4621-8169-B5A9CD55A3D3}"
ProjectSection(SolutionItems) = preProject
.nuget\NuGet.Config = .nuget\NuGet.Config
.nuget\NuGet.exe = .nuget\NuGet.exe
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DA7762F8-1A8B-452E-A20F-0F4BB5E072EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DA7762F8-1A8B-452E-A20F-0F4BB5E072EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DA7762F8-1A8B-452E-A20F-0F4BB5E072EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DA7762F8-1A8B-452E-A20F-0F4BB5E072EC}.Release|Any CPU.Build.0 = Release|Any CPU
{26F6ECF9-4369-417B-8CF2-54FA92DF3660}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{26F6ECF9-4369-417B-8CF2-54FA92DF3660}.Debug|Any CPU.Build.0 = Debug|Any CPU
{26F6ECF9-4369-417B-8CF2-54FA92DF3660}.Release|Any CPU.ActiveCfg = Release|Any CPU
{26F6ECF9-4369-417B-8CF2-54FA92DF3660}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.40629.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleWebSite", "SampleWebSite\SampleWebSite.csproj", "{DA7762F8-1A8B-452E-A20F-0F4BB5E072EC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AspNet.Identity.Oracle", "AspNet.Identity.Oracle\AspNet.Identity.Oracle.csproj", "{26F6ECF9-4369-417B-8CF2-54FA92DF3660}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{D62A2A25-E163-4621-8169-B5A9CD55A3D3}"
ProjectSection(SolutionItems) = preProject
.nuget\NuGet.Config = .nuget\NuGet.Config
.nuget\NuGet.exe = .nuget\NuGet.exe
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DA7762F8-1A8B-452E-A20F-0F4BB5E072EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DA7762F8-1A8B-452E-A20F-0F4BB5E072EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DA7762F8-1A8B-452E-A20F-0F4BB5E072EC}.Debug|x64.ActiveCfg = Debug|x64
{DA7762F8-1A8B-452E-A20F-0F4BB5E072EC}.Debug|x64.Build.0 = Debug|x64
{DA7762F8-1A8B-452E-A20F-0F4BB5E072EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DA7762F8-1A8B-452E-A20F-0F4BB5E072EC}.Release|Any CPU.Build.0 = Release|Any CPU
{DA7762F8-1A8B-452E-A20F-0F4BB5E072EC}.Release|x64.ActiveCfg = Release|x64
{DA7762F8-1A8B-452E-A20F-0F4BB5E072EC}.Release|x64.Build.0 = Release|x64
{26F6ECF9-4369-417B-8CF2-54FA92DF3660}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{26F6ECF9-4369-417B-8CF2-54FA92DF3660}.Debug|Any CPU.Build.0 = Debug|Any CPU
{26F6ECF9-4369-417B-8CF2-54FA92DF3660}.Debug|x64.ActiveCfg = Debug|x64
{26F6ECF9-4369-417B-8CF2-54FA92DF3660}.Debug|x64.Build.0 = Debug|x64
{26F6ECF9-4369-417B-8CF2-54FA92DF3660}.Release|Any CPU.ActiveCfg = Release|Any CPU
{26F6ECF9-4369-417B-8CF2-54FA92DF3660}.Release|Any CPU.Build.0 = Release|Any CPU
{26F6ECF9-4369-417B-8CF2-54FA92DF3660}.Release|x64.ActiveCfg = Release|x64
{26F6ECF9-4369-417B-8CF2-54FA92DF3660}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
216 changes: 108 additions & 108 deletions Src/AspNet.Identity.Oracle/AspNet.Identity.Oracle.csproj
Original file line number Diff line number Diff line change
@@ -1,115 +1,115 @@
<?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>{26F6ECF9-4369-417B-8CF2-54FA92DF3660}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AspNet.Identity.Oracle</RootNamespace>
<AssemblyName>AspNet.Identity.Oracle</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">.\</SolutionDir>
<RestorePackages>true</RestorePackages>
</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>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.AspNet.Identity.Core">
<HintPath>..\packages\Microsoft.AspNet.Identity.Core.2.0.0\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
</Reference>
<Reference Include="Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\_ExternalLibrary\Oracle\Oracle.DataAccess.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<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="IdentityRole.cs" />
<Compile Include="RoleStore.cs" />
<Compile Include="IdentityUser.cs" />
<Compile Include="ToDecimalExtentions.cs" />
<Compile Include="UserLoginsTable.cs" />
<Compile Include="UserClaimsTable.cs" />
<Compile Include="UserStore.cs" />
<Compile Include="OracleDatabase.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RoleTable.cs" />
<Compile Include="UserRoleTable.cs" />
<Compile Include="UserTable.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<None Include="OracleIdentity.sql" />
</ItemGroup>
<ItemGroup>
<Content Include="Readme.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<?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>{26F6ECF9-4369-417B-8CF2-54FA92DF3660}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AspNet.Identity.Oracle</RootNamespace>
<AssemblyName>AspNet.Identity.Oracle</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">.\</SolutionDir>
<RestorePackages>true</RestorePackages>
</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>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.AspNet.Identity.Core">
<HintPath>..\packages\Microsoft.AspNet.Identity.Core.2.0.0\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
</Reference>
<Reference Include="Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\_ExternalLibrary\Oracle\Oracle.DataAccess.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<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="IdentityRole.cs" />
<Compile Include="RoleStore.cs" />
<Compile Include="IdentityUser.cs" />
<Compile Include="ToDecimalExtentions.cs" />
<Compile Include="UserLoginsTable.cs" />
<Compile Include="UserClaimsTable.cs" />
<Compile Include="UserStore.cs" />
<Compile Include="OracleDatabase.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RoleTable.cs" />
<Compile Include="UserRoleTable.cs" />
<Compile Include="UserTable.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<None Include="OracleIdentity.sql.txt" />
</ItemGroup>
<ItemGroup>
<Content Include="Readme.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.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>
Loading

0 comments on commit 6e95af2

Please sign in to comment.