DatabaseRequestManagerIntializer.Initialize() null reference exception

Topics: CAB & Smart Client Software Factory
Jun 8, 2007 at 8:15 AM
I have a problem with DisconnectedAgent. I have an exception in line:

RequestManager requestManager = DatabaseRequestManagerIntializer.Initialize();

I also tried to set database:

RequestManager requestManager = DatabaseRequestManagerIntializer.Initialize("LocalSqlServer");

In this case I have an exception - Cannot convert type 'Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase' to 'Microsoft.Practices.SmartClient.EnterpriseLibrary.SmartClientDatabase'.
Jun 8, 2007 at 1:27 PM
Do you have something like this included in your app config file?
<dataConfiguration defaultDatabase="MyDB">
<providerMappings>
<add databaseType="Microsoft.Practices.SmartClient.EnterpriseLibrary.SmartClientDatabase, Microsoft.Practices.SmartClient.EnterpriseLibrary" name="System.Data.SqlServerCe" />
</providerMappings>
</dataConfiguration>
<connectionStrings>
<add name="QueueDatabase" connectionString="DataSource=Requests.sdf" providerName="System.Data.SqlServerCe" />
<add name="MyDB" connectionString="Data Source=server;Initial Catalog=Mydb; providerName="System.Data.SqlClient" />
</connectionStrings>

In this case you would call:
DatabaseRequestManagerIntializer.Initialize("QueueDatabase");

For the Requests.sdf template check the Disconnected Agent Quickstart.

Hope this helps,
Vlad
Jun 11, 2007 at 1:23 PM
Thank you for advice.

I have following configuration set in app.config:

<providerMappings>
<add databaseType="Microsoft.Practices.SmartClient.EnterpriseLibrary.SmartClientDatabase, Microsoft.Practices.SmartClient.EnterpriseLibrary, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="System.Data.SqlServerCe" />
</providerMappings>
</dataConfiguration>
<connectionStrings>
<add name="RequestsDatabase" connectionString="DataSource=Requests.sdf"
providerName="System.Data.SqlServerCe" />
</connectionStrings>

In Initialize("RequestsDatabase") line I have an exception:

The requested database RequestsDatabase is not defined in configuration.

Any suggestions?
Jun 12, 2007 at 5:29 PM
May be a stupid question, but did you install SQL CE?