DSA in Infrastructure.Shell

Topics: CAB & Smart Client Software Factory
Sep 7, 2007 at 2:18 PM
Hi

I have created a DSA in Shell Project. I want to access the service from within the ShellForm.
How do I register the Agent in ShellForm, i.e where do I put the following line of code

RootWorkItem.Services.AddNew<Agent>();

It throws an exception "Can not create an instance of type IRequestManager" , if I call it from ShellApplication's AddServices or BeforeShellCreated.

I want to Initialize my ServiceAgent instance in ShellForm's constructor so that I can use it in the ShellForm

Can anyone help me out ?

Regards
San
Sep 7, 2007 at 7:17 PM
Hi!

You must make sure that the RequestManager and that the RequestQueue has been registered..

I’d recommend you to read the following section from the help:

  • Smart Client Software Factory | Inspecting the Software Factory Assets | Application Blocks | The Disconnected Service Agent Application Block | Working with the Disconnected Service Agent Application Block.

Also you’d probably like to see this thread that explain that:
http://www.codeplex.com/smartclient/Thread/View.aspx?ThreadId=10606

Please let me know if this helps!

Mariano Converti
http://staff.southworks.net/blogs/mconverti/
Sep 8, 2007 at 6:43 AM
Edited Sep 8, 2007 at 6:45 AM
Hi

I have registered RequestManager and RequestQueue in AddServices method of Infrastructure.Module's ModuleController. Since the Shell is loaded before the Infrastructure.Module this exception is raised.

In which module should I register the RequestManager and RequestQueue to access it from ShellForm?

The DSA help does not talk about accessing the service agent from ShellForm, it has examples for accessing the Agent
from business modules only.

I have created a DSA in Infrastructure.Shell Project but do not know how to make use of the service's operation contracts in ShellForm

Please let me know where I can register the Agent in Shell Project and where I should Initialize the Agent instance in ShellForm, so that I can call service method(operation contract)s when a particular event occurs

Thanks
San
Sep 8, 2007 at 10:39 AM
Hi

I found the solution. I registered the RequestManager and RequestQueue in Shell's AddServices before adding the ServiceAgent

-San
Sep 16, 2007 at 6:51 AM
Can you post the code snippet? I've been experiencing same problem
Sep 17, 2007 at 5:30 AM
I have followed the steps specified in
Smart Client Software Factory | Inspecting the Software Factory Assets | Application Blocks | The Disconnected Service Agent Application Block | Working with the Disconnected Service Agent Application Block.

The steps are
Create DSA
Declare a member of Agent
Setup RequestManager
RequestManager requestManager = DatabaseRequestManagerIntializer.Initialize();
Add the request queue to the Root WorkItem. This queue will be used by service agents to enqueue requests.
RootWorkItem.Services.Add(requestManager.RequestQueue);
Now add the Agent to RootWorkItem as below
RootWorkItem.Services.AddNew<Agent>();


Hope this information is of some use for you.
Please let me know if this helps

San

Sep 17, 2007 at 6:26 AM
On this line:
RequestManager requestManager = DatabaseRequestManagerIntializer.Initialize();

Error: Object reference not set to an instance of an object.

What did i miss?


Sep 19, 2007 at 2:15 PM
exactly my problem.

see http://www.codeplex.com/scsfcontrib/Thread/View.aspx?ThreadId=15351