StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



using business objects in a serviceExpand / Collapse
Author
Message
Posted 02/04/2006 10:27:09 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 05/25/2007 3:34:57 PM
Posts: 235, Visits: 309
I'm creating a service that needs to access several tables in a database. The service project includes a Strataframe Business Object Library but (obviously) no strataframe application. I have several questions:

1 - is the following correct:
System.Data.SqlClient.SqlConnectionStringBuilder loBuilder = new System.Data.SqlClient.SqlConnectionStringBuilder();
loBuilder.DataSource = _DdmServer;
loBuilder.InitialCatalog = _DdmDatabase;
loBuilder.UserID = _DdmLogin;
loBuilder.Password = _DdmPassword;

SqlDataSourceItem loNewDB;

//-- Create a new data source item
loNewDB = new SqlDataSourceItem(_DdmDatabase, loBuilder.ToString());

//-- Add the new database to the data source collection
DataLayer.DataSources.Add(loNewDB);

2 - How do I make sure that a data layer is created so that the last statement above will acturlaly refer to something?
Post #516
Posted 02/06/2006 3:18:42 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 11:24:42 AM
Posts: 2,686, Visits: 1,889
DataLayer.DataSources is a shared (static) property, so it will always exist... You don't create an instance of the DataLayer, and then reference the DataSources property on it, you just access the shared DataSources property on the DataLayer class, just like it's written. The rest of your code looks good. Just make sure you call that code within the ServiceStart method (or whatever name it has) to ensure that the data source is added to that static collection.


www.bungie.net
Post #517
Posted 02/07/2006 3:35:31 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 05/25/2007 3:34:57 PM
Posts: 235, Visits: 309
thanks
Post #521
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 11:59am

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.063. 9 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.