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

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

CacheMetadata being called multiple times

Posted By:      Posted Date: December 04, 2010    Points: 0   Category :Windows Application

I'm going through the exercises of Bruce Bukovics new WF4 book and in one of his examples, the results he's generating are different from the results I'm getting. He states for an instantiated instance of an activity, if it's executed multiple times, the CacheMetadata is only called once. I'm seeing it called for each execution of the activity I'm making. Is he wrong or am I not interpreting the results correctly.

Here's a link to the solution containing the custom activity, designer, and testing console app:

Any guidance would be appreciated. Thanks!

Blades Don't Need Reloading...

View Complete Post

More Related Resource Links

DataGrid ValidationRule or IDataErrorInfo validation code called multiple times for each data change

Following my enquiry regarding a problem in Datagrid validation, for which managing exceptions is apparently a problem, I tested the two other methods: using validation rules, or implementing the IDataErrorInfo interface. I ran into other problems there, more insidious this time. This has been done on Windows7 (32-bit), .NET 4.0.30319. 1) IDataErrorInfo When this interface is implemented, the this[string columnName] property is called four times for each modification: two times before the cell enters edit mode (with the old value in the corresponding property) two times when the new value has to be validated (with the new value) It strikes me as not really efficient, is there something wrong with my code? Here's the C# part: using System; using System.Windows; using System.Collections.ObjectModel; using System.ComponentModel; namespace DataGridTest2 { public partial class MainWindow : Window { ObservableCollection<User> users; public MainWindow() { InitializeComponent(); users = new ObservableCollection<User>() { new User { Name = "Teddy", Age = "2" }, new User { Name = "Avi", Age = "19" } }; datagrid.ItemsSource = users; datagrid.Focus(); } } public class User : INotifyPropertyChanged, IDataErrorInfo { string name; public string Name

application_start event called multiple times in MVC application

hi, In my MVC application ,I am updating my web.config at runtime through application_start event.So, ideally it should be done only when the application is started.BUT in MY mvc application the application_start event of global.asax is being called multiple times , even when i have not restarted the application. Its being repetadly called when i am calling different actions , so the webconfig is repetedly updating & making my application very very slow. Can you please let me know , what's the reason & how to handle this .   Thanks in advance gbhatnagar    

AppDomain.Unload called multiple times?




     In a simple console app, I created a separate AppDomain (name: ad2)  to do some work.  In this AppDomain, I created a separate worker thread  and deliberately put the thread to sleep for long time (2 mins) in the Finally block.


      I also subscribed to the ad2’s Unload event  to do some logging.


      Immediately after calling the worker method, I called the AppDomain.Unload(ad2) in the main thread.  Because of the long Thread.Sleep() in the worker thread finally block, a CannotUnloadAppdomainException was thrown when calling AppDomain.Unload(ad2).

Insert Same Record Multiple Times.

I have a simple form that inserts a record into a SQL table. The fields are: SerialNumTagNumPONumLocationAddressDescription   This works great. However, I have now been asked to have the form insert x number of records at one time. They want to be able to fill out the following fields: PONumLocationAddressDescription and then have texbox where they can add a number and have that number of the same record inserted.    I hope this makes sense.

Invoke Delay Activity multiple times

HI! I am using Workflow Foundation workflows with sharepoint lists. I have a state machine workflow. One state of workflow has 2 event driven activities, one is waiting for task change and other is waiting for delay of 1 day. What i need is to send email if delay of 1 day is elapsed and send this email every day. But Delay activity is invoked only once. How can i change it so that it can be invoked multiple times. Shabih

Data Binding a DataGrid to a list fetch the same data multiple times

Hi, I'm using DataGrid to show data through data binding. My data are provided in a list. The setup I have is the following: DataGrid "binded" to the default view of my list that implement IList<T> and IList interfaces (MyList<T> : IList<T>, IList, INotifyCollectionChanged)             CollectionViewSource.GetDefaultView(_myList);             // Set the data context             DataContext = view; T: is here my 'business object' that hold the data, called 'MyRow'. Then the columns of the DataGrid are bound to public properties of 'MyRow' object. MyRow class has a public property of type 'object' (public object data[int index]) and first column of datagrid is bound to myRow.data[0], second column is bound to myRow.data[1] and so on.   When the datagrid is displayed, databinding kick in and my data are showed in the control. The issue I'm having is that data fetching is very repetitive even for the same rows. For example for a datagrid with 20 visible rows, the first row is fetched multiple times even if the datagrid is not resized or moved. I put break point inside my list (MyList<T> into This[T] property (public T this[int index]) and i got multiple hits into the property for the same index. Fetc

How to use a Resource multiple times in a window

  Hi, I want to create a resource and use this resource several times in one window. The example shows a simple thing what i want to accomplish. However, this way it does not work, because the  resource can only be loaded once. Is there a way to specify a resource that can be loaded more than once? <Window x:Class="MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <StackPanel x:Key="GG"> <Button Width="100" Height="23" Content="Click"> </Button> </StackPanel> </Window.Resources> <Grid> <ContentControl Content="{StaticResource GG}"></ContentControl> <ContentControl Content="{StaticResource GG}" HorizontalAlignment="Left" ></ContentControl> </Grid> </Window>

CacheMetadata is not called when a custom activity is placed inside a flowchart

I wrote a simple Native activity which implements CacheMetadata(NativeActivityMetadata metadata) to declare arguments and variables. The activity works great but when I tried to use it inside a flowchart activity I found out that CacheMetadata is not called by visual studioo when the activity is dragged from the toolbox into the flow chart . This of course prevents my activity from working correctly. How can a custom activity be used inside a flowchart activity if CacheMetadata not called? Is there a way to make CacheMetadata run when the custom activity is placed inside a flowchart activity? Thanks Manu    

ScriptManager CompositeScript Error: A script reference cannot be included multiple times in composi

I am getting the following error using the CompositeScript feature of the ScriptManager.  I have ScriptManagerProxy in several different usercontrols that use CompositeScript to add whatever JS files they need.  Sometimes there are duplicates which would get removed by the script manager, but that is not happening with the Composite Scripts.  Looking at the stack trace, it calls RemoveDuplicates but for some reason it doesn't do so.  Is this a bug?  Is there a workaround or a hotfix? Thanks! A script reference cannot be included multiple times in composite script references. Stack Trace: [InvalidOperationException: A script reference cannot be included multiple times in composite script references.]   System.Web.UI.ScriptManager.RemoveDuplicates(List`1 scripts) +698   System.Web.UI.ScriptManager.RegisterScripts() +328   System.Web.UI.ScriptManager.OnPagePreRenderComplete(Object sender, EventArgs e) +113   System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +8695102   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1029

WS-ReliableMessaging: Message sent multiple times when payload is large

Environment: .NET WCF client to .NET WCF service using WS-ReliableMessaging   Description: I am sending rather large message (~ 50 mb) using a .NET WCF client to a .NET WCF service. I have enabled WS-ReliableMessaging. This results in the following message flow: http://dl.dropbox.com/u/1373661/messageflow.png The flow shows that the payload message is sent with an interval of less than a second. Why is this? The problem doesn't seem to happend when sending small messages. The client side App.config: <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.serviceModel> <bindings> <customBinding> <binding name="OiosiHttpBinding" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00"> <reliableSession flowControlEnabled="false" inactivityTimeout="01:00:00" maxPendingChannels="32" maxTransferWindowSize="32" ordered="true" /> <!-- <security defaultAlgorithmSuite="Default" authenticationMode="MutualCertificate" requireDerivedKeys="false" securityHeaderLayout="Strict" includeTimestamp="true" keyEntropyMode="CombinedEntropy" messageProtectionOrder="SignBeforeE

toolbox shows items multiple times

My tool box shows the same tools about 12 times.  This is for all of them and for all categories.  I tried repairing it but it didn't work. 

Adding a table or view multiple times when building a query with BI Report Designer and Report Build

How can I add a table/view multiple times to a single query by using BI Report Designer or Report Builder 3.0? In Report Designer I managed (workaround) to add one table multiple times by creating multiple Named Queries and having the same SELECT. Still I don't know how to add one table multiple times in Report Builder 3.0.

How to get # of times a batch has executed within the batch which is being executed multiple times u


Go with the count argument is great if I just want to execute a batch multiple times.  I want to replace coding which is currently using WHILE loop with GO but I need to find out # of times the batch has executed within the batch which is being executed using GO with the count argument.  How does SQL Server keep track # of times a batch executed so far?

list column getting created multiple times.



I am trying to add a list column to a document library. When I am running the application multiple times, the list column is also getting created multiple times. If the list column exist, i dont want to recreate the column, but only assign the value to that list column.

This is the code i have used:


SPView curview = list.DefaultView;
SPViewFieldCollection fieldCol = curview.ViewFields;
if (!fieldCol.Exists("Custom Column"))
AddField("FilesCount", SPFieldType.Text, list.Fields);
fieldCol.View.DefaultView = true;
curview.ViewFields.Add("Custom Column");
SPFolder subFolder;
int mouas =5;
subFolder.Item["Custom Column"] = mouas;

private static SPField AddField(string title, SPFieldType type, SPFieldCollection fields)
if (!fields.ContainsField(title))
 fields.Add(title, type, false);                  
return fields.GetField(title);


How to avoid the duplicate creation of column, and assign the value to column, if the column exists?

I found that if the newly created column name is having white spa

WPF Datagrid SelectionChanged event is triggering Multiple times while loading the rows.



When i use DataGridComboBoxColumn in my WPF DataGrid, the DataGrid SelectionChanged event is triggering multiple times based on the number of rows while loading the rows in the WPF DataGrid.

How can i stop this? Because of this I am facing Performance issue.



Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This will help other members to find the solution easily.

MVC 3.0 Beta: IFilterProvider.GetFilters called 4 times per request


I implemented a custom IFilterProvider derived from FilterAttributeFilterProvider and
registered it using a Unity based dependency resolver. (Pretty much as described on
Brad Wilson's blog.) While debugging, I noticed that IFilterProvider.GetFilters on my
custom class get called a lot. I counted 4 times per request.

Is this normal or am I doing something wrong?

I have a simple project that reproduces the behavior if anyone is interested.

Using ReportViewer.LocalReport.Render() method to export single report multiple times


I'm using the ReportViewer control on my .aspx page which displays a single report based on various user parameter selections.  Dropdown2 is dependent on the DropDown1 selection (i.e. the user selects Unit A from DropDown1 and that results in 10 selections under Dropdown2, or the user selects Unit B from DropDown1 and that results in 15 selections under DropDown2, and so on).  The user makes the selections, clicks the "Run Report" button, and the report displays as expected.  The user then can export to Excel or PDF

I've received a request to allow users to run the report for all possible selections and export to their desired format rather than having to run the report for each separate DropDown1 and DropDown2 selection.  So in other words, they don't even want to see the report on the screen, they just want to be able to click a button that runs the report for all possible parameter selections and export it to a single Excel or PDF document.

Does anyone have thoughts on how to best approach this?  Or is it even possible?  I know how to render a single report with parameters directly to PDF or Excel using the ReportViewer.LocalReport.Render() method, but I don't know how to render the same report multiple times to a single destination.

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