Using EL 3.1 in Outlook Add-In

Topics: Data Access Application Block, General discussion
Nov 24, 2010 at 11:30 PM

Pls help, I have an outlook 2003 add-in in vs 2008.  I'm trying to use EL 3.1 data access block so I added app.config to my add-in DLL and configure it properly.  In the code, I have

Dim objDB As Database = DatabaseFactory.CreateDatabase()

but whenever it gets to this line, the code just seems to stop executing.  Doesn't error out nor throw any exceptions at all.  It just seems like it finished execution at this line.  I'm doing this debug through attaching to my outlook.exe process.  I deployed the add-in using a combination of MSI and Click-Once similar to the article at http://www.codeproject.com/KB/office/Outlook_Add-in.aspx?fid=329297

I don't think the app can't see the config file b/c if I add entries to my project settings, the config file gets updated and I can access values fine. 

 

 

Nov 25, 2010 at 1:10 AM

I haven't work with an Outlook Add-in project yet so I'm not sure if you need to do anything to make it read a configuration file.  I suggest try looking for information on this first.  I found some related threads on this, see if it helps.

http://www.add-in-express.com/forum/read.php?FID=5&TID=3522

http://stackoverflow.com/questions/706479/outlook-add-in-where-to-save-configuration-c

If you can't seem to make it work, you have the option to pass an instance of an IConfigurationSource, specifically a FileConfigurationSource to create an instance of DatabaseProviderFactory.  You would use this then to create your Database object:

IConfigurationSource configSource = new FileConfigurationSource("data.config"); //the parameter corresponds to the location and filename of the configuration file
DatabaseProviderFactory dbFactory = new DatabaseProviderFactory(configSource);
Database db = dbFactory.CreateDefault(); //or use dbFactory.Create(connectionStringName) for non-default database 

Sarah Urmeneta
Global Technologies & Solutions
Avanade, Inc.
entlib.support@avanade.com