MySqlMembershipProvider的表前缀

时间:2010-10-05 02:26:12

标签: c# asp.net mysql asp.net-mvc mysql-connector

我有MySqlMembershipProvider使用Asp.Net MVC。我的问题是我如何配置表前缀...所以我不想在表上使用'my_aspnet_'前缀,而是要求它为none或由我定义。

我的web.config:

<?xml version="1.0"?>

  

<add name="ApplicationServices" connectionString="server=localhost;user id=root;Password=*********;database=sparkSources" providerName="MySql.Data.MySqlClient"/>

                                                  

<authentication mode="Forms">
  <forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>

<membership defaultProvider="MySqlMembershipProvider">
  <providers>
    <clear/>
    <add name="MySqlMembershipProvider"
         type="MySql.Web.Security.MySQLMembershipProvider,
           MySql.Web, Version=6.3.4.0, Culture=neutral,
           PublicKeyToken=c5687fc88969c44d"
         autogenerateschema="true"
         tablePrefix="ss"
         connectionStringName="ApplicationServices"
         enablePasswordRetrieval="false"
         enablePasswordReset="true"
         requiresQuestionAndAnswer="false"
         requiresUniqueEmail="false"
         passwordFormat="Hashed"
         maxInvalidPasswordAttempts="5"
         minRequiredPasswordLength="6"
         minRequiredNonalphanumericCharacters="0"
         passwordAttemptWindow="10"
         passwordStrengthRegularExpression=""
         applicationName="sparkSources"
 />
  </providers>
</membership>

<profile>
  <providers>
    <clear/>
    <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
  </providers>
</profile>

<roleManager enabled="false">
  <providers>
    <clear/>
    <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
    <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
  </providers>
</roleManager>

<pages>
  <namespaces>
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Routing" />
  </namespaces>
</pages>

            

                                            

1 个答案:

答案 0 :(得分:2)

我想我会查看源代码,令我惊讶的是,“my_aspnet”表前缀是硬编码的,如第6.3.4节所述。更改了所有“my_aspnet”前缀并重新编译连接器工作 - 所以如果你真的想要更改表前缀 - 为一些源头潜水做好准备。