Why do I have to reference EF in my UI project?

后端 未结 5 1912
生来不讨喜
生来不讨喜 2020-12-17 18:16

Isn\'t there a more graceful way to have Entity Framework deployed with your UI project (specifically the sql server driver for EF: EntityFramework.SqlServer.dll) deployed w

5条回答
  •  眼角桃花
    2020-12-17 19:02

    I have encountered the same problem and found the solution.

    1. Remove EF references in the UI layer.
    2. Remove EF references in the web.config
    3. Just make sure to define the connection string

      
        
        

    There! No more reference to EF in the UI layer, and the web page will still run. Use only EF in the data layer via repositories and unit of work pattern.

    To summarize: Just do NOT install or nuget-install EntityFramework in the UI layer and it will work just fine.

提交回复
热议问题