我正在研究一个预先存在的C#MVC项目,并且想从一开始就对MVC不太熟悉。另外,我希望我以正确的方式粘贴代码(按了4次空格?)。
我可以在模型和web.config中看到连接字符串,看起来好像创建了到Oracle数据库的连接,但是如何确定它使用的是哪个表?我认为当创建一个模型时,它会在开始时将其连接到表上吗?
这是视图中的代码:
namespace WO_Edit_Print_SPA.Models
{ 公共类OracleDbConfiguration:DbConfiguration { 公共OracleDbConfiguration() { SetProviderServices(“ Oracle.ManagedDataAccess.Client”,EFOracleProviderServices.Instance); SetProviderFactory(“ Oracle.ManagedDataAccess.Client”,OracleClientFactory.Instance); } }
[DbConfigurationType(typeof(OracleDbConfiguration))]
public class WO_Edit_Print_SPA_Context : DbContext
{
// You can add custom code to this file. Changes will not be overwritten.
//
// If you want Entity Framework to drop and regenerate your database
// automatically whenever you change your model schema, please use data migrations.
// For more information refer to the documentation:
// http://msdn.microsoft.com/en-us/data/jj591621.aspx
private static string DS = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=cin-jde-db1)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SID=JDE9DB)))";
public WO_Edit_Print_SPA_Context() : base(new OracleConnection("DATA SOURCE=" + WO_Edit_Print_SPA_Context.DS + ";PERSIST SECURITY INFO=True;USER ID=JDE;Password=JDE;"), true)
这是WEB.CONFIG:
<configuration>
<configSections>
<section name="entityFramework"
type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,
EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- 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 --></configSections>
<connectionStrings>
<add name="WO_Edit_Print_SPA_Context" connectionString="DATA
SOURCE=JDE9DB;PERSIST SECURITY INFO=True;USER ID=JDE;Password=JDE;"
providerName="System.Data.OracleClient" />
</connectionStrings>
我们非常感谢您的帮助。谢谢。