Can't ace in how client and server component contexts correspons with
each other.
Server-side (entperiseServices) component is always created in context.
But I'd like to create serverside component in *client context*, and
therefore contextID of the client and server should be the same. For
unknown reasons, I got different context ID (albeit sync options are
the same)
Who can clarify this and say how to create server side component in
client context?
I use such code for client
static void Main(string[] args)
{
// Define context attributes
ServiceConfig config = new ServiceConfig();
config.Synchronization = SynchronizationOption.Required;
// Create client context
ServiceDomain.Enter(config);
// Show client context ID
Console.WriteLine(ContextUtil.ContextId.ToString() );
// Create server side component
Class1 cl = new Class1();
// Show server side component's contextID
Console.WriteLine(cl.State());
}
Code for server component
[EventTrackingEnabled]
[Synchronization(SynchronizationOption.Required)]
public class Class1: ServicedComponent
{
public Class1()
{
}
public string State()
{
return "Activity: " + ContextUtil.ActivityId.ToString() + "
Context: " + ContextUtil.ContextId.ToString() + " Instance: " +
ContextUtil.ApplicationInstanceId.ToString();
}