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
|
Hi, I would like to know the best method for abstracting away the LightSpeedContext in business logic that is located in a separate class library. The separate class library will obviously have a reference to the LightSpeed model but should be instantiating a LightSpeedContext - that should be up to the application that is using the class library. Can anyone suggest a suitable method (configuration, IOC, etc), perhaps with an example? I am looking to utilise the business logic class library and model class library in an existing Asp.Net WebForms application. Cheers, Jeremy. |
|
|
The running application should be responsible for setting up the LightSpeedContext as it will have awareness of the environment you are running in. The normal approach we take for a solution which needs to share the model around is to have the model in its own class library, with partials as needed and then to reference that assembly from the other projects which are making use of it. Each of those projects would then have a LightSpeedContext and create UnitOfWork instances as needed. Have a look at the Aptitude Test sample for an example - in this project we have the model file in the web application itself but the same approach would apply for when the model is factored out into its own project.
|
|
|
Jeremy, I've had a look at the example and I can see the usage of In the Aptitude Test example the WebForms application has the business logic and UOW execution inside the code behind. Is this the best practice? What if there were say 3 class libaries:
Class library 3 would need to be instantiating Lightspeed Contexts. How would you go about removing that dependency whilst still retaining the use of a strongly typed
Hope I am making some sense :) Cheers, Jeremy |
|
|
|
|