.net-4.0

System.ComponentModel.dataAnnotations.CustomValidation

Hi, can anyone please help me with full expmple of System.ComponentModel.dataAnnotations.CustomValidation. This is my scnario I have EventMetadata & EventAttributeMetadata class. In EventMetadata i have Startdate & Enddate Property & In EventAttributeMetadata i have HoldOutdate Propety. I want perform following validation for HoldOu...

Iterating ConcurrentQueue<T>

Is this a safe way of iterating ConcurrentQueue<T>? while (cq.GetEnumerator().MoveNext()) { IIndexTask task; if (cq.TryDequeue(out task)) task.Execute(service); } ...

Retrieving DV-cam info using Expression Encoder 4 SDK

I am developing a Windows Forms application in .NET Framework 4.0 which controls a DV-CAM using the Expression Encoder 4 SDK. In the past I used Windows Media Encoder for this, but I would like to upgrade to Expression Encoder, because it seems a lot more solid. Overall, the SDK is working great, I can control and view the DV-CAM video ...

How to create a quality splash screen odd shaped like VS 2010?

Hello, I've seen some neat splash screens like VS 2010, Adobe products, etc. I know in VS.NET you can set a transparency color, etc. but I have never been able to make one look nice that didn't have some type of jagged edges or color issues on the edges. For example, I could create a black circle with magenta as the transparent color ...

What's the algorithm behind Robocopy?

I am curious to know what makes Robocopy (Robust File Copy) so fast and robust. Any body knows what is the API/Algo used for Robocopy? Anybody studied Robocopy? I am asking since I have to write a method (in .NET/C#) which will copy directories/files fast and without errors... The amount of data can go up to 15Gb and I cannot simply cal...

How do you call master page methods from a content page when the button is inside an update panel?

I have a masterpage and a content page. In the content page I have a script manager and an update panel. In the update panel I want to be able to click a button which would hit a public method on the master page to show a message. This works if I don't have an update panel on the content page but is there a way to get it to work when th...

WCF .NET 4 OutputCaching with Stream doesn't seem to work

Hello, I'm having problems with OutputCaching over a WCF REST service on .NET4-IIS7. My service has a custom Authorization scheme (by implementing ServiceAuthorizationManager), one which should take place on every request, and any caching must be done after the request is authorized. So far, this seems to work, only the caching part I c...

ASP.NET 4.0 with Ajaxcontroltoolkit 1.0 and system.web.extensions 1.0

We are looking into upgrading our asp.net 2.0 application to run on the 4.0 framework. We currently use system.web.extensions 1.0 and AjaxControlToolkit 1.0. We made modifications to the toolkit and so we haven't upgraded it since. When I upgrade our solution and dependent projects to 4.0 I get the "sys is not defined" error which t...

Any new Reporting Controls in .NET 4.0?

I've been using DevExpress and CrystalReports for previous .NET versions. I'm wondering if there are any native reporting controls for .NET 4.0, so I could do away with the 3rd party ones. ...

WCF wsHttp binding, for clientCredentialType should I use Basic or Windows?

Hello, I have several WCF wsHttp services using Transport security over an SSL connection. Presently I use "Windows" for the clientCredentialType and all has worked fine with exception of one scenario where my e-commerce site (its own SSL) had a problem communicating with the other server via SSL and I had to create a separate service ...

FileStream and memory usage

I've written the following program which purpose is to create a file of a give size with some random data in it. The program works fine and does what it's suppose to do. However, I don't understand why it consumes 5GB of RAM (see screenshot of my Task Manager). While I am writing the file with random data, I am not creating new objects. ...

Generating a literal for each item in an item collection

As it stands right now, I have a literal control on my page. In my code-behind, I'm using StringBuilder to generate some JavaScript. Also on that page I have a item collection. What I want to do is for each item in my item collection, generate my literal which will in essence generate my JavaScript. Here is an example of my code-behind n...

How to debug and deploy my class libary that is really a VSX Extension?

The Class Libary is an Microsoft Studio extension that generates a file from saving running a custom tool on a template file, following the module from this example I found from Microsoft: http://code.msdn.microsoft.com/SingleFileGenerator/Release/ProjectReleases.aspx?ReleaseId=4138. I can not figure out how I'm gonna debug, build, or ...

Entity Framework: Alternate solution to using non primary unique keys in an association

I know the entity frame work does not allow you to generate a model from a database using non primary unique keys as a Foreign Key association. Can I modify the EDMX manually? If so, can someone provide me an example or reference? If not, are there any other possibilities? Easiest Example: Here is the DDL for the tables. You will no...

getting index of itemcollection

I have a datalist with products we use on our product page. I'm generating javascript for each item in the collection using: foreach (ProductItem item in _prod.ActiveProductItemCollection) { sb.Append("<script type='text/javascript'>"); sb.Append("mboxCreate(\"product_productpage_rec\","); } and so on... What I want to do is...

C# running on older .net version

Hi, I recently wrote a c# program on framework 4, before realising the entire company runs 3.5. This is a problem mainly because of the charting support. My question is: is it possible to just embed the dlls that would be missing in the application? So .net is on the machine, just missing some parts that are packaged with the app. Th...

Why dynamic call return dynamic result?

public string Foo(object obj) { return null; } public string Foo(string str) { return null; } var x = Foo((dynamic) "abc"); Why is x dynamic, compiler not smart enough or I miss something important? ...

cannot convert string to char

I got some help on here last night about getting an the index of a collection. Here is the code I'm using. System.Text.StringBuilder sb = new System.Text.StringBuilder(); for (int i = 1; i < _prod.ActiveProductItemCollection.Count; i++) { sb.Append("<script type='text/javascript'>")...

Creating a typed configuration class using MS Enterprise Library 5.0

I have a ASP.Net 4.0 web application for which I need to create typed configuration class. What I mean is as follows: class SettingsClass { int count; string name; decimal amount; } Should map to the configuration file as: <MyAppSettings> <xmlSerializationSection type="..."> <SettingsClass> <count>...

How to detect .Net 4 Full Profile

How can you detect whether a PC has the .Net 4 Full Profile installed, as opposed to the .Net 4 Client Profile? ...