internal virtual string GetClientConstructor(bool instanceOnly, string body)
{
if (this is ICustomConfigSerialization)
{
Observable parent = this.ParentComponent;
if (parent == null)
{
parent = (Observable)ReflectionUtils.GetTypeOfParent(this, typeof(Observable));
}
return (this as ICustomConfigSerialization).ToScript(parent);
}
if (this.InstanceOf.IsNotEmpty())
{
string template = (instanceOnly) ? "new {1}({2})" : ((this is Component) ? "" : "this.{0}=").ConcatWith("new {1}({2});");
return string.Format(template, this.ClientID, this.InstanceOf, body ?? this.InitialConfig);
}
return "";
}