This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hey guys, I set up some lightspeed config settings with only one context settings node, like the following: < lightSpeedContexts default="Dev"><add name="Dev" connectionStringName="DevConnection" dataProvider="SqlServer2005" identityMethod="KeyTable"/> </lightSpeedContexts> My (incorrect) assumption was that because I specified "Dev" as the default, that when I created a new LightspeedContext with no explicit context name, it would use the "Dev" settings. However, this didn't happen and I got a "ConnectionString not set...." error, example below: objectBuilder.RegisterInstanceSingleton( new LightSpeedContext<ModelUnitOfWork>())When I explicitly added a config name, it worked fine: objectBuilder.RegisterInstanceSingleton( new LightSpeedContext<ModelUnitOfWork>("Dev"))So if this is not the purpose of the "default" attribute, can you tell me what this does? Am I just doing something wrong? Thanks!
|
|
|
LightSpeed predefines a context which you can access as LightSpeedContext.Default. The "default" attribute specifies which settings to use for this context. Note that if your config file contains only one set of settings, these are automatically the default -- you don't need to specify this in an attribute. By contrast, new LightSpeedContext() always creates a new, "blank" context, without reference to any configuration file settings. |
|
|
The Default property on LightSpeedContext has been marked as deprecated. How can we access the default value as defined in the configuration file? Given the example below, I would like to be able to change default from "sql" to "oracle" at deployment time and not have to specify either in code. <lightSpeedContexts default="sql">
<
|
|
|
There is no built-in facility for this, but you can easily implement it via an appSettings key: <appSettings> string defaultContextName = ConfigurationManager.AppSettings["defaultContext"]; |
|