.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Deep-copy on Activity instance

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :JQuery

Hi all,

I want to perform deep-copy on my custom Activity below:

  public sealed class MyCustomActivities: NativeActivity<MyResultObj>, ICloneable
    public OutArgument OutArgument { get; set; }
    public InArgument InArgument{ get; set; }

    protected override void CacheMetadata(NativeActivityMetadata metadata)
      //do something here

    protected override void Execute(NativeActivityContext context)
      //do something here

    #region ICloneable Members

    public object Clone()
      //How do I clone OutArgument and InArgument?

View Complete Post

More Related Resource Links

Exception "The activity with display name 'Flowchart' has already been associated with an instance

Using VS 2010 RTM. I have rehosted the desginer and provided a "test" button which runs the WF shown in the desginer, the code for running the WF is simple:  void OnTestWorkflowCommandHandler(object parameter) { ActivityBuilder designerBuilder = (ActivityBuilder)WFDesinger.Context.Services.GetService<ModelTreeManager>().Root.GetCurrentValue(); WorkflowInvoker invoker = new WorkflowInvoker(designerBuilder.Implementation); var se = invoker.Invoke(); it works fine, BUTThe root activity is a flowchart , if I start messing with the desginer and adding sequences and going back and forth to child activities and try to test(run) the WF I get the exception:The activity with display name 'Flowchart' has already been associated with an instance.  Once associated with an instance an activity's metadata cannot be manipulated.  This error might also indicate that you are attempting to execute a workflow whose root activity is actually part of another workflow.

Creating an Activity Instance for WorkflowInvoker



I want to create an Activity to run through a TestMethod, but the following Fails


IObjectScope scope = RTODataLayer.Private.ObjectScopeProvider1.GetNewObjectScope();

RTODataLayer.RequestedDate date = WorkflowInvoker.Invoke(new CreateRequestedDate() { Scope = scope, Active = true, FromDate = DateTime.Now.AddDays(10), ToDate = DateTime.Now.AddDays(15), RequestID = request.RequestID, TypeID = 1, WorkingDays = 5 });

Error    142    Cannot implicitly convert type 'Telerik.OpenAccess.IObjectScope' to 'System.Activities.InArgument<Telerik.OpenAccess.IObjectScope>'    D:\websites\workflow\RTO.UnitTests\RTO.Testing\Workflows\Approval.cs    19    106    RTO.Testing

How do I pass in the scope object?...in my actual master XAML file I maintain the scope in the workflow, but I want to test the individual components.




Deep Copy Vs Shallow Copy


HI Guys,


I have gone through some of the articles over internet but not been able to get hold of whether we can do a deep copy of an object using Icloneable interface Clone Method without using serialization.  If Yes then please provide some working snippets to understand the concept of both of them. I am looking for examples which will help me understand the concept.



How to improve performance on an instance with large I/O activity?


I have a mirrored instance that throws up 'unsent log' and 'unrecovered log' errors. Everytime it does the I/O activity shoots up. I was wondering what can be done to improve this?

Extra memory? More processing power?

What if I spread the filegroups across different disks? Would this help?

How to improve performance on an instance with large I/O activity?


I have a mirrored instance that throws up 'unsent log' and 'unrecovered log' errors. Everytime it does the I/O activity shoots up. I was wondering what can be done to improve this?

Extra memory? More processing power?

What if I spread the filegroups across different disks? Would this help?

Error when adding one instance of activity multiple time into Sequence activity



Hi all, 

I encounter this error when I tried to add same Writeline instance into two different Sequence activities as shown in the code below:


      ActivityBuilder ab = XamlServices.Load(ActivityXamlServices.CreateBuilderReader(new XamlXmlReader(new StringReader(_designer.Text)))) as ActivityBuilder;
      //inspecting ab ...
      Console.WriteLine("There are {0} arguments in the activity builder.", ab.Properties.Count);
      //ProcessActivity(ab.Implementation, "");
      //test code to add two same instances of activities in a sequence and execute them 
      if(ab.Implementation is Sequence)
        Sequence seq = ab.Implementation as Sequence;

Deep Clone (copy) Lazy type of objects


For deep cloning (copy) objects there is a many ways. One good document for cloning is here http://www.csharp411.com/c-object-clone-wars/ . The document shows six different ways to clone objects.

In our architecture we can’t use memorystreams for serializing and deserializing objects because some classes are part of the WCF datacontract and Serializable attribute on classes will force DatacontractSerializer to act way that we don’t want.

For cloning objects we use reflection technic. We create new object based on source object type and then loop all object field and copy source objects values to the copy. Everything works fine until we implement System.Lazy variables in our classes. How to deep c

How to get workflow instance in custom activity?


I am using Sequential workflow (.net 3.5). I have created 3 custom activities and dragged these activities in my sequential workflow. The activities are




Each Custom activity will have the following execute method. 

protected override ActivityExecutionSt

Visual Web Developer 2010 Express "Copy Web Site" using different login


I created a site and am trying to grant another pesron access to upload changes to it without giving them my super-user login.

I made a login for her but I can't test whether it works or not because no matter how much I "disconnect" in the Copy Web Site page of VWD 2010, reconnecting to the same site always logs in as my superuser account without prompting me for a login again.

How do I test is the account it set up correctly before having her try to upload to it?    I want to force the login to remote site dialog to pop up again to test her account.

Any ideas?

Bulk Copy From Datatable To SQL Server Table


 I have read the data of a excle file and captured the data into the dataset to a datatable, now that data is to be inserted into a SQL Server table using bulk copy option. I am using -

 public bool BulkEnterData(DataTable dt, string tblName)
        SqlBulkCopy bulk = new SqlBulkCopy(con);
        bulk.DestinationTableName = tblName;

        return true;

ERROR Getting-
A transport-level error has occurred when receiving results from the server. (provider: Shared Memory Provider, error: 0 - The pipe has been ended.) 

How to resolve the above problem or any other solution is available.


Activation error occured while trying to get instance of type Database, key "DBName"


Im using Enterprise library 5.0
I have a scenario, where I have to access two different databases in my application.

Basically this application is a webservice,delployed on my local for testing purpose.
I'm trying to access this web method from diffent windows application, default connection works fine but the other database throw's exception.

Problem is only my defaultDatabase is works fine, if I change defaultDatabase="MYCON1" with "MYCON2" it works fine, if I try to access the other database which is not default, throws exception.

<dataConfiguration defaultDatabase="MYCON1" />
<add name="MYCON1" connectionString="Data Source=server1;Initial Catalog=dbName1;User Id=Username1;Password=password1;"

" />
<add name="MYCON2" connectionString="Data Source=Server2;Initial Catalog=dbName2;User Id=Username2;Password=password2;"
providerName="System.Data.SqlClient" />

Database myDB=EnterpriseLibraryContainer.Current.GetInstance<Database>(); --> works fine for the default database (MYCON1)

Database myDB=EnterpriseLibraryCo

SQL Server Express2008 R2 brings app down, instance problem


I have tried dozens of changes and modifications to many settings as I will outilne here and all to no avail.

The short answer here though is that I uninstalled SQL Sever Express 2008 R2 and went back to the "NON" 2008 R2 and got things working. But like the fool I am wanted to run on the more current rev and updated again, all problems returned....



Win Server 2003 R2 SP2


VWD2008 Express (removed)




XP Sp3

VWD2008 Express

SQL Server Express 2008


I was orginally getting this message after updating to SQL Sever Express 2008 R2, I removed VWD 2008 Express from the web server, no good, then uninstalled SQL Server 2008 Express R2 and reinstalled SQL Server 2008 Express. worked but had issues, couldn't install MGTM Studio. Then I removed SQL 2008, cleaned folders and reg. Reloaded SQL Server 2008 Express, still flaky, couldn't get the Management Studio to install. So I removed it again and used the Web Platform Installer, which worked but loaded 2008 R2 again. Which brought back the message.

Failed to genera

Usability in Practice: More Than Skin Deep


While style and slick visuals are important in Web site design, they shouldn't detract from a site's usability and functionality. Here are some hands-on tips for look and feel, readability, discovery of affordances, and more, with plenty of examples of good and bad design.

Ambrose Little, Charles B. Kreitzberg

MSDN Magazine December 2009

Wicked Code: Taking Silverlight Deep Zoom To The Next Level


With the help of Silverlight Deep Zoom and a remarkable control named MultiScaleImage, you can create scenes with many levels of zoom. Jeff Prosise illustrates with what else but the Mandlebrot set.

Jeff Prosise

MSDN Magazine July 2009

Editor's Note: Take a Deep Breath


This month Howard Dierking reflects on 2007 and looks forward to exciting possibilities in 2008.

Howard Dierking

MSDN Magazine December 2007

WCF Essentials: Discover Mighty Instance Management Techniques For Developing WCF Apps


Instance management refers to a set of techniques used by Windows Communication Foundation to bind a set of messages to a service instance. This article introduces the concept and shows you why you need instance management.

Juval Lowy

MSDN Magazine June 2006

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend