You could:
- Separate the model into it's own assembly and reference it from the main project and the n-tier projects.
- Then put a duplicate connection string in the main project's App.config file
- Make the connection configurable in any way you like, ie. via config settings (bad coding, but you get the example!)
var dataSource = ConfigurationManager.AppSettings["SqlSource"];
var useWebService = Boolean.Parse(ConfigurationManager.AppSettings["UseWebService"]);
var entityServiceOption = useWebService
? EntityServiceOption.UseDistributedService
: EntityServiceOption.UseLocalService;
var serviceHost = ConfigurationManager.AppSettings["ServiceHost"];
var connectionOptions = new ConnectionOptions(
name: "TestConnection",
shouldConnect: true,
dataSourceExtension: dataSource,
serviceKey: serviceHost,
entityServiceOption: entityServiceOption);
return connectionOptions;