I have a model that is created by EF6
,by default my connection string is initialized in app.config
as you can see here :
<connectionStrings>
<add name="ShirazRailwayEntities" connectionString="metadata=res://*/RailWay.csdl|res://*/RailWay.ssdl|res://*/RailWay.msl;provider=System.Data.SqlClient;provider connection string="data source=****;initial catalog=DB-Metro;user id=sa;password=****;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
I have 3 layers in my application Model
,UI
,Domain class
.my connection string is initialized in 'Model' and 'UI' layers,I need to set connection string
by user , i mean the connection string should be set by user.
My question :
As i said i have 2 layers that the connection string are initialized inside them ,Is it necessary to initialized both connection by user ? Or just the UI
is enough ?Which connection string should be initialized ?
The next question is how can i set the connection string by user?
I have a repository layer between my EF model
and UI
called repository :
public class StationRepository : GenericRepository<ShirazRailWay.ShirazRailwayEntities, DomainClass.Station>
{
}
My Ui calls this repository .
best regards