Using a EF Repository with custom connection objects?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am stuck in EF 6 and the documentation is sparse - not getting that solved for a day now. I try to use Code First on a database repository we have. Due to complex initialization I must use my own factory method to initialize the context subclass and I must put my own sql connection in, or make my own factory. THe following class initialization: we have: public class Repository : DbContext { static string _connectionString; static Repository() { Database.SetInitializer<Repository>(null); var type = typeof(System.Data.Entity.SqlServer