How to set manually an Oracle Connection String in a DbContext

后端 未结 3 2049
南旧
南旧 2021-02-15 23:51

I have the following connection string:



        
3条回答
  •  再見小時候
    2021-02-16 00:30

    To create a DbContext using Oracle without use WebConfig, your inheritance of DbContext must inject an Oracle Connection to base constructor:

    class MyDbContext: DbContext
    {
        public MyDbContext() : base(new OracleConnection("DATA SOURCE=Server; PASSWORD=123;USER ID=SYSTEM"){}
        ...
    }
    

提交回复
热议问题