.net

How to store string descriptions of enumeration values?

The application I'm working on has lots of enumerations. These values are generally selected from drop downs in the application. What is the generally accepted way of storing the string description of these values? Here is the current issue at hand: Public Enum MyEnum SomeValue = 1 AnotherValue = 2 ObsoleteValue = 3 YetAn...

What does BlockingCollection.Dispose actually do?

What does BlockingCollection.Dispose actually do? ...

Best Practices to Deprecate WCF Services

Is there any attibute or similar mechanism to inform a web service consumer that a Service/Operation contract has been deprecated? I have a set of WCF services that need updating. As part of this update I would like to simplify some of the original design. I plan on leaving the existing operations in place but I would like to somehow ...

Adding Properties to Custom WPF Control?

Hey all, I just started WPF this morning so this is (hopefully) an easy question to solve. I've started with creating a button that has a gradient background. I want to declare the gradient start and end colors in the property of the control and then apply them in the template. I'm having trouble getting the code to compile though. ...

ArgumentException when calling .ToArray()

I have a List that is cleared out every so often. The code is exactly like this: VisitorAgent[] toPersist; List<VisitorAgent> v = (List<VisitorAgent>)state; lock (v) { toPersist = v.ToArray(); v.Clear(); } //further processing of toPersist objects Today i just got an Argument exception which doesn't ma...

How to use IDispose on my custom class?

Here is what I have: public void FindByID(string id) { using (Parser parser = new Parser()) { if ( parser.LoadUserById(id)) { ID = parser.FindID(); Name = parser.FindName(); // ... } else { MessageBox.Show("User not found."); } } // end using block. ...

.net Client Side Web app?

Never done any .net stuff before and am wondering if it is possible to run a .Net web application client side through a browser? Or does it only work by processing on the server then spit out an HTML page? I would like to leverage the System.Security.Cryptography.X509Certificates namespace to access a user's Windows-MY keystore and pull ...

Are Consumers of ServiceLocator supposed to call ServiceLocator.Current?

I'm trying to refactor my code to use the Common Service Locator. I have a Shared Library that is used by some other components. What I don't understand is: Are these components supposed to call ServiceLocator.Current and resolve their types? In that case, how can I make sure that ServiceLocator.Current is actually set? Should I create ...

Microsoft Sync Framework and Integer as Identifier

I've got to implement data synchronization between a local storage that resides on a mobile device and the server DB. The thing is that our DB (which is already in production for many years) all uses an integer as the Id of a record. I'm afraid that changing it to be a GUID is currently not an alternative because it has too many repercu...

How to read from Named Pipe latest data for a while and save that data to disc using C#?

So I have some server broadcasting live data onto Named Pipe - \\.\pipe\TestChannel (from VLC for example). I want to read it from now some N seconds and save that readen data to some.file. How to do such thing using C# .Net3.5? (and BTW I wonder about if it is easier to do it from .net4) Could you please provide some simple code exampl...

Class Library in C#

I tried to create a class library that is being used in a winforms application in C#. In my application I have input from a textbox and through a button click I'm instantiating my event with one parameter (from the textbox). I tried to create a constructor with this one parameter - but to no avail. It seems if I just add a class to be ...

With SubSonic is there a way to express relationships without foreign keys?

Our database does not have foreign keys, but we wish to be able to use SubSonic. Are there any ways except for foreign keys to express relationships between tables? Also see this related question ...

Good way to script regasm and gacutil for a COM Interop DLL on a developer machine

I'm working on a .NET library that is intended to be consumed in a VB6 project. To set up the dll to be used on my developer machine, I use regasm and gacutil, like so: regasm /tlb:MyDll.tlb Mydll.dll gacutil /i Mydll.dll On each subsequent call, I also unregister/uninstall the assembly: regasm /u /tlb:MyDll.tlb Mydll.dll regasm ...

How to programmatically check Out Of Office status in .NET

I am looking for a way to programmatically check through a subset of all AD users to get the status of their Out Of Office setting in Outlook 2007 on Windows XP/2000. I already have the list, I just need to know how to iterate through it to check the status of Out of Office Assistant. This will be happening through an executable runnin...

Logging from .NET framework internals (Logging.On)

I’m debugging some unexpected behavior and while tracing in to the .NET framework I see a bunch of stuff like this: if (Logging.On) { Logging.PrintInfo(Logging.Web, this, SR.GetString(SR.net_log_n_certs_after_filtering, filteredCerts.Count)); … } But (as expected by default) the execution step...

Is out there any sample of reading http requests using TCP socket collecting data from them (like emulating Http server in some way)

Is out there any sample of reading http requests using TCP socket collecting data from them (like emulating Http server in some way) so I wanna to keep data like senders IP:PORT, request body and so on. So has any one seen such thing in OpenSource projects or do you know how to create it? (if so please provide siple code example) ...

Simple proxy server for web services

Hi I am looking for a proxy server for web services primarily for port forwarding in the DMZ environment. Previously I have used Amberpoint or Data Power for this purpose. Now, in my new project I do not have access to any proxy servers and the traffic is pretty light at a maximum of 100 requests/day. I looked at Managed Service Engin...

WCF-service: how to authorize user

WCF-service is hosted by ASP.NET web-site. ASP.NET Membership is not used in web-site. User is logged using "custom" page, ID of logged user is stored into Session (HttpContext.Current.Session). WCF-service is consumed by Silverlight (4 version) application. How to check if current user (that loaded Silverlight application) is authoris...

Update Syntax for Oracle 10g using ASP.NET

I have a GridView with an Update button. I want to update a field in the database but I think the '@' in the code below is causing the problem in my ASP .NET page. What can be done within the grid or in the update (UpdateCommand) statement? Note, I get an Ora 00936 error. <asp:SqlDataSource ID="dsBooks" runat="server" Provid...

ASP.NET MVC Strongly Typed View With DropDownList

Long story short, I'm trying to add a few extra items to ViewData to make my life easier, and its an edge case that doesn't really justify its own model just for this one case. Keep reading for more specific details. So I have a strongly typed edit view for one of my objects, everything works great until I try to put a dropdownlist on t...