1

I will be starting an ASP.NET MVC 4 project soon with Entity Framework as my ORM and Oracle as my database engine.

I know that in order to get EF to work with Oracle, the tables have to be manually created in Oracle and the entities mapped to the table column by column.

The problem is my application has Authentication and Authorization needs and I was wondering what the easiest way would be to get the .NET membership to work with my scenario.

I have found this article, but it makes use of third party software that I find expensive.

2
  • Do you need additional help with this? Commented Sep 30, 2013 at 17:06
  • Not for the moment, thank you Tony :) Commented Oct 1, 2013 at 7:26

1 Answer 1

2

I am using Oracle Developer Tools for .NET (ODT), and it has been a great help. The best part: it's free! ODT includes ODP.NET and will help you do the following:

  • automatically set up ASP.NET membership tables. You'll need to create the schema first, then run the scripts provided.
  • automatically create and map EF entities (using database first); you will not need to manually map tables to tables.

Some things to consider... My membership schema is separate from the schemas used for my application. This way I can use one membership schema for several applications that may rely on different databases (schemas/users).

When configuring web.config, be sure to change the application name from "/" to something meaningful. Several config elements reference the application name, so be sure to change for all. The membership provider will automatically create the application record in the membersip database schema.

After your membership schema has been created (with the scripts), you'll need to change the web.config file's membership, profile, and roleManager elements to something like this:

<membership defaultProvider="OracleMembershipProvider">
  <providers>
    <clear />
    <add name="OracleMembershipProvider" type="Oracle.Web.Security.OracleMembershipProvider, Oracle.Web, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342" connectionStringName="OraAspNetConnectionString" applicationName="YOUR_APP_NAME" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="5" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" />
  </providers>
</membership>
<profile>
  <providers>
    <clear />
    <add name="OracleProfileProvider" type="Oracle.Web.Profile.OracleProfileProvider, Oracle.Web, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342" connectionStringName="OraAspNetConnectionString" applicationName="YOUR_APP_NAME" />
  </providers>
</profile>
<roleManager enabled="true" defaultProvider="OracleRoleProvider">
  <providers>
    <clear />
    <add connectionStringName="OraAspNetConnectionString" applicationName="YOUR_APP_NAME" name="OracleRoleProvider" type="Oracle.Web.Security.OracleRoleProvider, Oracle.Web, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
  </providers>
</roleManager>

This link may also help

Hope this helps.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.