Issue with CSLA and Sql Server 2005 Compact Edition

Issue with CSLA and Sql Server 2005 Compact Edition

Old forum URL: forums.lhotka.net/forums/t/7729.aspx


mjrod posted on Monday, October 05, 2009

I'm trying to implement a compact and repair feature for an application I have. In doing so, what is the procedure to get CSLA to release its connections to the .SDF file so that I can perform the compact?

I dont' see anywhere that I can do that.

Thanks.

RockfordLhotka replied on Monday, October 05, 2009

It is your data access code that is responsible for opening and closing any database connections. Generally speaking, if a method opens a connection, that method should close it. Do you have methods that aren't closing your connections?

mjrod replied on Monday, October 05, 2009

First thing, I'm new to CSLA, and the application I'm using isn't something I built.   I am assuming that CSLA opens the connection reading from the app.config file as I see there are connection strings in there for the database.  However, are you saying that you can create a connection and pass that as a reference to CSLA?

Forgive me, I'm just trying to understand and know what to look for.

Thanks for the help.

mjrod replied on Monday, October 05, 2009

Rocky

You gave me the clue I needed and as I've gone through, I've discovered how it's implemented and the issue.

Thanks.

RockfordLhotka replied on Monday, October 05, 2009

No, CSLA calls one of your methods (probably called DataPortal_Fetch, DataPortal_Insert, etc – it will start with “DataPortal_”) and in that method your code opens the database connection, uses it and (should) close it.

 

mjrod replied on Tuesday, October 06, 2009

Rocky,

Wanted to say thanks again.  Your help was appreciated and I was able to make the appropriate changes and get my functionality implemented the way I needed.

CSLA is completely new, but the more I work with it, the more I understand how it works and why it was chosen.

MJ

Copyright (c) Marimer LLC