大家下午好,我遇到了一個問題,從使用C#和Linq to Entities的兩個連接字符串中進行選擇。目前我有兩個連接字符串,它們是:如何從兩個連接字符串中選擇?
<add name="GameHutDBEntities1" connectionString="metadata=res://*/GameHutModel.csdl|res://*/GameHutModel.ssdl|res://*/GameHutModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=EMMANUEL-PC\SQLEXPRESS;Initial Catalog=GameHutDB;user id=GameHutAdmin; password=123;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
<add name="GameHutDBEntities2" connectionString="metadata=res://*/GameHutModel.csdl|res://*/GameHutModel.ssdl|res://*/GameHutModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=EMMANUEL-PC\SQLEXPRESS;Initial Catalog=GameHutDB;user id=test; password=1234;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
我有兩個角色,分別是Admin和Clerk。我如何允許管理員使用第一個連接字符串登錄,而職員將使用第二個連接字符串登錄?
http://stackoverflow.com/questions/1257107/entity-framework-to-multiple-databases-same-schema-at-runtime – Oded 2011-12-24 15:35:10