.net

How can I add a XML prefix to fields in WCF Message Serialization?

How can I add a XML prefix to fields in WCF Message Serialization? I'm connecting up to a Java Spring web service from .NET, and an object that I pass in with parameters is being serialized as you would expect: <MyClass> <field1>Field 1 Value</field1> <field2>Field 2 Value</field2> </MyClass> However, the web service requires tha...

How do I set a constraint for unique values in a C#.NET dataset table column?

Hello, I have one dataset with a few tables. In one of the tables where I'm adding to, I would like to have a constraint where it will only allow to add a row if I have a unique value in a column. Table: Users Columns: AutoID, GroupID, UnitID*, etc. In the MVS2008, I went to the Designer and set the Unique property for UnitID to true...

How to detect if application is activated by clicking in the taskbar

I have an application with several windows where only the main window appears in the taskbar. With a click on the icon in the taskbar I want all my application windows to show up on top of any other open windows. I tried Form_Activated event but this is also fired if the application is activated by a direct click in the main window. S...

Why does this LINQ query compile?

After reading "Odd query expressions" by Jon Skeet, I tried the code below. I expected the LINQ query at the end to translate to int query = proxy.Where(x => x).Select(x => x); which does not compile because Where returns an int. The code compiled and prints "Where(x => x)" to the screen and query is set to 2. Select is never called, bu...

Regex: captures, groups, confusion

Hi, I can't seem to figure out captures + groups in Regex (.net). Let's say I have the following input string, where each letter is actually a placeholder for more complex regex expression (so simple character exclusion won't work): CBDAEDBCEFBCD Or, more generically, here is a string pattern written in 'regex': (C|B|D)*A(E*)(D|B|C...

WCF with XmlSerializer: namespace collision when returning generic contracts

The background I'm developing a REST API for a C#.NET web application using WCF. I configured it to use the XmlSerializer rather than its default DataContractSerializer, for greater control over the XML format. I created a generic ResponseContract<TResponse, TErrorCode> data contract, which wraps the response with <Api> and <Response> f...

Troubleshooting Internal Error in the .NET Runtime

Several weeks ago, my company laptop started having some strange problems. I could no longer launch the Microsoft Developer Web Server (via Visual Studio->Debug). I later figured out that I couldn't execute any .NET application. In speaking with Microsoft CLR specialist after reviewing my dmp files, he said When loaded into yo...

WCF RIA Services link dropdownlist not present in project properties (Visual Studio 2010)

I committed a project to VSTF and then pulled it down locally on another machine. It works fine on my dev box, but on the other machine, the WCF RIA Service link appears to be gone and there is no option to re-add it in the project properties. See image for clarification: http://imgur.com/XIwfB.png What's missing on the other machine? ...

C#.net sockets upload rate

I have a class that uses sockets to send and receive data asynchronously over the network: class Client { private Socket mSocket; /* ... */ public void SendPacket(byte[] data) { mSocket.BeginSend(data, 0, data.Length, SocketFlags.None, OnSent, null); } private void OnSent(IAsyncResult ar) { ...

ADO.NET Entity Model connection string issue

Apparently the code generator for the designer class, EntityModelCodeGenerator that is, uses the "Entity Container Name", a property of the model, for the name of the connectionstring; meaning that the model constructor in the designer class that has the named connection string parameter will always be generated using the Entity Containe...

Two applications load same .NET assembly: same instance?

1) .NET Assembly MyAssembly.dll implements a Singleton class MyClass 2) A .NET APP has a reference to MyAssembly.dll and uses MyClass 3) A .NET ActiveX MyActiveX.dll implements a COM Visible class wich in turn references to MyClass in MyAssembly.dll My question is: if the app and the ActiveX are running at the same time (the ActiveX ...

Languages and Frameworks for creating High Load Web Service ?

Maybe, i'm duplicating some existing theme (close this one if it's true) but i'm planning to work with high load web services and curios about best practices. I have projects on Java and Grails. I'm doubt if Grails is right solution for high load service but Java (without any Hibernate or similar tools) can be used very well. Anyway, w...

how do you add multiple versions of the same assembly to the gac

My one ASP.NET web site uses two different business object class libraries. There is a common framework DLL (CSLA.dll) between these two libraries. The problem is that one library wants to upgrade to CSLA v.4.0.1 and the other wants to remain at v.2.1.4. How do I solve this conflict at the web site? I think I need to install both versio...

Converting c++ printf formatting to/from VB .NET string formatting

I have some VB .NET software that interfaces to a load of old (but sound) COM objects. The VB provides a GUI for the COM objects, part of which consists of setting various options on the COM objects - several of which relate to string formatting. I have a simple pair of VB .NET functions that convert basic %f, %d, %g formats to/from .NE...

WPF - Changing Animation Path

I have a MatrixAnimationUsingPath that animates an arrow moving along a path... In my code behind within the MainWindow I am setting the PathGeometry to a given PathGeometry. This works fine and when everything loads the arrow is moving along the path fine... But when the user clicks a button - in the button handler I need to change the...

WCF: why is the thread pool not creating additional IO threads

Hi, we have performance issues in one of our WCF web services. We experience that: ASP.NET runs out of worker threads and starts queuing. No magic. WCF queues work items to be processed by an IO threads. Ok. I understand that delays can occur while new IO threads are being created. Those delays can be substantial. However, it seems...

How to prevent .net application to be decompiled

Possible Duplicates: What is the best .NET obfuscator on the market? Best .NET obfuscation tools/strategy Hi there, I'm ending my development of a small business application, using NET 4.0. I would like to know which tool are you using to prevent your code to be decompiled/stolen. I know that exists a few tools in the mar...

Custom Error Handling message for Custom WebServiceHost

I Have a Custom WCF Service Host (webServicehost2) and Factory that is doing some dependency injection (implementing a custom IInstanceProvider) and also some custom authentication (impementing a custom RequestInterceptor). I Have a very small issue in that when i navigate to a REST resource that does not exsist. for example http://loc...

Other than Linq to SQL does anything else consume INotifyPropertyChanging?

Having never used INotifyPropertyChanging i was wondering if anything other than Linq to SQL uses it? And if Linq to SQL is the only user why does INotifyPropertyChanging exist in System.ComponentModel? http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanging.aspx ...

Possible bug with Graphics.DrawString and TextRenderingHint in .Net Winforms

Here's the OnPaint method of a control that simply inherits from control and provides a property to get/set the textrenderinghint: Private _mode as TextRenderingHint = SystemDefault. Public Property Mode as TextRenderingHint Get & Set _mode ... Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs) ...